From 4e9e15b3b1a3b86cbc265f2bf03b4a9f80323e6f Mon Sep 17 00:00:00 2001 From: Srujan Gaddam Date: Fri, 10 May 2024 14:41:20 -0700 Subject: [PATCH] Generate APIs based on standards track and not experimental --- lib/src/dom.dart | 52 +- lib/src/dom/accelerometer.dart | 70 + lib/src/dom/attribution_reporting_api.dart | 27 + lib/src/dom/battery_status.dart | 83 + lib/src/dom/clipboard_apis.dart | 14 - lib/src/dom/cookie_store.dart | 286 +++ lib/src/dom/credential_management.dart | 88 +- lib/src/dom/css_font_loading.dart | 27 - lib/src/dom/css_fonts.dart | 12 - lib/src/dom/css_paint_api.dart | 153 ++ lib/src/dom/css_transitions_2.dart | 12 - lib/src/dom/css_typed_om.dart | 148 -- lib/src/dom/css_view_transitions.dart | 73 - lib/src/dom/cssom.dart | 5 +- lib/src/dom/cssom_view.dart | 39 - lib/src/dom/dom.dart | 620 ++++++- lib/src/dom/encrypted_media.dart | 8 - lib/src/dom/event_timing.dart | 71 + lib/src/dom/ext_disjoint_timer_query.dart | 47 + .../dom/ext_disjoint_timer_query_webgl2.dart | 29 + lib/src/dom/ext_texture_norm16.dart | 27 + lib/src/dom/fedcm.dart | 56 + lib/src/dom/fetch.dart | 20 +- lib/src/dom/fido.dart | 37 + lib/src/dom/fullscreen.dart | 27 + lib/src/dom/gamepad.dart | 38 +- lib/src/dom/generic_sensor.dart | 121 ++ lib/src/dom/gyroscope.dart | 62 + lib/src/dom/hr_time.dart | 8 + lib/src/dom/html.dart | 1635 +++++++++-------- lib/src/dom/image_capture.dart | 52 + lib/src/dom/intersection_observer.dart | 30 - lib/src/dom/khr_parallel_shader_compile.dart | 20 + lib/src/dom/largest_contentful_paint.dart | 61 + lib/src/dom/mathml_core.dart | 12 - lib/src/dom/media_source.dart | 85 - lib/src/dom/mediacapture_fromelement.dart | 49 + lib/src/dom/mediacapture_streams.dart | 373 +++- lib/src/dom/mediasession.dart | 39 - lib/src/dom/mediastream_recording.dart | 4 - lib/src/dom/mst_content_hint.dart | 16 + lib/src/dom/navigation_timing.dart | 14 - lib/src/dom/notifications.dart | 52 - lib/src/dom/oes_vertex_array_object.dart | 3 +- lib/src/dom/orientation_event.dart | 4 - lib/src/dom/orientation_sensor.dart | 116 ++ lib/src/dom/ovr_multiview2.dart | 31 + lib/src/dom/performance_timeline.dart | 13 +- lib/src/dom/permissions.dart | 24 +- lib/src/dom/picture_in_picture.dart | 75 + lib/src/dom/pointerevents.dart | 35 +- lib/src/dom/private_network_access.dart | 16 + lib/src/dom/push_api.dart | 31 - lib/src/dom/remote_playback.dart | 63 + lib/src/dom/reporting.dart | 11 - lib/src/dom/requestidlecallback.dart | 83 + lib/src/dom/resource_timing.dart | 21 - lib/src/dom/scheduling_apis.dart | 239 +++ lib/src/dom/screen_capture.dart | 45 + lib/src/dom/secure_payment_confirmation.dart | 58 + lib/src/dom/selection_api.dart | 2 - lib/src/dom/service_workers.dart | 12 +- lib/src/dom/speech_api.dart | 122 +- lib/src/dom/streams.dart | 84 - lib/src/dom/svg.dart | 50 - lib/src/dom/svg_animations.dart | 6 - lib/src/dom/touch_events.dart | 3 +- lib/src/dom/trust_token_api.dart | 35 + lib/src/dom/trusted_types.dart | 10 - lib/src/dom/uievents.dart | 132 +- lib/src/dom/video_rvfc.dart | 16 + lib/src/dom/wasm_js_api.dart | 160 ++ lib/src/dom/web_animations.dart | 143 +- lib/src/dom/web_animations_2.dart | 27 - lib/src/dom/web_bluetooth.dart | 25 + lib/src/dom/web_otp.dart | 22 + lib/src/dom/web_share.dart | 34 + lib/src/dom/webaudio.dart | 126 +- lib/src/dom/webauthn.dart | 299 +-- lib/src/dom/webcodecs.dart | 569 ++++++ .../dom/webcodecs_av1_codec_registration.dart | 28 + .../dom/webcodecs_avc_codec_registration.dart | 29 + .../webcodecs_hevc_codec_registration.dart | 29 + .../dom/webcodecs_vp9_codec_registration.dart | 22 + lib/src/dom/webcryptoapi.dart | 556 ------ lib/src/dom/webgl1.dart | 88 +- lib/src/dom/webgl2.dart | 21 +- lib/src/dom/webgl_compressed_texture_etc.dart | 29 + .../dom/webgl_compressed_texture_etc1.dart | 20 + .../dom/webgl_compressed_texture_pvrtc.dart | 24 + lib/src/dom/webgl_multi_draw.dart | 57 + lib/src/dom/webgpu.dart | 66 + lib/src/dom/webmidi.dart | 255 +++ lib/src/dom/webrtc.dart | 101 +- lib/src/dom/webrtc_encoded_transform.dart | 62 - lib/src/dom/webrtc_identity.dart | 29 + lib/src/dom/webrtc_priority.dart | 16 + lib/src/dom/webrtc_stats.dart | 1431 --------------- lib/src/dom/webtransport.dart | 328 ++++ lib/src/dom/webxr.dart | 612 ++++++ lib/src/dom/webxr_hand_input.dart | 55 + 101 files changed, 6681 insertions(+), 4624 deletions(-) create mode 100644 lib/src/dom/accelerometer.dart create mode 100644 lib/src/dom/attribution_reporting_api.dart create mode 100644 lib/src/dom/battery_status.dart create mode 100644 lib/src/dom/cookie_store.dart create mode 100644 lib/src/dom/css_paint_api.dart delete mode 100644 lib/src/dom/css_view_transitions.dart create mode 100644 lib/src/dom/event_timing.dart create mode 100644 lib/src/dom/ext_disjoint_timer_query.dart create mode 100644 lib/src/dom/ext_disjoint_timer_query_webgl2.dart create mode 100644 lib/src/dom/ext_texture_norm16.dart create mode 100644 lib/src/dom/fedcm.dart create mode 100644 lib/src/dom/fido.dart create mode 100644 lib/src/dom/fullscreen.dart create mode 100644 lib/src/dom/generic_sensor.dart create mode 100644 lib/src/dom/gyroscope.dart create mode 100644 lib/src/dom/image_capture.dart create mode 100644 lib/src/dom/khr_parallel_shader_compile.dart create mode 100644 lib/src/dom/largest_contentful_paint.dart create mode 100644 lib/src/dom/mediacapture_fromelement.dart create mode 100644 lib/src/dom/mst_content_hint.dart create mode 100644 lib/src/dom/orientation_sensor.dart create mode 100644 lib/src/dom/ovr_multiview2.dart create mode 100644 lib/src/dom/picture_in_picture.dart create mode 100644 lib/src/dom/private_network_access.dart create mode 100644 lib/src/dom/remote_playback.dart create mode 100644 lib/src/dom/requestidlecallback.dart create mode 100644 lib/src/dom/scheduling_apis.dart create mode 100644 lib/src/dom/screen_capture.dart create mode 100644 lib/src/dom/secure_payment_confirmation.dart create mode 100644 lib/src/dom/trust_token_api.dart create mode 100644 lib/src/dom/video_rvfc.dart create mode 100644 lib/src/dom/wasm_js_api.dart create mode 100644 lib/src/dom/web_bluetooth.dart create mode 100644 lib/src/dom/web_otp.dart create mode 100644 lib/src/dom/web_share.dart create mode 100644 lib/src/dom/webcodecs.dart create mode 100644 lib/src/dom/webcodecs_av1_codec_registration.dart create mode 100644 lib/src/dom/webcodecs_avc_codec_registration.dart create mode 100644 lib/src/dom/webcodecs_hevc_codec_registration.dart create mode 100644 lib/src/dom/webcodecs_vp9_codec_registration.dart create mode 100644 lib/src/dom/webgl_compressed_texture_etc.dart create mode 100644 lib/src/dom/webgl_compressed_texture_etc1.dart create mode 100644 lib/src/dom/webgl_compressed_texture_pvrtc.dart create mode 100644 lib/src/dom/webgl_multi_draw.dart create mode 100644 lib/src/dom/webgpu.dart create mode 100644 lib/src/dom/webmidi.dart create mode 100644 lib/src/dom/webrtc_identity.dart create mode 100644 lib/src/dom/webrtc_priority.dart delete mode 100644 lib/src/dom/webrtc_stats.dart create mode 100644 lib/src/dom/webtransport.dart create mode 100644 lib/src/dom/webxr.dart create mode 100644 lib/src/dom/webxr_hand_input.dart diff --git a/lib/src/dom.dart b/lib/src/dom.dart index a0f35986..80d20cf5 100644 --- a/lib/src/dom.dart +++ b/lib/src/dom.dart @@ -2,10 +2,14 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. +export 'dom/accelerometer.dart'; export 'dom/angle_instanced_arrays.dart'; +export 'dom/attribution_reporting_api.dart'; +export 'dom/battery_status.dart'; export 'dom/clipboard_apis.dart'; export 'dom/compression.dart'; export 'dom/console.dart'; +export 'dom/cookie_store.dart'; export 'dom/credential_management.dart'; export 'dom/csp.dart'; export 'dom/css_animations.dart'; @@ -18,11 +22,11 @@ export 'dom/css_font_loading.dart'; export 'dom/css_fonts.dart'; export 'dom/css_highlight_api.dart'; export 'dom/css_masking.dart'; +export 'dom/css_paint_api.dart'; export 'dom/css_properties_values_api.dart'; export 'dom/css_transitions.dart'; export 'dom/css_transitions_2.dart'; export 'dom/css_typed_om.dart'; -export 'dom/css_view_transitions.dart'; export 'dom/cssom.dart'; export 'dom/cssom_view.dart'; export 'dom/dom.dart'; @@ -30,9 +34,12 @@ export 'dom/dom_parsing.dart'; export 'dom/encoding.dart'; export 'dom/encrypted_media.dart'; export 'dom/entries_api.dart'; +export 'dom/event_timing.dart'; export 'dom/ext_blend_minmax.dart'; export 'dom/ext_color_buffer_float.dart'; export 'dom/ext_color_buffer_half_float.dart'; +export 'dom/ext_disjoint_timer_query.dart'; +export 'dom/ext_disjoint_timer_query_webgl2.dart'; export 'dom/ext_float_blend.dart'; export 'dom/ext_frag_depth.dart'; export 'dom/ext_shader_texture_lod.dart'; @@ -40,24 +47,35 @@ export 'dom/ext_srgb.dart'; export 'dom/ext_texture_compression_bptc.dart'; export 'dom/ext_texture_compression_rgtc.dart'; export 'dom/ext_texture_filter_anisotropic.dart'; +export 'dom/ext_texture_norm16.dart'; +export 'dom/fedcm.dart'; export 'dom/fetch.dart'; +export 'dom/fido.dart'; export 'dom/fileapi.dart'; export 'dom/filter_effects.dart'; export 'dom/fs.dart'; +export 'dom/fullscreen.dart'; export 'dom/gamepad.dart'; +export 'dom/generic_sensor.dart'; export 'dom/geolocation.dart'; export 'dom/geometry.dart'; +export 'dom/gyroscope.dart'; export 'dom/hr_time.dart'; export 'dom/html.dart'; +export 'dom/image_capture.dart'; export 'dom/indexeddb.dart'; export 'dom/intersection_observer.dart'; +export 'dom/khr_parallel_shader_compile.dart'; +export 'dom/largest_contentful_paint.dart'; export 'dom/mathml_core.dart'; export 'dom/media_capabilities.dart'; export 'dom/media_playback_quality.dart'; export 'dom/media_source.dart'; +export 'dom/mediacapture_fromelement.dart'; export 'dom/mediacapture_streams.dart'; export 'dom/mediasession.dart'; export 'dom/mediastream_recording.dart'; +export 'dom/mst_content_hint.dart'; export 'dom/navigation_timing.dart'; export 'dom/notifications.dart'; export 'dom/oes_draw_buffers_indexed.dart'; @@ -70,18 +88,27 @@ export 'dom/oes_texture_half_float.dart'; export 'dom/oes_texture_half_float_linear.dart'; export 'dom/oes_vertex_array_object.dart'; export 'dom/orientation_event.dart'; +export 'dom/orientation_sensor.dart'; +export 'dom/ovr_multiview2.dart'; export 'dom/paint_timing.dart'; export 'dom/payment_request.dart'; export 'dom/performance_timeline.dart'; export 'dom/permissions.dart'; +export 'dom/picture_in_picture.dart'; export 'dom/pointerevents.dart'; +export 'dom/private_network_access.dart'; export 'dom/push_api.dart'; export 'dom/referrer_policy.dart'; +export 'dom/remote_playback.dart'; export 'dom/reporting.dart'; +export 'dom/requestidlecallback.dart'; export 'dom/resize_observer.dart'; export 'dom/resource_timing.dart'; +export 'dom/scheduling_apis.dart'; +export 'dom/screen_capture.dart'; export 'dom/screen_orientation.dart'; export 'dom/screen_wake_lock.dart'; +export 'dom/secure_payment_confirmation.dart'; export 'dom/selection_api.dart'; export 'dom/server_timing.dart'; export 'dom/service_workers.dart'; @@ -91,21 +118,35 @@ export 'dom/streams.dart'; export 'dom/svg.dart'; export 'dom/svg_animations.dart'; export 'dom/touch_events.dart'; +export 'dom/trust_token_api.dart'; export 'dom/trusted_types.dart'; export 'dom/uievents.dart'; export 'dom/url.dart'; export 'dom/user_timing.dart'; export 'dom/vibration.dart'; +export 'dom/video_rvfc.dart'; +export 'dom/wasm_js_api.dart'; export 'dom/web_animations.dart'; export 'dom/web_animations_2.dart'; +export 'dom/web_bluetooth.dart'; export 'dom/web_locks.dart'; +export 'dom/web_otp.dart'; +export 'dom/web_share.dart'; export 'dom/webaudio.dart'; export 'dom/webauthn.dart'; +export 'dom/webcodecs.dart'; +export 'dom/webcodecs_av1_codec_registration.dart'; +export 'dom/webcodecs_avc_codec_registration.dart'; +export 'dom/webcodecs_hevc_codec_registration.dart'; +export 'dom/webcodecs_vp9_codec_registration.dart'; export 'dom/webcryptoapi.dart'; export 'dom/webgl1.dart'; export 'dom/webgl2.dart'; export 'dom/webgl_color_buffer_float.dart'; export 'dom/webgl_compressed_texture_astc.dart'; +export 'dom/webgl_compressed_texture_etc.dart'; +export 'dom/webgl_compressed_texture_etc1.dart'; +export 'dom/webgl_compressed_texture_pvrtc.dart'; export 'dom/webgl_compressed_texture_s3tc.dart'; export 'dom/webgl_compressed_texture_s3tc_srgb.dart'; export 'dom/webgl_debug_renderer_info.dart'; @@ -113,10 +154,17 @@ export 'dom/webgl_debug_shaders.dart'; export 'dom/webgl_depth_texture.dart'; export 'dom/webgl_draw_buffers.dart'; export 'dom/webgl_lose_context.dart'; +export 'dom/webgl_multi_draw.dart'; +export 'dom/webgpu.dart'; export 'dom/webidl.dart'; +export 'dom/webmidi.dart'; export 'dom/webrtc.dart'; export 'dom/webrtc_encoded_transform.dart'; -export 'dom/webrtc_stats.dart'; +export 'dom/webrtc_identity.dart'; +export 'dom/webrtc_priority.dart'; export 'dom/websockets.dart'; +export 'dom/webtransport.dart'; export 'dom/webvtt.dart'; +export 'dom/webxr.dart'; +export 'dom/webxr_hand_input.dart'; export 'dom/xhr.dart'; diff --git a/lib/src/dom/accelerometer.dart b/lib/src/dom/accelerometer.dart new file mode 100644 index 00000000..0bacfb46 --- /dev/null +++ b/lib/src/dom/accelerometer.dart @@ -0,0 +1,70 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. +// +// API docs from [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web). +// Attributions and copyright licensing by Mozilla Contributors is licensed +// under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/. + +// Generated from Web IDL definitions. + +@JS() +library; + +import 'dart:js_interop'; + +import 'generic_sensor.dart'; + +typedef AccelerometerLocalCoordinateSystem = String; +extension type AccelerometerSensorOptions._(JSObject _) + implements SensorOptions, JSObject { + external factory AccelerometerSensorOptions({ + num frequency, + AccelerometerLocalCoordinateSystem referenceFrame, + }); + + external AccelerometerLocalCoordinateSystem get referenceFrame; + external set referenceFrame(AccelerometerLocalCoordinateSystem value); +} + +/// The **`LinearAccelerationSensor`** interface of the +/// [Sensor APIs](https://developer.mozilla.org/en-US/docs/Web/API/Sensor_APIs) +/// provides on each reading the acceleration applied to the device along all +/// three axes, but without the contribution of gravity. +/// +/// To use this sensor, the user must grant permission to the `'accelerometer'` +/// device sensor through the +/// [Permissions API](https://developer.mozilla.org/en-US/docs/Web/API/Permissions_API). +/// In addition, this feature may be blocked by a +/// [Permissions Policy](https://developer.mozilla.org/en-US/docs/Web/HTTP/Permissions_Policy) +/// set on your server. +/// +/// --- +/// +/// API documentation sourced from +/// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/LinearAccelerationSensor). +extension type LinearAccelerationSensor._(JSObject _) + implements Sensor, JSObject { + external factory LinearAccelerationSensor( + [AccelerometerSensorOptions options]); +} + +/// The **`GravitySensor`** interface of the +/// [Sensor APIs](https://developer.mozilla.org/en-US/docs/Web/API/Sensor_APIs) +/// provides on each reading the gravity applied to the device along all three +/// axes. +/// +/// To use this sensor, the user must grant permission to the `'accelerometer'` +/// device sensor through the +/// [Permissions API](https://developer.mozilla.org/en-US/docs/Web/API/Permissions_API). +/// In addition, this feature may be blocked by a +/// [Permissions Policy](https://developer.mozilla.org/en-US/docs/Web/HTTP/Permissions_Policy) +/// set on your server. +/// +/// --- +/// +/// API documentation sourced from +/// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/GravitySensor). +extension type GravitySensor._(JSObject _) implements Sensor, JSObject { + external factory GravitySensor([AccelerometerSensorOptions options]); +} diff --git a/lib/src/dom/attribution_reporting_api.dart b/lib/src/dom/attribution_reporting_api.dart new file mode 100644 index 00000000..d7f96cca --- /dev/null +++ b/lib/src/dom/attribution_reporting_api.dart @@ -0,0 +1,27 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. +// +// API docs from [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web). +// Attributions and copyright licensing by Mozilla Contributors is licensed +// under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/. + +// Generated from Web IDL definitions. + +@JS() +library; + +import 'dart:js_interop'; + +extension type AttributionReportingRequestOptions._(JSObject _) + implements JSObject { + external factory AttributionReportingRequestOptions({ + required bool eventSourceEligible, + required bool triggerEligible, + }); + + external bool get eventSourceEligible; + external set eventSourceEligible(bool value); + external bool get triggerEligible; + external set triggerEligible(bool value); +} diff --git a/lib/src/dom/battery_status.dart b/lib/src/dom/battery_status.dart new file mode 100644 index 00000000..b362c967 --- /dev/null +++ b/lib/src/dom/battery_status.dart @@ -0,0 +1,83 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. +// +// API docs from [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web). +// Attributions and copyright licensing by Mozilla Contributors is licensed +// under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/. + +// Generated from Web IDL definitions. + +@JS() +library; + +import 'dart:js_interop'; + +import 'dom.dart'; +import 'html.dart'; + +/// The `BatteryManager` interface of the [Battery Status API] provides +/// information about the system's battery charge level. The +/// [navigator.getBattery] method returns a promise that resolves with a +/// `BatteryManager` interface. +/// +/// Since Chrome 103, the `BatteryManager` interface of [Battery Status API] +/// only expose to secure context. +/// +/// --- +/// +/// API documentation sourced from +/// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/BatteryManager). +extension type BatteryManager._(JSObject _) implements EventTarget, JSObject { + /// The **`BatteryManager.charging`** property is a Boolean value indicating + /// whether or not the device's battery is currently being charged. When its + /// value changes, the [BatteryManager.chargingchange_event] event is fired. + /// + /// If the battery is charging or the user agent is unable to report the + /// battery status information, this value is `true`. Otherwise, it is + /// `false`. + external bool get charging; + + /// The **`BatteryManager.chargingTime`** property indicates the amount of + /// time, in seconds, that remain until the battery is fully charged, or `0` + /// if the battery is already fully charged or the user agent is unable to + /// report the battery status information. + /// If the battery is currently discharging, its value is `Infinity`. + /// When its value changes, the [BatteryManager.chargingtimechange_event] + /// event is fired. + /// + /// > **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 num get chargingTime; + + /// The **`BatteryManager.dischargingTime`** property indicates the amount of + /// time, in seconds, that remains until the battery is fully discharged, + /// or `Infinity` if the battery is currently charging rather than discharging + /// or the user agent is unable to report the battery status information. + /// 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 + /// > interval (typically to the closest 15 minutes) for privacy reasons. + external num get dischargingTime; + + /// The **`BatteryManager.level`** property indicates the current battery + /// charge level as a value between `0.0` and `1.0`. + /// A value of `0.0` means the battery is empty and the system is about to be + /// suspended. + /// A value of `1.0` means the battery is full or the user agent is unable to + /// report the battery status information. + /// When its value changes, the [BatteryManager.levelchange_event] event is + /// fired. + external num get level; + external EventHandler get onchargingchange; + external set onchargingchange(EventHandler value); + external EventHandler get onchargingtimechange; + external set onchargingtimechange(EventHandler value); + external EventHandler get ondischargingtimechange; + external set ondischargingtimechange(EventHandler value); + external EventHandler get onlevelchange; + external set onlevelchange(EventHandler value); +} diff --git a/lib/src/dom/clipboard_apis.dart b/lib/src/dom/clipboard_apis.dart index ddf3668e..2f3e20c4 100644 --- a/lib/src/dom/clipboard_apis.dart +++ b/lib/src/dom/clipboard_apis.dart @@ -16,9 +16,7 @@ import 'dart:js_interop'; import 'dom.dart'; import 'fileapi.dart'; import 'html.dart'; -import 'permissions.dart'; -typedef ClipboardItemData = JSPromise; typedef ClipboardItems = JSArray; typedef PresentationStyle = String; extension type ClipboardEventInit._(JSObject _) implements EventInit, JSObject { @@ -85,8 +83,6 @@ extension type ClipboardItem._(JSObject _) implements JSObject { ClipboardItemOptions options, ]); - external static bool supports(String type); - /// The **`getType()`** method of the [ClipboardItem] interface returns a /// `Promise` that resolves with a [Blob] of the requested or an error if the /// MIME type is not found. @@ -174,13 +170,3 @@ extension type ClipboardUnsanitizedFormats._(JSObject _) implements JSObject { external JSArray get unsanitized; external set unsanitized(JSArray value); } -extension type ClipboardPermissionDescriptor._(JSObject _) - implements PermissionDescriptor, JSObject { - external factory ClipboardPermissionDescriptor({ - required String name, - bool allowWithoutGesture, - }); - - external bool get allowWithoutGesture; - external set allowWithoutGesture(bool value); -} diff --git a/lib/src/dom/cookie_store.dart b/lib/src/dom/cookie_store.dart new file mode 100644 index 00000000..aacf7b7f --- /dev/null +++ b/lib/src/dom/cookie_store.dart @@ -0,0 +1,286 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. +// +// API docs from [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web). +// Attributions and copyright licensing by Mozilla Contributors is licensed +// under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/. + +// Generated from Web IDL definitions. + +@JS() +library; + +import 'dart:js_interop'; + +import 'dom.dart'; +import 'hr_time.dart'; +import 'html.dart'; +import 'service_workers.dart'; + +typedef CookieList = JSArray; +typedef CookieSameSite = String; + +/// The **`CookieStore`** interface of the [Cookie Store API] provides methods +/// for getting and setting cookies asynchronously from either a page or a +/// service worker. +/// +/// The `CookieStore` is accessed via attributes in the global scope in a +/// [Window] or [ServiceWorkerGlobalScope] context. Therefore there is no +/// constructor. +/// +/// --- +/// +/// API documentation sourced from +/// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/CookieStore). +extension type CookieStore._(JSObject _) implements EventTarget, JSObject { + /// The **`get()`** method of the [CookieStore] interface returns a single + /// cookie with the given name or options object. The method will return the + /// first matching cookie for the passed parameters. + external JSPromise get([JSAny nameOrOptions]); + + /// The **`getAll()`** method of the [CookieStore] interface returns a list of + /// cookies that match the name or options passed to it. Passing no parameters + /// will return all cookies for the current context. + external JSPromise getAll([JSAny nameOrOptions]); + + /// The **`set()`** method of the [CookieStore] interface sets a cookie with + /// the given name and value or options object. + external JSPromise set( + JSAny nameOrOptions, [ + String value, + ]); + + /// The **`delete()`** method of the [CookieStore] interface deletes a cookie + /// with the given name or options object. The `delete()` method expires the + /// cookie by changing the date to one in the past. + external JSPromise delete(JSAny nameOrOptions); + external EventHandler get onchange; + external set onchange(EventHandler value); +} +extension type CookieStoreGetOptions._(JSObject _) implements JSObject { + external factory CookieStoreGetOptions({ + String name, + String url, + }); + + external String get name; + external set name(String value); + external String get url; + external set url(String value); +} +extension type CookieInit._(JSObject _) implements JSObject { + external factory CookieInit({ + required String name, + required String value, + DOMHighResTimeStamp? expires, + String? domain, + String path, + CookieSameSite sameSite, + bool partitioned, + }); + + external String get name; + external set name(String value); + external String get value; + external set value(String value); + external DOMHighResTimeStamp? get expires; + external set expires(DOMHighResTimeStamp? value); + external String? get domain; + external set domain(String? value); + external String get path; + external set path(String value); + external CookieSameSite get sameSite; + external set sameSite(CookieSameSite value); + external bool get partitioned; + external set partitioned(bool value); +} +extension type CookieStoreDeleteOptions._(JSObject _) implements JSObject { + external factory CookieStoreDeleteOptions({ + required String name, + String? domain, + String path, + bool partitioned, + }); + + external String get name; + external set name(String value); + external String? get domain; + external set domain(String? value); + external String get path; + external set path(String value); + external bool get partitioned; + external set partitioned(bool value); +} +extension type CookieListItem._(JSObject _) implements JSObject { + external factory CookieListItem({ + String name, + String value, + String? domain, + String path, + DOMHighResTimeStamp? expires, + bool secure, + CookieSameSite sameSite, + bool partitioned, + }); + + external String get name; + external set name(String value); + external String get value; + external set value(String value); + external String? get domain; + external set domain(String? value); + external String get path; + external set path(String value); + external DOMHighResTimeStamp? get expires; + external set expires(DOMHighResTimeStamp? value); + external bool get secure; + external set secure(bool value); + external CookieSameSite get sameSite; + external set sameSite(CookieSameSite value); + external bool get partitioned; + external set partitioned(bool value); +} + +/// The **`CookieStoreManager`** interface of the [Cookie Store API] allows +/// service workers to subscribe to cookie change events. Call +/// [CookieStoreManager.subscribe] on a particular service worker registration +/// to receive change events. +/// +/// A `CookieStoreManager` has an associated [ServiceWorkerRegistration]. Each +/// service worker registration has a cookie change subscription list, which is +/// a list of cookie change subscriptions each containing a name and URL. The +/// methods in this interface allow the service worker to add and remove +/// subscriptions from this list, and to get a list of all subscriptions. +/// +/// To get a `CookieStoreManager`, call [ServiceWorkerRegistration.cookies]. +/// +/// --- +/// +/// API documentation sourced from +/// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/CookieStoreManager). +extension type CookieStoreManager._(JSObject _) implements JSObject { + /// The **`subscribe()`** method of the [CookieStoreManager] interface + /// subscribes a [ServiceWorkerRegistration] to cookie change events. + external JSPromise subscribe( + JSArray subscriptions); + + /// The **`getSubscriptions()`** method of the [CookieStoreManager] interface + /// returns a list of all the cookie change subscriptions for this + /// [ServiceWorkerRegistration]. + external JSPromise> getSubscriptions(); + + /// The **`unsubscribe()`** method of the [CookieStoreManager] interface stops + /// the [ServiceWorkerRegistration] from receiving previously subscribed + /// events. + external JSPromise unsubscribe( + JSArray subscriptions); +} + +/// 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"). +/// +/// 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. +/// +/// --- +/// +/// API documentation sourced from +/// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/CookieChangeEvent). +extension type CookieChangeEvent._(JSObject _) implements Event, JSObject { + external factory CookieChangeEvent( + String type, [ + CookieChangeEventInit eventInitDict, + ]); + + /// The **`changed`** read-only property of the [CookieChangeEvent] interface + /// returns an array of the cookies that have been changed. + external JSArray 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. + external JSArray get deleted; +} +extension type CookieChangeEventInit._(JSObject _) + implements EventInit, JSObject { + external factory CookieChangeEventInit({ + bool bubbles, + bool cancelable, + bool composed, + CookieList changed, + CookieList deleted, + }); + + external CookieList get changed; + external set changed(CookieList value); + external CookieList get deleted; + external set deleted(CookieList value); +} + +/// The **`ExtendableCookieChangeEvent`** interface of the [Cookie Store API] is +/// the event type passed to [ServiceWorkerGlobalScope.cookiechange_event] event +/// fired at the [ServiceWorkerGlobalScope] when any cookie changes occur which +/// match the service worker's cookie change subscription list. A cookie change +/// event consists of a cookie and a type. (either "changed" or "deleted") +/// +/// Cookie changes that cause the `ExtendableCookieChangeEvent` 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. +/// +/// --- +/// +/// API documentation sourced from +/// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/ExtendableCookieChangeEvent). +extension type ExtendableCookieChangeEvent._(JSObject _) + implements ExtendableEvent, JSObject { + external factory ExtendableCookieChangeEvent( + String type, [ + ExtendableCookieChangeEventInit eventInitDict, + ]); + + /// The **`changed`** read-only property of the [ExtendableCookieChangeEvent] + /// interface returns any cookies that have been changed by the given + /// `ExtendableCookieChangeEvent` instance. + external JSArray get changed; + + /// The **`deleted`** read-only property of the [ExtendableCookieChangeEvent] + /// interface returns any cookies that have been deleted by the given + /// `ExtendableCookieChangeEvent` instance. + external JSArray get deleted; +} +extension type ExtendableCookieChangeEventInit._(JSObject _) + implements ExtendableEventInit, JSObject { + external factory ExtendableCookieChangeEventInit({ + bool bubbles, + bool cancelable, + bool composed, + CookieList changed, + CookieList deleted, + }); + + external CookieList get changed; + external set changed(CookieList value); + external CookieList get deleted; + external set deleted(CookieList value); +} diff --git a/lib/src/dom/credential_management.dart b/lib/src/dom/credential_management.dart index b016bdfa..b07a6971 100644 --- a/lib/src/dom/credential_management.dart +++ b/lib/src/dom/credential_management.dart @@ -14,6 +14,8 @@ library; import 'dart:js_interop'; import 'dom.dart'; +import 'fedcm.dart'; +import 'web_otp.dart'; import 'webauthn.dart'; typedef PasswordCredentialInit = JSObject; @@ -37,8 +39,6 @@ typedef CredentialMediationRequirement = String; /// API documentation sourced from /// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/Credential). extension type Credential._(JSObject _) implements JSObject { - external static JSPromise isConditionalMediationAvailable(); - /// The **`id`** read-only property of the [Credential] interface returns a /// string containing the credential's identifier. This might be a GUID, /// username, or email address, or some other value, depending on the type of @@ -154,8 +154,10 @@ extension type CredentialRequestOptions._(JSObject _) implements JSObject { external factory CredentialRequestOptions({ CredentialMediationRequirement mediation, AbortSignal signal, + IdentityCredentialRequestOptions identity, bool password, FederatedCredentialRequestOptions federated, + OTPCredentialRequestOptions otp, PublicKeyCredentialRequestOptions publicKey, }); @@ -163,10 +165,14 @@ extension type CredentialRequestOptions._(JSObject _) implements JSObject { external set mediation(CredentialMediationRequirement value); external AbortSignal get signal; external set signal(AbortSignal value); + external IdentityCredentialRequestOptions get identity; + external set identity(IdentityCredentialRequestOptions value); external bool get password; external set password(bool value); external FederatedCredentialRequestOptions get federated; external set federated(FederatedCredentialRequestOptions value); + external OTPCredentialRequestOptions get otp; + external set otp(OTPCredentialRequestOptions value); external PublicKeyCredentialRequestOptions get publicKey; external set publicKey(PublicKeyCredentialRequestOptions value); } @@ -187,43 +193,6 @@ extension type CredentialCreationOptions._(JSObject _) implements JSObject { external PublicKeyCredentialCreationOptions get publicKey; external set publicKey(PublicKeyCredentialCreationOptions value); } - -/// The **`PasswordCredential`** interface of the -/// [Credential Management API](https://developer.mozilla.org/en-US/docs/Web/API/Credential_Management_API) -/// provides information about a username/password pair. In supporting browsers -/// an instance of this class may be passed in the `credential` member of the -/// `init` object for global [fetch]. -/// -/// > **Note:** This interface is restricted to top-level contexts and cannot be -/// > used from an `iframe`. -/// -/// --- -/// -/// API documentation sourced from -/// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/PasswordCredential). -extension type PasswordCredential._(JSObject _) - implements Credential, JSObject { - external factory PasswordCredential(JSObject dataOrForm); - - /// The **`password`** read-only property - /// of the [PasswordCredential] interface returns a string - /// containing the password of the credential. - external String get password; - - /// The **`name`** read-only property of - /// the [PasswordCredential] interface returns a string - /// containing a human-readable public name for display in a credential - /// chooser. - external String get name; - - /// The **`iconURL`** read-only property - /// of the [PasswordCredential] interface returns a string - /// containing a URL pointing to an image for an icon. This image is intended - /// for display - /// in a credential chooser. The URL must be accessible without - /// authentication. - external String get iconURL; -} extension type PasswordCredentialData._(JSObject _) implements CredentialData, JSObject { external factory PasswordCredentialData({ @@ -243,47 +212,6 @@ extension type PasswordCredentialData._(JSObject _) external String get password; external set password(String value); } - -/// The **`FederatedCredential`** interface of the -/// [Credential Management API](https://developer.mozilla.org/en-US/docs/Web/API/Credential_Management_API) -/// provides information about credentials from a federated identity provider. A -/// federated identity provider is an entity that a website trusts to correctly -/// authenticate a user, and that provides an API for that purpose. -/// [OpenID Connect](https://openid.net/developers/specs/) is an example of a -/// federated identity provider framework. -/// -/// > **Note:** The [Federated Credential Management API -/// > (FedCM)](https://developer.mozilla.org/en-US/docs/Web/API/FedCM_API) -/// > provides a more complete solution for handling identity federation in the -/// > browser, and uses the [IdentityCredential] type. -/// -/// In browsers that support it, an instance of this interface may be passed in -/// the `credential` member of the `init` object for global [fetch]. -/// -/// --- -/// -/// API documentation sourced from -/// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/FederatedCredential). -extension type FederatedCredential._(JSObject _) - implements Credential, JSObject { - external factory FederatedCredential(FederatedCredentialInit data); - - /// The **`provider`** property of the - /// [FederatedCredential] interface returns a string - /// containing a credential's federated identity provider. - external String get provider; - - /// The **`protocol`** property of the - /// [FederatedCredential] interface returns a read-only - /// string containing a credential's federated identity protocol. If this - /// property is - /// [`null`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/null), - /// the protocol may be inferred from the - /// [FederatedCredential.provider] property. - external String? get protocol; - external String get name; - external String get iconURL; -} extension type FederatedCredentialRequestOptions._(JSObject _) implements JSObject { external factory FederatedCredentialRequestOptions({ diff --git a/lib/src/dom/css_font_loading.dart b/lib/src/dom/css_font_loading.dart index b00000e7..1ff3e922 100644 --- a/lib/src/dom/css_font_loading.dart +++ b/lib/src/dom/css_font_loading.dart @@ -135,13 +135,6 @@ extension type FontFace._(JSObject _) implements JSObject { external String get featureSettings; external set featureSettings(String value); - /// The **`variationSettings`** property of the [FontFace] interface retrieves - /// or sets low-level OpenType or TrueType font variations. - /// - /// This property is equivalent to the descriptor. - external String get variationSettings; - external set variationSettings(String value); - /// The **`display`** property of the [FontFace] interface determines how a /// font face is displayed based on whether and when it is downloaded and /// ready to use. @@ -196,26 +189,6 @@ extension type FontFace._(JSObject _) implements JSObject { /// specified in the object's constructor is done loading or rejects with a /// `SyntaxError`. external JSPromise get loaded; - external FontFaceFeatures get features; - external FontFaceVariations get variations; - external FontFacePalettes get palettes; -} -extension type FontFaceFeatures._(JSObject _) implements JSObject {} -extension type FontFaceVariationAxis._(JSObject _) implements JSObject { - external String get name; - external String get axisTag; - external num get minimumValue; - external num get maximumValue; - external num get defaultValue; -} -extension type FontFaceVariations._(JSObject _) implements JSObject {} -extension type FontFacePalette._(JSObject _) implements JSObject { - external int get length; - external bool get usableWithLightBackground; - external bool get usableWithDarkBackground; -} -extension type FontFacePalettes._(JSObject _) implements JSObject { - external int get length; } extension type FontFaceSetLoadEventInit._(JSObject _) implements EventInit, JSObject { diff --git a/lib/src/dom/css_fonts.dart b/lib/src/dom/css_fonts.dart index 833204e2..0482332d 100644 --- a/lib/src/dom/css_fonts.dart +++ b/lib/src/dom/css_fonts.dart @@ -45,18 +45,6 @@ extension type CSSFontFeatureValuesRule._(JSObject _) /// represents the name of the font family it applies to. external String get fontFamily; external set fontFamily(String value); - external CSSFontFeatureValuesMap get annotation; - external CSSFontFeatureValuesMap get ornaments; - external CSSFontFeatureValuesMap get stylistic; - external CSSFontFeatureValuesMap get swash; - external CSSFontFeatureValuesMap get characterVariant; - external CSSFontFeatureValuesMap get styleset; -} -extension type CSSFontFeatureValuesMap._(JSObject _) implements JSObject { - external void set( - String featureValueName, - JSAny values, - ); } /// The **`CSSFontPaletteValuesRule`** interface represents an diff --git a/lib/src/dom/css_paint_api.dart b/lib/src/dom/css_paint_api.dart new file mode 100644 index 00000000..10927d28 --- /dev/null +++ b/lib/src/dom/css_paint_api.dart @@ -0,0 +1,153 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. +// +// API docs from [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web). +// Attributions and copyright licensing by Mozilla Contributors is licensed +// under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/. + +// Generated from Web IDL definitions. + +@JS() +library; + +import 'dart:js_interop'; + +import 'geometry.dart'; +import 'html.dart'; + +extension type PaintRenderingContext2D._(JSObject _) implements JSObject { + external void save(); + external void restore(); + external void scale( + num x, + num y, + ); + external void rotate(num angle); + external void translate( + num x, + num y, + ); + external void transform( + num a, + num b, + num c, + num d, + num e, + num f, + ); + external DOMMatrix getTransform(); + external void setTransform([ + JSAny aOrTransform, + num b, + num c, + num d, + num e, + num f, + ]); + external void resetTransform(); + external CanvasGradient createLinearGradient( + num x0, + num y0, + num x1, + num y1, + ); + external CanvasGradient createRadialGradient( + num x0, + num y0, + num r0, + num x1, + num y1, + num r1, + ); + external CanvasPattern? createPattern( + CanvasImageSource image, + String repetition, + ); + external void clearRect( + num x, + num y, + num w, + num h, + ); + external void fillRect( + num x, + num y, + num w, + num h, + ); + external void strokeRect( + num x, + num y, + num w, + num h, + ); + external void beginPath(); + external void fill([ + JSAny fillRuleOrPath, + CanvasFillRule fillRule, + ]); + external void stroke([Path2D path]); + external void clip([ + JSAny fillRuleOrPath, + CanvasFillRule fillRule, + ]); + external bool isPointInPath( + JSAny pathOrX, + num xOrY, [ + JSAny fillRuleOrY, + CanvasFillRule fillRule, + ]); + external bool isPointInStroke( + JSAny pathOrX, + num xOrY, [ + num y, + ]); + external void drawImage( + CanvasImageSource image, + num dxOrSx, + num dyOrSy, [ + num dwOrSw, + num dhOrSh, + num dx, + num dy, + num dw, + num dh, + ]); + external void setLineDash(JSArray segments); + external JSArray getLineDash(); + external num get globalAlpha; + external set globalAlpha(num value); + external String get globalCompositeOperation; + external set globalCompositeOperation(String value); + external bool get imageSmoothingEnabled; + external set imageSmoothingEnabled(bool value); + external ImageSmoothingQuality get imageSmoothingQuality; + external set imageSmoothingQuality(ImageSmoothingQuality value); + external JSAny get strokeStyle; + external set strokeStyle(JSAny value); + external JSAny get fillStyle; + external set fillStyle(JSAny value); + external num get shadowOffsetX; + external set shadowOffsetX(num value); + external num get shadowOffsetY; + external set shadowOffsetY(num value); + external num get shadowBlur; + external set shadowBlur(num value); + external String get shadowColor; + external set shadowColor(String value); + external num get lineWidth; + external set lineWidth(num value); + external CanvasLineCap get lineCap; + external set lineCap(CanvasLineCap value); + external CanvasLineJoin get lineJoin; + external set lineJoin(CanvasLineJoin value); + external num get miterLimit; + external set miterLimit(num value); + external num get lineDashOffset; + external set lineDashOffset(num value); +} +extension type PaintSize._(JSObject _) implements JSObject { + external num get width; + external num get height; +} diff --git a/lib/src/dom/css_transitions_2.dart b/lib/src/dom/css_transitions_2.dart index 43abb4d2..b419132c 100644 --- a/lib/src/dom/css_transitions_2.dart +++ b/lib/src/dom/css_transitions_2.dart @@ -13,20 +13,8 @@ library; import 'dart:js_interop'; -import 'cssom.dart'; import 'web_animations.dart'; -/// The **`CSSStartingStyleRule`** interface of the -/// [CSS Object Model](https://developer.mozilla.org/en-US/docs/Web/API/CSS_Object_Model) -/// represents a CSS at-rule. -/// -/// --- -/// -/// API documentation sourced from -/// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/CSSStartingStyleRule). -extension type CSSStartingStyleRule._(JSObject _) - implements CSSGroupingRule, JSObject {} - /// The **`CSSTransition`** interface of the [Web Animations API] represents an /// [Animation] object used for a /// [CSS Transition](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_transitions). diff --git a/lib/src/dom/css_typed_om.dart b/lib/src/dom/css_typed_om.dart index 61e6ac20..2bba5c79 100644 --- a/lib/src/dom/css_typed_om.dart +++ b/lib/src/dom/css_typed_om.dart @@ -19,10 +19,6 @@ typedef CSSUnparsedSegment = JSAny; typedef CSSKeywordish = JSAny; typedef CSSNumberish = JSAny; typedef CSSPerspectiveValue = JSAny; -typedef CSSColorRGBComp = JSAny; -typedef CSSColorPercent = JSAny; -typedef CSSColorNumber = JSAny; -typedef CSSColorAngle = JSAny; typedef CSSNumericBaseType = String; typedef CSSMathOperator = String; @@ -342,8 +338,6 @@ extension type CSSMathValue._(JSObject _) implements CSSNumericValue, JSObject { /// API documentation sourced from /// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/CSSMathSum). extension type CSSMathSum._(JSObject _) implements CSSMathValue, JSObject { - external factory CSSMathSum(CSSNumberish args); - /// The **`CSSMathSum.values`** read-only property /// of the [CSSMathSum] interface returns a [CSSNumericArray] /// object which contains one or more [CSSNumericValue] objects. @@ -360,8 +354,6 @@ extension type CSSMathSum._(JSObject _) implements CSSMathValue, JSObject { /// API documentation sourced from /// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/CSSMathProduct). extension type CSSMathProduct._(JSObject _) implements CSSMathValue, JSObject { - external factory CSSMathProduct(CSSNumberish args); - /// The **`CSSMathProduct.values`** read-only /// property of the [CSSMathProduct] interface returns a /// [CSSNumericArray] object which contains one or more @@ -408,8 +400,6 @@ extension type CSSMathInvert._(JSObject _) implements CSSMathValue, JSObject { /// API documentation sourced from /// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/CSSMathMin). extension type CSSMathMin._(JSObject _) implements CSSMathValue, JSObject { - external factory CSSMathMin(CSSNumberish args); - /// The CSSMathMin.values read-only property of the /// [CSSMathMin] interface returns a [CSSNumericArray] object /// which contains one or more [CSSNumericValue] objects. @@ -424,8 +414,6 @@ extension type CSSMathMin._(JSObject _) implements CSSMathValue, JSObject { /// API documentation sourced from /// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/CSSMathMax). extension type CSSMathMax._(JSObject _) implements CSSMathValue, JSObject { - external factory CSSMathMax(CSSNumberish args); - /// The CSSMathMax.values read-only property of the /// [CSSMathMax] interface returns a [CSSNumericArray] object /// which contains one or more [CSSNumericValue] objects. @@ -794,139 +782,3 @@ extension type CSSMatrixComponentOptions._(JSObject _) implements JSObject { /// API documentation sourced from /// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/CSSImageValue). extension type CSSImageValue._(JSObject _) implements CSSStyleValue, JSObject {} -extension type CSSColorValue._(JSObject _) implements CSSStyleValue, JSObject { - external static JSObject parse(String cssText); -} -extension type CSSRGB._(JSObject _) implements CSSColorValue, JSObject { - external factory CSSRGB( - CSSColorRGBComp r, - CSSColorRGBComp g, - CSSColorRGBComp b, [ - CSSColorPercent alpha, - ]); - - external CSSColorRGBComp get r; - external set r(CSSColorRGBComp value); - external CSSColorRGBComp get g; - external set g(CSSColorRGBComp value); - external CSSColorRGBComp get b; - external set b(CSSColorRGBComp value); - external CSSColorPercent get alpha; - external set alpha(CSSColorPercent value); -} -extension type CSSHSL._(JSObject _) implements CSSColorValue, JSObject { - external factory CSSHSL( - CSSColorAngle h, - CSSColorPercent s, - CSSColorPercent l, [ - CSSColorPercent alpha, - ]); - - external CSSColorAngle get h; - external set h(CSSColorAngle value); - external CSSColorPercent get s; - external set s(CSSColorPercent value); - external CSSColorPercent get l; - external set l(CSSColorPercent value); - external CSSColorPercent get alpha; - external set alpha(CSSColorPercent value); -} -extension type CSSHWB._(JSObject _) implements CSSColorValue, JSObject { - external factory CSSHWB( - CSSNumericValue h, - CSSNumberish w, - CSSNumberish b, [ - CSSNumberish alpha, - ]); - - external CSSNumericValue get h; - external set h(CSSNumericValue value); - external CSSNumberish get w; - external set w(CSSNumberish value); - external CSSNumberish get b; - external set b(CSSNumberish value); - external CSSNumberish get alpha; - external set alpha(CSSNumberish value); -} -extension type CSSLab._(JSObject _) implements CSSColorValue, JSObject { - external factory CSSLab( - CSSColorPercent l, - CSSColorNumber a, - CSSColorNumber b, [ - CSSColorPercent alpha, - ]); - - external CSSColorPercent get l; - external set l(CSSColorPercent value); - external CSSColorNumber get a; - external set a(CSSColorNumber value); - external CSSColorNumber get b; - external set b(CSSColorNumber value); - external CSSColorPercent get alpha; - external set alpha(CSSColorPercent value); -} -extension type CSSLCH._(JSObject _) implements CSSColorValue, JSObject { - external factory CSSLCH( - CSSColorPercent l, - CSSColorPercent c, - CSSColorAngle h, [ - CSSColorPercent alpha, - ]); - - external CSSColorPercent get l; - external set l(CSSColorPercent value); - external CSSColorPercent get c; - external set c(CSSColorPercent value); - external CSSColorAngle get h; - external set h(CSSColorAngle value); - external CSSColorPercent get alpha; - external set alpha(CSSColorPercent value); -} -extension type CSSOKLab._(JSObject _) implements CSSColorValue, JSObject { - external factory CSSOKLab( - CSSColorPercent l, - CSSColorNumber a, - CSSColorNumber b, [ - CSSColorPercent alpha, - ]); - - external CSSColorPercent get l; - external set l(CSSColorPercent value); - external CSSColorNumber get a; - external set a(CSSColorNumber value); - external CSSColorNumber get b; - external set b(CSSColorNumber value); - external CSSColorPercent get alpha; - external set alpha(CSSColorPercent value); -} -extension type CSSOKLCH._(JSObject _) implements CSSColorValue, JSObject { - external factory CSSOKLCH( - CSSColorPercent l, - CSSColorPercent c, - CSSColorAngle h, [ - CSSColorPercent alpha, - ]); - - external CSSColorPercent get l; - external set l(CSSColorPercent value); - external CSSColorPercent get c; - external set c(CSSColorPercent value); - external CSSColorAngle get h; - external set h(CSSColorAngle value); - external CSSColorPercent get alpha; - external set alpha(CSSColorPercent value); -} -extension type CSSColor._(JSObject _) implements CSSColorValue, JSObject { - external factory CSSColor( - CSSKeywordish colorSpace, - JSArray channels, [ - CSSNumberish alpha, - ]); - - external CSSKeywordish get colorSpace; - external set colorSpace(CSSKeywordish value); - external JSArray get channels; - external set channels(JSArray value); - external CSSNumberish get alpha; - external set alpha(CSSNumberish value); -} diff --git a/lib/src/dom/css_view_transitions.dart b/lib/src/dom/css_view_transitions.dart deleted file mode 100644 index 19ffa14d..00000000 --- a/lib/src/dom/css_view_transitions.dart +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. -// -// API docs from [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web). -// Attributions and copyright licensing by Mozilla Contributors is licensed -// under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/. - -// Generated from Web IDL definitions. - -@JS() -library; - -import 'dart:js_interop'; - -typedef UpdateCallback = JSFunction; - -/// The **`ViewTransition`** interface of the [View Transitions API] represents -/// a view transition, and provides functionality to react to the transition -/// reaching different states (e.g. ready to run the animation, or animation -/// finished) or skip the transition altogether. -/// -/// This object type is returned by the [Document.startViewTransition] method. -/// When `startViewTransition()` is invoked, a sequence of steps is followed as -/// explained in -/// [The view transition process](https://developer.mozilla.org/en-US/docs/Web/API/View_Transitions_API#the_view_transition_process). -/// This also explains when the different promises fulfill. -/// -/// --- -/// -/// API documentation sourced from -/// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/ViewTransition). -extension type ViewTransition._(JSObject _) implements JSObject { - /// The **`skipTransition()`** method of the - /// [ViewTransition] interface skips the animation part of the view - /// transition, but doesn't skip running the [Document.startViewTransition] - /// callback that updates the DOM. - external void skipTransition(); - - /// The **`updateCallbackDone`** read-only property of the - /// [ViewTransition] interface is a `Promise` that fulfills when the promise - /// returned by the [Document.startViewTransition]'s callback fulfills, or - /// rejects when it rejects. - /// - /// `updateCallbackDone` is useful when you don't care about the - /// success/failure of the transition animation, and just want to know if and - /// when the DOM is updated. - external JSPromise get updateCallbackDone; - - /// The **`ready`** read-only property of the - /// [ViewTransition] interface is a `Promise` that fulfills once the - /// pseudo-element tree is created and the transition animation is about to - /// start. - /// - /// `ready` will reject if the transition cannot begin. This can be due to - /// misconfiguration, for example duplicate s, or if the callback passed to - /// [Document.startViewTransition] throws or returns a promise that rejects. - external JSPromise get ready; - - /// The **`finished`** read-only property of the - /// [ViewTransition] interface is a `Promise` that fulfills once the - /// transition animation is finished, and the new page view is visible and - /// interactive to the user. - /// - /// `finished` only rejects if the callback passed to - /// [Document.startViewTransition]throws or returns a promise that rejects, - /// which indicates that the new state of the page wasn't created. - /// - /// If a transition animation fails to start, or is skipped during the - /// animation using [ViewTransition.skipTransition], the end state is still - /// reached therefore `finished` still fulfills. - external JSPromise get finished; -} diff --git a/lib/src/dom/cssom.dart b/lib/src/dom/cssom.dart index d4c3f111..d68c3e5d 100644 --- a/lib/src/dom/cssom.dart +++ b/lib/src/dom/cssom.dart @@ -352,6 +352,7 @@ extension type CSSRule._(JSObject _) implements JSObject { external static int get SUPPORTS_RULE; external static int get COUNTER_STYLE_RULE; external static int get FONT_FEATURE_VALUES_RULE; + external static int get VIEW_TRANSITION_RULE; external static int get STYLE_RULE; external static int get CHARSET_RULE; external static int get IMPORT_RULE; @@ -535,10 +536,6 @@ extension type CSSPageRule._(JSObject _) implements CSSGroupingRule, JSObject { /// properties. external CSSStyleDeclaration get style; } -extension type CSSMarginRule._(JSObject _) implements CSSRule, JSObject { - external String get name; - external CSSStyleDeclaration get style; -} /// The **`CSSNamespaceRule`** interface describes an object representing a /// single CSS diff --git a/lib/src/dom/cssom_view.dart b/lib/src/dom/cssom_view.dart index 0ec575fb..b0284898 100644 --- a/lib/src/dom/cssom_view.dart +++ b/lib/src/dom/cssom_view.dart @@ -14,14 +14,11 @@ library; import 'dart:js_interop'; import 'dom.dart'; -import 'geometry.dart'; import 'html.dart'; import 'screen_orientation.dart'; -typedef GeometryNode = JSObject; typedef ScrollBehavior = String; typedef ScrollLogicalPosition = String; -typedef CSSBoxType = String; extension type ScrollOptions._(JSObject _) implements JSObject { external factory ScrollOptions({ScrollBehavior behavior}); @@ -194,20 +191,6 @@ extension type Screen._(JSObject _) implements JSObject { /// [Screen] interface returns the current orientation of the screen. external ScreenOrientation get orientation; } - -/// The `CaretPosition` interface represents the caret position, an indicator -/// for the text insertion point. You can get a `CaretPosition` using the -/// [Document.caretPositionFromPoint] method. -/// -/// --- -/// -/// API documentation sourced from -/// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/CaretPosition). -extension type CaretPosition._(JSObject _) implements JSObject { - external DOMRect? getClientRect(); - external Node get offsetNode; - external int get offset; -} extension type ScrollIntoViewOptions._(JSObject _) implements ScrollOptions, JSObject { external factory ScrollIntoViewOptions({ @@ -241,28 +224,6 @@ extension type CheckVisibilityOptions._(JSObject _) implements JSObject { external bool get visibilityProperty; external set visibilityProperty(bool value); } -extension type BoxQuadOptions._(JSObject _) implements JSObject { - external factory BoxQuadOptions({ - CSSBoxType box, - GeometryNode relativeTo, - }); - - external CSSBoxType get box; - external set box(CSSBoxType value); - external GeometryNode get relativeTo; - external set relativeTo(GeometryNode value); -} -extension type ConvertCoordinateOptions._(JSObject _) implements JSObject { - external factory ConvertCoordinateOptions({ - CSSBoxType fromBox, - CSSBoxType toBox, - }); - - external CSSBoxType get fromBox; - external set fromBox(CSSBoxType value); - external CSSBoxType get toBox; - external set toBox(CSSBoxType value); -} /// The **`VisualViewport`** interface of the [Visual Viewport API] represents /// the visual viewport for a given window. For a page containing iframes, each diff --git a/lib/src/dom/dom.dart b/lib/src/dom/dom.dart index 53e5f4dd..78e7c9d5 100644 --- a/lib/src/dom/dom.dart +++ b/lib/src/dom/dom.dart @@ -17,6 +17,7 @@ import 'css_font_loading.dart'; import 'css_typed_om.dart'; import 'cssom.dart'; import 'cssom_view.dart'; +import 'fullscreen.dart'; import 'geometry.dart'; import 'hr_time.dart'; import 'html.dart'; @@ -1245,8 +1246,6 @@ external Document get document; extension type Document._(JSObject _) implements Node, JSObject { external factory Document(); - external static Document parseHTMLUnsafe(String html); - /// The **`elementFromPoint()`** /// method, available on the [Document] object, returns the topmost [Element] /// at the specified coordinates @@ -1295,7 +1294,7 @@ extension type Document._(JSObject _) implements Node, JSObject { /// method of the [Document] interface returns a /// [CaretPosition] object, containing the DOM node, along with the caret and /// caret's character offset within that node. - external CaretPosition? caretPositionFromPoint( + external JSObject? caretPositionFromPoint( num x, num y, ); @@ -1461,6 +1460,14 @@ extension type Document._(JSObject _) implements Node, JSObject { NodeFilter? filter, ]); + /// The [Document] method + /// **`exitFullscreen()`** requests that the element on this + /// document which is currently being presented in fullscreen mode be taken + /// out of + /// fullscreen mode, restoring the previous state of the screen. This usually + /// reverses the effects of a previous call to [Element.requestFullscreen]. + external JSPromise exitFullscreen(); + /// The **`getElementsByName()`** method /// of the [Document] object returns a [NodeList] Collection of /// elements with a given `name` attribute in the document. @@ -1592,19 +1599,7 @@ extension type Document._(JSObject _) implements Node, JSObject { bool showUI, String value, ]); - - /// The **`Document.queryCommandEnabled()`** method reports whether - /// or not the specified editor command is enabled by the browser. - external bool queryCommandEnabled(String commandId); external bool queryCommandIndeterm(String commandId); - - /// The **`queryCommandState()`** method will tell you if the current - /// selection has a certain [Document.execCommand] command applied. - external bool queryCommandState(String commandId); - - /// The **`Document.queryCommandSupported()`** method reports - /// whether or not the specified editor command is supported by the browser. - external bool queryCommandSupported(String commandId); external String queryCommandValue(String commandId); /// The **`Document.clear()`** method does nothing, but doesn't raise any @@ -1613,28 +1608,66 @@ extension type Document._(JSObject _) implements Node, JSObject { external void captureEvents(); external void releaseEvents(); + /// The **`exitPictureInPicture()`** method of the [Document] interface + /// requests that a video contained + /// in this document, which is currently floating, be taken out of + /// picture-in-picture + /// mode, restoring the previous state of the screen. This usually reverses + /// the + /// effects of a previous call to [HTMLVideoElement.requestPictureInPicture]. + external JSPromise exitPictureInPicture(); + + /// The **`exitPointerLock()`** method of the [Document] interface + /// asynchronously releases a pointer lock previously requested through + /// [Element.requestPointerLock]. + /// + /// > **Note:** While the **`exitPointerLock()`** method is called on the + /// > document, the **`requestPointerLock()`** method is called on an element. + /// + /// To track the success or failure of the request, it is necessary to listen + /// for the [Document.pointerlockchange_event] and + /// [Document.pointerlockerror_event] events. + external void exitPointerLock(); + /// The **`getSelection()`** method of /// the [Document] interface returns a [Selection] /// object representing the range of text selected by the user, or the current /// position of /// the caret. external Selection? getSelection(); - external JSArray getBoxQuads([BoxQuadOptions options]); - external DOMQuad convertQuadFromNode( - DOMQuadInit quad, - GeometryNode from, [ - ConvertCoordinateOptions options, - ]); - external DOMQuad convertRectFromNode( - DOMRectReadOnly rect, - GeometryNode from, [ - ConvertCoordinateOptions options, - ]); - external DOMPoint convertPointFromNode( - DOMPointInit point, - GeometryNode from, [ - ConvertCoordinateOptions options, - ]); + + /// The **`hasStorageAccess()`** method of the [Document] interface returns a + /// `Promise` that resolves with a boolean value indicating whether the + /// document has access to + /// [third-party](https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies#third-party_cookies), + /// [unpartitioned](https://developer.mozilla.org/en-US/docs/Web/API/Storage_Access_API#unpartitioned_versus_partitioned_cookies) + /// cookies. + /// + /// This method is part of the + /// [Storage Access API](https://developer.mozilla.org/en-US/docs/Web/API/Storage_Access_API). + external JSPromise hasStorageAccess(); + + /// The **`requestStorageAccess()`** method of the [Document] interface allows + /// content loaded in a third-party context (i.e., embedded in an `iframe`) to + /// request access to third-party cookies. This is relevant to user agents + /// that, by default, block access to + /// [third-party](https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies#third-party_cookies), + /// [unpartitioned](https://developer.mozilla.org/en-US/docs/Web/API/Storage_Access_API#unpartitioned_versus_partitioned_cookies) + /// cookies to improve privacy (e.g., to prevent tracking), and is part of the + /// [Storage Access API](https://developer.mozilla.org/en-US/docs/Web/API/Storage_Access_API). + /// + /// To check whether permission to access third-party cookies has already been + /// granted, you can call [Permissions.query], specifying the feature name + /// `"storage-access"`. + /// + /// > **Note:** Usage of this feature may be blocked by a + /// > [Permissions Policy](https://developer.mozilla.org/en-US/docs/Web/HTTP/Permissions_Policy) + /// > set on your server. In addition, the document must pass additional + /// > browser-specific checks such as allowlists, blocklists, on-device + /// > classification, user settings, + /// > anti-[clickjacking](https://developer.mozilla.org/en-US/docs/Glossary/Clickjacking) + /// > heuristics, or prompting the user for explicit permission. + external JSPromise requestStorageAccess(); /// The **`getElementById()`** method of the [Document] interface returns an /// [Element] object representing the element whose [Element.id] property @@ -1785,8 +1818,6 @@ extension type Document._(JSObject _) implements Node, JSObject { /// > are legacy aliases for `document.characterSet`. Do not use them any /// > more. external String get characterSet; - external String get charset; - external String get inputEncoding; /// The **`Document.contentType`** read-only property returns the /// MIME type that the document is being rendered as. This may come from HTTP @@ -1813,6 +1844,38 @@ extension type Document._(JSObject _) implements Node, JSObject { /// example, the `html` element for HTML documents). external Element? get documentElement; + /// The read-only **`fullscreenEnabled`** + /// property on the [Document] interface indicates whether or not fullscreen + /// mode is available. + /// + /// fullscreen mode is available only for a page that has no + /// windowed plug-ins in any of its documents, and if all `iframe` elements + /// which contain the document have their + /// [`allowfullscreen`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe#allowfullscreen) + /// attribute set. + /// + /// Although this property is read-only, it will not throw if it is modified + /// (even in + /// strict mode); the setter is a no-operation and it will be ignored. + external bool get fullscreenEnabled; + + /// The obsolete [Document] interface's **`fullscreen`** read-only property + /// reports whether or not the document is currently displaying content in + /// fullscreen mode. + /// + /// Although this property is read-only, it will not throw if it is modified + /// (even in strict mode); the setter is a no-operation and it will be + /// ignored. + /// + /// > **Note:** Since this property is deprecated, you can determine if + /// > fullscreen mode is active on the document by checking to see if + /// > [Document.fullscreenElement] is not `null`. + external bool get fullscreen; + external EventHandler get onfullscreenchange; + external set onfullscreenchange(EventHandler value); + external EventHandler get onfullscreenerror; + external set onfullscreenerror(EventHandler value); + /// The **`Document.location`** read-only property returns a /// [Location] object, which contains information about the URL of the /// document @@ -2047,6 +2110,24 @@ extension type Document._(JSObject _) implements Node, JSObject { /// ``` external HTMLAllCollection get all; + /// The read-only + /// **`pictureInPictureEnabled`** property of the + /// [Document] interface indicates whether or not picture-in-picture mode is + /// available. + /// + /// Picture-in-Picture mode is available by default unless specified + /// otherwise by a + /// [Permissions-Policy](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Permissions-Policy/picture-in-picture). + /// + /// Although this property is read-only, it will not throw if it is modified + /// (even in + /// strict mode); the setter is a no-operation and will be ignored. + external bool get pictureInPictureEnabled; + external EventHandler get onpointerlockchange; + external set onpointerlockchange(EventHandler value); + external EventHandler get onpointerlockerror; + external set onpointerlockerror(EventHandler value); + /// The `timeline` readonly property of the [Document] interface represents /// the default timeline of the current document. This timeline is a special /// instance of [DocumentTimeline]. @@ -2105,6 +2186,17 @@ extension type Document._(JSObject _) implements Node, JSObject { external JSArray get adoptedStyleSheets; external set adoptedStyleSheets(JSArray value); + /// The + /// **`Document.fullscreenElement`** read-only + /// property returns the [Element] that is currently being presented in + /// fullscreen mode in this document, or `null` if fullscreen mode is not + /// currently in use. + /// + /// Although this property is read-only, it will not throw if it is modified + /// (even in + /// strict mode); the setter is a no-operation and it will be ignored. + external Element? get fullscreenElement; + /// The **`activeElement`** read-only property /// of the [Document] interface returns the [Element] within the DOM that /// currently has focus. @@ -2132,6 +2224,23 @@ extension type Document._(JSObject _) implements Node, JSObject { /// > get the current selection using [window.getSelection]. external Element? get activeElement; + /// The read-only **`pictureInPictureElement`** property of the [Document] + /// interface returns the [Element] that is currently being + /// presented in picture-in-picture mode in this document, or `null` if + /// picture-in-picture mode is not currently in use. + /// + /// Although this property is read-only, it will not throw if it is modified + /// (even in + /// strict mode); the setter is a no-operation and will be ignored. + external Element? get pictureInPictureElement; + + /// The **`pointerLockElement`** read-only property of the [Document] + /// interface provides the element set as the target for mouse events while + /// the pointer is locked. + /// It is `null` if lock is pending, pointer is unlocked, or the target is in + /// another document. + external Element? get pointerLockElement; + /// The read-only **`children`** property returns a live [HTMLCollection] /// which contains all of the child [Element] of the document upon which it /// was called. @@ -2192,8 +2301,6 @@ extension type Document._(JSObject _) implements Node, JSObject { external set onauxclick(EventHandler value); external EventHandler get onbeforeinput; external set onbeforeinput(EventHandler value); - external EventHandler get onbeforematch; - external set onbeforematch(EventHandler value); external EventHandler get onbeforetoggle; external set onbeforetoggle(EventHandler value); external EventHandler get onblur; @@ -2326,14 +2433,6 @@ extension type Document._(JSObject _) implements Node, JSObject { external set onvolumechange(EventHandler value); external EventHandler get onwaiting; external set onwaiting(EventHandler value); - external EventHandler get onwebkitanimationend; - external set onwebkitanimationend(EventHandler value); - external EventHandler get onwebkitanimationiteration; - external set onwebkitanimationiteration(EventHandler value); - external EventHandler get onwebkitanimationstart; - external set onwebkitanimationstart(EventHandler value); - external EventHandler get onwebkittransitionend; - external set onwebkittransitionend(EventHandler value); external EventHandler get onwheel; external set onwheel(EventHandler value); external EventHandler get onpointerover; @@ -2344,8 +2443,6 @@ extension type Document._(JSObject _) implements Node, JSObject { external set onpointerdown(EventHandler value); external EventHandler get onpointermove; external set onpointermove(EventHandler value); - external EventHandler get onpointerrawupdate; - external set onpointerrawupdate(EventHandler value); external EventHandler get onpointerup; external set onpointerup(EventHandler value); external EventHandler get onpointercancel; @@ -2608,8 +2705,6 @@ extension type DocumentFragment._(JSObject _) implements Node, JSObject { /// API documentation sourced from /// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/ShadowRoot). extension type ShadowRoot._(JSObject _) implements DocumentFragment, JSObject { - external void setHTMLUnsafe(String html); - /// The **`getAnimations()`** method of the [ShadowRoot] interface /// returns an array of all [Animation] objects currently in effect whose /// target elements are descendants of the shadow tree. This array includes @@ -2714,10 +2809,28 @@ extension type ShadowRoot._(JSObject _) implements DocumentFragment, JSObject { external JSArray get adoptedStyleSheets; external set adoptedStyleSheets(JSArray value); + /// The **`fullscreenElement`** read-only property of the + /// [ShadowRoot] interface returns the element within the shadow tree that is + /// currently displayed in full screen. + external Element? get fullscreenElement; + /// The **`activeElement`** read-only property of the /// [ShadowRoot] interface returns the element within the shadow tree that has /// focus. external Element? get activeElement; + + /// The **`pictureInPictureElement`** read-only property of the + /// [ShadowRoot] interface returns the [Element] that is currently being + /// presented in picture-in-picture mode in this shadow tree, or `null` if + /// picture-in-picture mode is not currently in use. + external Element? get pictureInPictureElement; + + /// The **`pointerLockElement`** read-only property of the [ShadowRoot] + /// interface provides the element set as the target for mouse events while + /// the pointer is locked. + /// It is `null` if lock is pending, pointer is unlocked, or the target is in + /// another tree. + external Element? get pointerLockElement; } /// **`Element`** is the most general base class from which all element objects @@ -3013,7 +3126,6 @@ extension type Element._(JSObject _) implements Node, JSObject { /// element would be selected by the specified /// [CSS selector](https://developer.mozilla.org/en-US/docs/Learn/CSS/Building_blocks/Selectors). external bool matches(String selectors); - external bool webkitMatchesSelector(String selectors); /// The /// **`Element.getElementsByTagName()`** method returns a live @@ -3076,7 +3188,24 @@ extension type Element._(JSObject _) implements Node, JSObject { String where, String data, ); - external void setHTMLUnsafe(String html); + + /// The **`Element.requestFullscreen()`** + /// method issues an asynchronous request to make the element be displayed in + /// fullscreen + /// mode. + /// + /// It's not guaranteed that the element will be put into full screen mode. If + /// permission + /// to enter full screen mode is granted, the returned `Promise` will resolve + /// and the element will receive a [Element.fullscreenchange_event] event to + /// let it know that + /// it's now in full screen mode. If permission is denied, the promise is + /// rejected and the + /// element receives a [Element.fullscreenerror_event] event instead. If the + /// element has been + /// detached from the original document, then the document receives these + /// events instead. + external JSPromise requestFullscreen([FullscreenOptions options]); /// The **`setPointerCapture()`** method of the /// [Element] interface is used to designate a specific element as the @@ -3123,22 +3252,25 @@ extension type Element._(JSObject _) implements Node, JSObject { /// [Element] interface checks whether the element on which it is invoked has /// pointer capture for the pointer identified by the given pointer ID. external bool hasPointerCapture(int pointerId); - external JSArray getBoxQuads([BoxQuadOptions options]); - external DOMQuad convertQuadFromNode( - DOMQuadInit quad, - GeometryNode from, [ - ConvertCoordinateOptions options, - ]); - external DOMQuad convertRectFromNode( - DOMRectReadOnly rect, - GeometryNode from, [ - ConvertCoordinateOptions options, - ]); - external DOMPoint convertPointFromNode( - DOMPointInit point, - GeometryNode from, [ - ConvertCoordinateOptions options, - ]); + + /// The **`requestPointerLock()`** method of the [Element] interface lets you + /// asynchronously ask for the pointer to be locked on the given element. + /// + /// To track the success or failure of the request, it is necessary to listen + /// for the [Document.pointerlockchange_event] and + /// [Document.pointerlockerror_event] events at the [Document] level. + /// + /// > **Note:** In the current specification, `requestPointerLock()` only + /// > communicates the success or failure of the request by firing + /// > [Document.pointerlockchange_event] or [Document.pointerlockerror_event] + /// > events. + /// > [A proposed update to the specification](https://github.com/w3c/pointerlock/pull/49) + /// > updates `requestPointerLock()` to return a `Promise` which communicates + /// > success or failure. This page documents the version that returns a + /// > `Promise`. However, note that this version is not yet a standard and is + /// > not implemented by all browsers. See + /// > [Browser compatibility](#browser_compatibility) for more information. + external void requestPointerLock(); /// The **`Element.prepend()`** method inserts a set of /// [Node] objects or string objects before the first child @@ -3241,6 +3373,13 @@ extension type Element._(JSObject _) implements Node, JSObject { external String get outerHTML; external set outerHTML(String value); + /// The **`part`** property of the [Element] interface + /// represents the part identifier(s) of the element (i.e. set using the + /// `part` + /// attribute), returned as a [DOMTokenList]. These can be used to style parts + /// of a shadow DOM, via the pseudo-element. + external DOMTokenList get part; + /// The **`Element.scrollTop`** property gets or sets the number of pixels /// that an element's content is scrolled vertically. /// @@ -3500,6 +3639,10 @@ extension type Element._(JSObject _) implements Node, JSObject { /// /// Use [Element.attachShadow] to add a shadow root to an existing element. external ShadowRoot? get shadowRoot; + external EventHandler get onfullscreenchange; + external set onfullscreenchange(EventHandler value); + external EventHandler get onfullscreenerror; + external set onfullscreenerror(EventHandler value); /// The [Element] property /// **`innerHTML`** gets or sets the HTML or XML markup contained @@ -3561,6 +3704,337 @@ extension type Element._(JSObject _) implements Node, JSObject { /// [HTMLSlotElement] representing the `slot` element the /// node is inserted in. external HTMLSlotElement? get assignedSlot; + external String? get role; + external set role(String? value); + + /// The **`ariaAtomic`** property of the [Element] interface reflects the + /// value of the + /// [`aria-atomic`](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-atomic) + /// attribute, which indicates whether assistive technologies will present + /// all, or only parts of, the changed region based on the change + /// notifications defined by the + /// [`aria-relevant`](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-relevant) + /// attribute. + external String? get ariaAtomic; + external set ariaAtomic(String? value); + + /// The **`ariaAutoComplete`** property of the [Element] interface reflects + /// the value of the + /// [`aria-autocomplete`](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-autocomplete) + /// attribute, which indicates whether inputting text could trigger display of + /// one or more predictions of the user's intended value for a combobox, + /// searchbox, or textbox and specifies how predictions would be presented if + /// they were made. + external String? get ariaAutoComplete; + external set ariaAutoComplete(String? value); + + /// The **`ariaBusy`** property of the [Element] interface reflects the value + /// of the + /// [`aria-busy`](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-busy) + /// attribute, which indicates whether an element is being modified, as + /// assistive technologies may want to wait until the modifications are + /// complete before exposing them to the user. + external String? get ariaBusy; + external set ariaBusy(String? value); + + /// The **`ariaChecked`** property of the [Element] interface reflects the + /// value of the + /// [`aria-checked`](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-checked) + /// attribute, which indicates the current "checked" state of checkboxes, + /// radio buttons, and other widgets that have a checked state. + /// + /// > **Note:** Where possible use an HTML `input` element with + /// > `type="checkbox"` as this element has built in semantics and does not + /// > require ARIA attributes. + external String? get ariaChecked; + external set ariaChecked(String? value); + + /// The **`ariaColCount`** property of the [Element] interface reflects the + /// value of the + /// [`aria-colcount`](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-colcount) + /// attribute, which defines the number of columns in a table, grid, or + /// treegrid. + external String? get ariaColCount; + external set ariaColCount(String? value); + + /// The **`ariaColIndex`** property of the [Element] interface reflects the + /// value of the + /// [`aria-colindex`](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-colindex) + /// attribute, which defines an element's column index or position with + /// respect to the total number of columns within a table, grid, or treegrid. + external String? get ariaColIndex; + external set ariaColIndex(String? value); + + /// The **`ariaColSpan`** property of the [Element] interface reflects the + /// value of the + /// [`aria-colspan`](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-colspan) + /// attribute, which defines the number of columns spanned by a cell or + /// gridcell within a table, grid, or treegrid. + external String? get ariaColSpan; + external set ariaColSpan(String? value); + + /// The **`ariaCurrent`** property of the [Element] interface reflects the + /// value of the + /// [`aria-current`](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-current) + /// attribute, which indicates the element that represents the current item + /// within a container or set of related elements. + external String? get ariaCurrent; + external set ariaCurrent(String? value); + + /// The **`ariaDescription`** property of the [Element] interface reflects the + /// value of the + /// [`aria-description`](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-description) + /// attribute, which defines a string value that describes or annotates the + /// current element. + external String? get ariaDescription; + external set ariaDescription(String? value); + + /// The **`ariaDisabled`** property of the [Element] interface reflects the + /// value of the + /// [`aria-disabled`](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-disabled) + /// attribute, which indicates that the element is perceivable but disabled, + /// so it is not editable or otherwise operable. + /// + /// > **Note:** Where possible, use the `input` element with `type="button"` + /// > or the `button` element — because those elements have built in semantics + /// > and do not require ARIA attributes. + external String? get ariaDisabled; + external set ariaDisabled(String? value); + + /// The **`ariaExpanded`** property of the [Element] interface reflects the + /// value of the + /// [`aria-expanded`](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-expanded) + /// attribute, which indicates whether a grouping element owned or controlled + /// by this element is expanded or collapsed. + external String? get ariaExpanded; + external set ariaExpanded(String? value); + + /// The **`ariaHasPopup`** property of the [Element] interface reflects the + /// value of the + /// [`aria-haspopup`](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-haspopup) + /// attribute, which indicates the availability and type of interactive popup + /// element, such as menu or dialog, that can be triggered by an element. + external String? get ariaHasPopup; + external set ariaHasPopup(String? value); + + /// The **`ariaHidden`** property of the [Element] interface reflects the + /// value of the + /// [`aria-hidden`](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-hidden)) + /// attribute, which indicates whether the element is exposed to an + /// accessibility API. + external String? get ariaHidden; + external set ariaHidden(String? value); + external String? get ariaInvalid; + external set ariaInvalid(String? value); + + /// The **`ariaKeyShortcuts`** property of the [Element] interface reflects + /// the value of the `aria-keyshortcuts` attribute, which indicates keyboard + /// shortcuts that an author has implemented to activate or give focus to an + /// element. + external String? get ariaKeyShortcuts; + external set ariaKeyShortcuts(String? value); + + /// The **`ariaLabel`** property of the [Element] interface reflects the value + /// of the + /// [`aria-label`](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-label) + /// attribute, which defines a string value that labels the current element. + external String? get ariaLabel; + external set ariaLabel(String? value); + + /// The **`ariaLevel`** property of the [Element] interface reflects the value + /// of the `aria-level` attribute, which defines the hierarchical level of an + /// element within a structure. + /// + /// > **Note:** Where possible use an HTML `h1` or other correct heading level + /// > as these have built in semantics and do not require ARIA attributes. + external String? get ariaLevel; + external set ariaLevel(String? value); + + /// The **`ariaLive`** property of the [Element] interface reflects the value + /// of the + /// [`aria-live`](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-live) + /// attribute, which indicates that an element will be updated, and describes + /// the types of updates the user agents, assistive technologies, and user can + /// expect from the + /// [live region](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Live_Regions). + external String? get ariaLive; + external set ariaLive(String? value); + + /// The **`ariaModal`** property of the [Element] interface reflects the value + /// of the `aria-modal` attribute, which indicates whether an element is modal + /// when displayed. Applying the `aria-modal` property to an element with + /// `role="dialog"` replaces the technique of using aria-hidden on the + /// background for informing assistive technologies that content outside a + /// dialog is inert. + external String? get ariaModal; + external set ariaModal(String? value); + + /// The **`ariaMultiLine`** property of the [Element] interface reflects the + /// value of the + /// [`aria-multiline`](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-multiline) + /// attribute, which indicates whether a text box accepts multiple lines of + /// input or only a single line. + /// + /// > **Note:** Where possible use an HTML `input` element with `type="text"` + /// > or a `textarea` as these have built in semantics and do not require ARIA + /// > attributes. + external String? get ariaMultiLine; + external set ariaMultiLine(String? value); + + /// The **`ariaMultiSelectable`** property of the [Element] interface reflects + /// the value of the + /// [`aria-multiselectable`](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-multiselectable) + /// attribute, which indicates that the user may select more than one item + /// from the current selectable descendants. + /// + /// > **Note:** Where possible use an HTML `select` element as this has built + /// > in semantics and does not require ARIA attributes. + external String? get ariaMultiSelectable; + external set ariaMultiSelectable(String? value); + + /// The **`ariaOrientation`** property of the [Element] interface reflects the + /// value of the + /// [`aria-orientation`](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-orientation) + /// attribute, which indicates whether the element's orientation is + /// horizontal, vertical, or unknown/ambiguous. + external String? get ariaOrientation; + external set ariaOrientation(String? value); + + /// The **`ariaPlaceholder`** property of the [Element] interface reflects the + /// value of the `aria-placeholder` attribute, which defines a short hint + /// intended to aid the user with data entry when the control has no value. + /// + /// > **Note:** Where possible use an HTML `input` element with `type="text"` + /// > or a `textarea` as these have built in semantics and do not require ARIA + /// > attributes. + external String? get ariaPlaceholder; + external set ariaPlaceholder(String? value); + + /// The **`ariaPosInSet`** property of the [Element] interface reflects the + /// value of the + /// [`aria-posinset`](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-posinset) + /// attribute, which defines an element's number or position in the current + /// set of listitems or treeitems. + external String? get ariaPosInSet; + external set ariaPosInSet(String? value); + + /// The **`ariaPressed`** property of the [Element] interface reflects the + /// value of the + /// [`aria-pressed`](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-pressed) + /// attribute, which indicates the current "pressed" state of toggle buttons. + /// + /// > **Note:** Where possible use an HTML `input` element with + /// > `type="button"` or the `button` element as these have built in semantics + /// > and do not require ARIA attributes. + external String? get ariaPressed; + external set ariaPressed(String? value); + + /// The **`ariaReadOnly`** property of the [Element] interface reflects the + /// value of the + /// [`aria-readonly`](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-readonly) + /// attribute, which indicates that the element is not editable, but is + /// otherwise operable. + /// + /// > **Note:** Where possible use an HTML `input` element with `type="text"` + /// > or a `textarea` as these have built in semantics and do not require ARIA + /// > attributes. + external String? get ariaReadOnly; + external set ariaReadOnly(String? value); + + /// The **`ariaRequired`** property of the [Element] interface reflects the + /// value of the `aria-required` attribute, which indicates that user input is + /// required on the element before a form may be submitted. + /// + /// > **Note:** Where possible use an HTML `input` element with `type="text"` + /// > or a `textarea` as these have built in semantics and do not require ARIA + /// > attributes. + external String? get ariaRequired; + external set ariaRequired(String? value); + + /// The **`ariaRoleDescription`** property of the [Element] interface reflects + /// the value of the + /// [`aria-roledescription`](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-roledescription) + /// attribute, which defines a human-readable, author-localized description + /// for the role of an element. + external String? get ariaRoleDescription; + external set ariaRoleDescription(String? value); + + /// The **`ariaRowCount`** property of the [Element] interface reflects the + /// value of the + /// [`aria-rowcount`](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-rowcount) + /// attribute, which defines the total number of rows in a table, grid, or + /// treegrid. + external String? get ariaRowCount; + external set ariaRowCount(String? value); + + /// The **`ariaRowIndex`** property of the [Element] interface reflects the + /// value of the + /// [`aria-rowindex`](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-rowindex) + /// attribute, which defines an element's row index or position with respect + /// to the total number of rows within a table, grid, or treegrid. + external String? get ariaRowIndex; + external set ariaRowIndex(String? value); + + /// The **`ariaRowSpan`** property of the [Element] interface reflects the + /// value of the + /// [`aria-rowspan`](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-rowspan) + /// attribute, which defines the number of rows spanned by a cell or gridcell + /// within a table, grid, or treegrid. + external String? get ariaRowSpan; + external set ariaRowSpan(String? value); + + /// The **`ariaSelected`** property of the [Element] interface reflects the + /// value of the + /// [`aria-selected`](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-selected) + /// attribute, which indicates the current "selected" state of elements that + /// have a selected state. + external String? get ariaSelected; + external set ariaSelected(String? value); + + /// The **`ariaSetSize`** property of the [Element] interface reflects the + /// value of the + /// [`aria-setsize`](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-setsize) + /// attribute, which defines the number of items in the current set of + /// listitems or treeitems. + external String? get ariaSetSize; + external set ariaSetSize(String? value); + + /// The **`ariaSort`** property of the [Element] interface reflects the value + /// of the + /// [`aria-sort`](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-sort) + /// attribute, which indicates if items in a table or grid are sorted in + /// ascending or descending order. + external String? get ariaSort; + external set ariaSort(String? value); + + /// The **`ariaValueMax`** property of the [Element] interface reflects the + /// value of the + /// [`aria-valuemax`](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-valuemax) + /// attribute, which defines the maximum allowed value for a range widget. + external String? get ariaValueMax; + external set ariaValueMax(String? value); + + /// The **`ariaValueMin`** property of the [Element] interface reflects the + /// value of the + /// [`aria-valuemin`](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-valuemin) + /// attribute, which defines the minimum allowed value for a range widget. + external String? get ariaValueMin; + external set ariaValueMin(String? value); + + /// The **`ariaValueNow`** property of the [Element] interface reflects the + /// value of the + /// [`aria-valuenow`](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-valuenow) + /// attribute, which defines the current value for a range widget. + external String? get ariaValueNow; + external set ariaValueNow(String? value); + + /// The **`ariaValueText`** property of the [Element] interface reflects the + /// value of the + /// [`aria-valuetext`](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-valuetext) + /// attribute, which defines the human-readable text alternative of + /// aria-valuenow for a range widget. + external String? get ariaValueText; + external set ariaValueText(String? value); } extension type ShadowRootInit._(JSObject _) implements JSObject { external factory ShadowRootInit({ @@ -3921,22 +4395,6 @@ extension type Text._(JSObject _) implements CharacterData, JSObject { /// Separated text nodes can be concatenated using the [Node.normalize] /// method. external Text splitText(int offset); - external JSArray getBoxQuads([BoxQuadOptions options]); - external DOMQuad convertQuadFromNode( - DOMQuadInit quad, - GeometryNode from, [ - ConvertCoordinateOptions options, - ]); - external DOMQuad convertRectFromNode( - DOMRectReadOnly rect, - GeometryNode from, [ - ConvertCoordinateOptions options, - ]); - external DOMPoint convertPointFromNode( - DOMPointInit point, - GeometryNode from, [ - ConvertCoordinateOptions options, - ]); /// The read-only **`wholeText`** property of the [Text] interface /// returns the full text of all [Text] nodes logically adjacent to the node. diff --git a/lib/src/dom/encrypted_media.dart b/lib/src/dom/encrypted_media.dart index a8f68cde..00946645 100644 --- a/lib/src/dom/encrypted_media.dart +++ b/lib/src/dom/encrypted_media.dart @@ -19,7 +19,6 @@ import 'webidl.dart'; typedef MediaKeysRequirement = String; typedef MediaKeySessionType = String; -typedef HDCPVersion = String; typedef MediaKeySessionClosedReason = String; typedef MediaKeyStatus = String; typedef MediaKeyMessageType = String; @@ -114,19 +113,12 @@ extension type MediaKeys._(JSObject _) implements JSObject { /// [MediaKeySession] object, which represents a context for message exchange /// with a content decryption module (CDM). external MediaKeySession createSession([MediaKeySessionType sessionType]); - external JSPromise getStatusForPolicy([MediaKeysPolicy policy]); /// The **`MediaKeys.setServerCertificate()`** method provides a /// server certificate to be used to encrypt messages to the license server. external JSPromise setServerCertificate( BufferSource serverCertificate); } -extension type MediaKeysPolicy._(JSObject _) implements JSObject { - external factory MediaKeysPolicy({HDCPVersion minHdcpVersion}); - - external HDCPVersion get minHdcpVersion; - external set minHdcpVersion(HDCPVersion value); -} /// The **`MediaKeySession`** interface of the /// [Encrypted Media Extensions API](https://developer.mozilla.org/en-US/docs/Web/API/Encrypted_Media_Extensions_API) diff --git a/lib/src/dom/event_timing.dart b/lib/src/dom/event_timing.dart new file mode 100644 index 00000000..23904fdc --- /dev/null +++ b/lib/src/dom/event_timing.dart @@ -0,0 +1,71 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. +// +// API docs from [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web). +// Attributions and copyright licensing by Mozilla Contributors is licensed +// under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/. + +// Generated from Web IDL definitions. + +@JS() +library; + +import 'dart:js_interop'; + +import 'dom.dart'; +import 'hr_time.dart'; +import 'performance_timeline.dart'; + +/// The `PerformanceEventTiming` interface of the Event Timing API provides +/// insights into the latency of certain event types triggered by user +/// interaction. +/// +/// --- +/// +/// API documentation sourced from +/// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/PerformanceEventTiming). +extension type PerformanceEventTiming._(JSObject _) + implements PerformanceEntry, JSObject { + /// The **`toJSON()`** method of the [PerformanceEventTiming] interface is a ; + /// it returns a JSON representation of the [PerformanceEventTiming] object. + external JSObject toJSON(); + + /// The read-only **`processingStart`** property returns the time at which + /// event dispatch started. This is when event handlers are about to be + /// executed. + external DOMHighResTimeStamp get processingStart; + + /// The read-only **`processingEnd`** property returns the time the last event + /// handler finished executing. + /// + /// It's equal to [PerformanceEventTiming.processingStart] when there are no + /// such event handlers. + external DOMHighResTimeStamp get processingEnd; + + /// The read-only **`cancelable`** property returns the associated event's + /// [`cancelable`](https://developer.mozilla.org/en-US/docs/Web/API/Event/cancelable) + /// property, indicating whether the event can be canceled. + external bool get cancelable; + + /// The read-only **`target`** property returns the associated event's last + /// [`target`](https://developer.mozilla.org/en-US/docs/Web/API/Event/target) + /// which is the node onto which the event was last dispatched. + external Node? get target; +} + +/// The **`EventCounts`** interface of the +/// [Performance API](https://developer.mozilla.org/en-US/docs/Web/API/Performance_API) +/// provides the number of events that have been dispatched for each event type. +/// +/// An `EventCounts` instance is a read-only +/// [`Map`-like object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map#map-like_browser_apis), +/// in which each key is the name string for an event type, and the +/// corresponding value is an integer indicating the number of events that have +/// been dispatched for that event type. +/// +/// --- +/// +/// API documentation sourced from +/// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/EventCounts). +extension type EventCounts._(JSObject _) implements JSObject {} diff --git a/lib/src/dom/ext_disjoint_timer_query.dart b/lib/src/dom/ext_disjoint_timer_query.dart new file mode 100644 index 00000000..45f848b2 --- /dev/null +++ b/lib/src/dom/ext_disjoint_timer_query.dart @@ -0,0 +1,47 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. +// +// API docs from [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web). +// Attributions and copyright licensing by Mozilla Contributors is licensed +// under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/. + +// Generated from Web IDL definitions. + +@JS() +library; + +import 'dart:js_interop'; + +import 'webgl1.dart'; + +extension type WebGLTimerQueryEXT._(JSObject _) implements JSObject {} +extension type EXT_disjoint_timer_query._(JSObject _) implements JSObject { + external static GLenum get QUERY_COUNTER_BITS_EXT; + external static GLenum get CURRENT_QUERY_EXT; + external static GLenum get QUERY_RESULT_EXT; + external static GLenum get QUERY_RESULT_AVAILABLE_EXT; + external static GLenum get TIME_ELAPSED_EXT; + external static GLenum get TIMESTAMP_EXT; + external static GLenum get GPU_DISJOINT_EXT; + external WebGLTimerQueryEXT? createQueryEXT(); + external void deleteQueryEXT(WebGLTimerQueryEXT? query); + external bool isQueryEXT(WebGLTimerQueryEXT? query); + external void beginQueryEXT( + GLenum target, + WebGLTimerQueryEXT query, + ); + external void endQueryEXT(GLenum target); + external void queryCounterEXT( + WebGLTimerQueryEXT query, + GLenum target, + ); + external JSAny? getQueryEXT( + GLenum target, + GLenum pname, + ); + external JSAny? getQueryObjectEXT( + WebGLTimerQueryEXT query, + GLenum pname, + ); +} diff --git a/lib/src/dom/ext_disjoint_timer_query_webgl2.dart b/lib/src/dom/ext_disjoint_timer_query_webgl2.dart new file mode 100644 index 00000000..2b1439c8 --- /dev/null +++ b/lib/src/dom/ext_disjoint_timer_query_webgl2.dart @@ -0,0 +1,29 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. +// +// API docs from [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web). +// Attributions and copyright licensing by Mozilla Contributors is licensed +// under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/. + +// Generated from Web IDL definitions. + +@JS() +library; + +import 'dart:js_interop'; + +import 'webgl1.dart'; +import 'webgl2.dart'; + +extension type EXT_disjoint_timer_query_webgl2._(JSObject _) + implements JSObject { + external static GLenum get QUERY_COUNTER_BITS_EXT; + external static GLenum get TIME_ELAPSED_EXT; + external static GLenum get TIMESTAMP_EXT; + external static GLenum get GPU_DISJOINT_EXT; + external void queryCounterEXT( + WebGLQuery query, + GLenum target, + ); +} diff --git a/lib/src/dom/ext_texture_norm16.dart b/lib/src/dom/ext_texture_norm16.dart new file mode 100644 index 00000000..97d0fd4c --- /dev/null +++ b/lib/src/dom/ext_texture_norm16.dart @@ -0,0 +1,27 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. +// +// API docs from [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web). +// Attributions and copyright licensing by Mozilla Contributors is licensed +// under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/. + +// Generated from Web IDL definitions. + +@JS() +library; + +import 'dart:js_interop'; + +import 'webgl1.dart'; + +extension type EXT_texture_norm16._(JSObject _) implements JSObject { + external static GLenum get R16_EXT; + external static GLenum get RG16_EXT; + external static GLenum get RGB16_EXT; + external static GLenum get RGBA16_EXT; + external static GLenum get R16_SNORM_EXT; + external static GLenum get RG16_SNORM_EXT; + external static GLenum get RGB16_SNORM_EXT; + external static GLenum get RGBA16_SNORM_EXT; +} diff --git a/lib/src/dom/fedcm.dart b/lib/src/dom/fedcm.dart new file mode 100644 index 00000000..c160e631 --- /dev/null +++ b/lib/src/dom/fedcm.dart @@ -0,0 +1,56 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. +// +// API docs from [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web). +// Attributions and copyright licensing by Mozilla Contributors is licensed +// under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/. + +// Generated from Web IDL definitions. + +@JS() +library; + +import 'dart:js_interop'; + +typedef IdentityCredentialRequestOptionsContext = String; +extension type IdentityCredentialRequestOptions._(JSObject _) + implements JSObject { + external factory IdentityCredentialRequestOptions({ + required JSArray providers, + IdentityCredentialRequestOptionsContext context, + }); + + external JSArray get providers; + external set providers(JSArray value); + external IdentityCredentialRequestOptionsContext get context; + external set context(IdentityCredentialRequestOptionsContext value); +} +extension type IdentityProviderConfig._(JSObject _) implements JSObject { + external factory IdentityProviderConfig({ + required String configURL, + required String clientId, + }); + + external String get configURL; + external set configURL(String value); + external String get clientId; + external set clientId(String value); +} +extension type IdentityProviderRequestOptions._(JSObject _) + implements IdentityProviderConfig, JSObject { + external factory IdentityProviderRequestOptions({ + required String configURL, + required String clientId, + String nonce, + String loginHint, + String domainHint, + }); + + external String get nonce; + external set nonce(String value); + external String get loginHint; + external set loginHint(String value); + external String get domainHint; + external set domainHint(String value); +} diff --git a/lib/src/dom/fetch.dart b/lib/src/dom/fetch.dart index 3d1a4298..9097ffd6 100644 --- a/lib/src/dom/fetch.dart +++ b/lib/src/dom/fetch.dart @@ -13,10 +13,13 @@ library; import 'dart:js_interop'; +import 'attribution_reporting_api.dart'; import 'dom.dart'; import 'fileapi.dart'; +import 'private_network_access.dart'; import 'referrer_policy.dart'; import 'streams.dart'; +import 'trust_token_api.dart'; import 'xhr.dart'; typedef HeadersInit = JSObject; @@ -312,13 +315,11 @@ extension type Request._(JSObject _) implements JSObject { /// value of the request. external String get integrity; external bool get keepalive; - external bool get isReloadNavigation; external bool get isHistoryNavigation; /// The read-only **`signal`** property of the [Request] interface returns the /// [AbortSignal] associated with the request. external AbortSignal get signal; - external RequestDuplex get duplex; /// The read-only **`body`** property of the [Request] /// interface contains a [ReadableStream] with the body contents @@ -349,6 +350,11 @@ extension type RequestInit._(JSObject _) implements JSObject { RequestDuplex duplex, RequestPriority priority, JSAny? window, + AttributionReportingRequestOptions attributionReporting, + IPAddressSpace targetAddressSpace, + bool sharedStorageWritable, + PrivateToken privateToken, + bool adAuctionHeaders, }); external String get method; @@ -381,6 +387,16 @@ extension type RequestInit._(JSObject _) implements JSObject { external set priority(RequestPriority value); external JSAny? get window; external set window(JSAny? value); + external AttributionReportingRequestOptions get attributionReporting; + external set attributionReporting(AttributionReportingRequestOptions value); + external IPAddressSpace get targetAddressSpace; + external set targetAddressSpace(IPAddressSpace value); + external bool get sharedStorageWritable; + external set sharedStorageWritable(bool value); + external PrivateToken get privateToken; + external set privateToken(PrivateToken value); + external bool get adAuctionHeaders; + external set adAuctionHeaders(bool value); } /// The **`Response`** interface of the diff --git a/lib/src/dom/fido.dart b/lib/src/dom/fido.dart new file mode 100644 index 00000000..95726bf8 --- /dev/null +++ b/lib/src/dom/fido.dart @@ -0,0 +1,37 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. +// +// API docs from [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web). +// Attributions and copyright licensing by Mozilla Contributors is licensed +// under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/. + +// Generated from Web IDL definitions. + +@JS() +library; + +import 'dart:js_interop'; + +extension type HMACGetSecretInput._(JSObject _) implements JSObject { + external factory HMACGetSecretInput({ + required JSArrayBuffer salt1, + JSArrayBuffer salt2, + }); + + external JSArrayBuffer get salt1; + external set salt1(JSArrayBuffer value); + external JSArrayBuffer get salt2; + external set salt2(JSArrayBuffer value); +} +extension type HMACGetSecretOutput._(JSObject _) implements JSObject { + external factory HMACGetSecretOutput({ + required JSArrayBuffer output1, + JSArrayBuffer output2, + }); + + external JSArrayBuffer get output1; + external set output1(JSArrayBuffer value); + external JSArrayBuffer get output2; + external set output2(JSArrayBuffer value); +} diff --git a/lib/src/dom/fullscreen.dart b/lib/src/dom/fullscreen.dart new file mode 100644 index 00000000..e8bf6392 --- /dev/null +++ b/lib/src/dom/fullscreen.dart @@ -0,0 +1,27 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. +// +// API docs from [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web). +// Attributions and copyright licensing by Mozilla Contributors is licensed +// under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/. + +// Generated from Web IDL definitions. + +@JS() +library; + +import 'dart:js_interop'; + +typedef FullscreenNavigationUI = String; +extension type FullscreenOptions._(JSObject _) implements JSObject { + external factory FullscreenOptions({ + FullscreenNavigationUI navigationUI, + JSObject screen, + }); + + external FullscreenNavigationUI get navigationUI; + external set navigationUI(FullscreenNavigationUI value); + external JSObject get screen; + external set screen(JSObject value); +} diff --git a/lib/src/dom/gamepad.dart b/lib/src/dom/gamepad.dart index 497e539a..7607700d 100644 --- a/lib/src/dom/gamepad.dart +++ b/lib/src/dom/gamepad.dart @@ -17,8 +17,6 @@ import 'dom.dart'; import 'hr_time.dart'; typedef GamepadMappingType = String; -typedef GamepadHapticsResult = String; -typedef GamepadHapticEffectType = String; /// The **`Gamepad`** interface of the /// [Gamepad API](https://developer.mozilla.org/en-US/docs/Web/API/Gamepad_API) @@ -129,11 +127,6 @@ extension type Gamepad._(JSObject _) implements JSObject { /// is not /// pressed, and 1.0 representing a button that is fully pressed. external JSArray get buttons; - - /// The **`vibrationActuator`** read-only property of the [Gamepad] interface - /// returns a [GamepadHapticActuator] object, which represents haptic feedback - /// hardware available on the controller. - external GamepadHapticActuator get vibrationActuator; } /// The **`GamepadButton`** interface defines an individual button of a gamepad @@ -188,31 +181,12 @@ extension type GamepadButton._(JSObject _) implements JSObject { /// API documentation sourced from /// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/GamepadHapticActuator). extension type GamepadHapticActuator._(JSObject _) implements JSObject { - /// The **`playEffect()`** method of the [GamepadHapticActuator] interface - /// makes the hardware play a specific vibration pattern. - external JSPromise playEffect( - GamepadHapticEffectType type, [ - GamepadEffectParameters params, - ]); - external JSPromise reset(); - external JSArray get effects; -} -extension type GamepadEffectParameters._(JSObject _) implements JSObject { - external factory GamepadEffectParameters({ - int duration, - int startDelay, - num strongMagnitude, - num weakMagnitude, - }); - - external int get duration; - external set duration(int value); - external int get startDelay; - external set startDelay(int value); - external num get strongMagnitude; - external set strongMagnitude(num value); - external num get weakMagnitude; - external set weakMagnitude(num value); + /// The **`pulse()`** method of the [GamepadHapticActuator] interface makes + /// the hardware pulse at a certain intensity for a specified duration. + external JSPromise pulse( + num value, + num duration, + ); } /// The GamepadEvent interface of the Gamepad API contains references to diff --git a/lib/src/dom/generic_sensor.dart b/lib/src/dom/generic_sensor.dart new file mode 100644 index 00000000..f2910e56 --- /dev/null +++ b/lib/src/dom/generic_sensor.dart @@ -0,0 +1,121 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. +// +// API docs from [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web). +// Attributions and copyright licensing by Mozilla Contributors is licensed +// under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/. + +// Generated from Web IDL definitions. + +@JS() +library; + +import 'dart:js_interop'; + +import 'dom.dart'; +import 'hr_time.dart'; +import 'html.dart'; +import 'webidl.dart'; + +/// The **`Sensor`** interface of the +/// [Sensor APIs](https://developer.mozilla.org/en-US/docs/Web/API/Sensor_APIs) +/// is the base class for all the other sensor interfaces. This interface cannot +/// be used directly. Instead it provides properties, event handlers, and +/// methods accessed by interfaces that inherit from it. +/// +/// This feature may be blocked by a +/// [Permissions Policy](https://developer.mozilla.org/en-US/docs/Web/HTTP/Permissions_Policy) +/// set on your server. +/// +/// When initially created, the `Sensor` object is _idle_, meaning it does not +/// take measures. Once the [Sensor.start] method is called, it prepares itself +/// to read data and, once ready, the [Sensor.activate_event] event is sent and +/// the sensor becomes _activated_. It then sends a [Sensor.reading_event] event +/// each time new data is available. +/// +/// In case of an error, the [Sensor.error_event] event is sent, reading stops, +/// and the `Sensor` object becomes _idle_ again. The [Sensor.start] method +/// needs to be called again before it can read further data. +/// +/// --- +/// +/// API documentation sourced from +/// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/Sensor). +extension type Sensor._(JSObject _) implements EventTarget, JSObject { + /// The **`start()`** method of the [Sensor] interface activates one of the + /// sensors based on `Sensor`. + external void start(); + + /// The **`stop()`** method of the [Sensor] interface deactivates the current + /// sensor. + external void stop(); + + /// The **`activated`** read-only property + /// of the [Sensor] interface returns a boolean value indicating + /// whether the sensor is active. + /// + /// Because [Sensor] is a base class, `activated` may only be read + /// from one of its derived classes. + external bool get activated; + + /// The **`hasReading`** read-only + /// property of the [Sensor] interface returns a boolean value + /// indicating whether the sensor has a reading. + /// + /// Because [Sensor] is a base class, `hasReading` may only be read + /// from one of its derived classes. + external bool get hasReading; + + /// The **`timestamp`** read-only property + /// of the [Sensor] interface returns the timestamp of the latest sensor + /// reading. + /// + /// Because [Sensor] is a base class, `timestamp` may only be read + /// from one of its derived classes. + external DOMHighResTimeStamp? get timestamp; + external EventHandler get onreading; + external set onreading(EventHandler value); + external EventHandler get onactivate; + external set onactivate(EventHandler value); + external EventHandler get onerror; + external set onerror(EventHandler value); +} +extension type SensorOptions._(JSObject _) implements JSObject { + external factory SensorOptions({num frequency}); + + external num get frequency; + external set frequency(num value); +} + +/// The **`SensorErrorEvent`** interface of the +/// [Sensor APIs](https://developer.mozilla.org/en-US/docs/Web/API/Sensor_APIs) +/// provides information about errors thrown by a [Sensor] or derived interface. +/// +/// --- +/// +/// API documentation sourced from +/// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/SensorErrorEvent). +extension type SensorErrorEvent._(JSObject _) implements Event, JSObject { + external factory SensorErrorEvent( + String type, + SensorErrorEventInit errorEventInitDict, + ); + + /// The **`error`** read-only property of + /// the [SensorErrorEvent] interface returns the [DOMException] + /// object passed in the event's constructor. + external DOMException get error; +} +extension type SensorErrorEventInit._(JSObject _) + implements EventInit, JSObject { + external factory SensorErrorEventInit({ + bool bubbles, + bool cancelable, + bool composed, + required DOMException error, + }); + + external DOMException get error; + external set error(DOMException value); +} diff --git a/lib/src/dom/gyroscope.dart b/lib/src/dom/gyroscope.dart new file mode 100644 index 00000000..bda7aa99 --- /dev/null +++ b/lib/src/dom/gyroscope.dart @@ -0,0 +1,62 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. +// +// API docs from [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web). +// Attributions and copyright licensing by Mozilla Contributors is licensed +// under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/. + +// Generated from Web IDL definitions. + +@JS() +library; + +import 'dart:js_interop'; + +import 'generic_sensor.dart'; + +typedef GyroscopeLocalCoordinateSystem = String; + +/// The **`Gyroscope`** interface of the +/// [Sensor APIs](https://developer.mozilla.org/en-US/docs/Web/API/Sensor_APIs) +/// provides on each reading the angular velocity of the device along all three +/// axes. +/// +/// To use this sensor, the user must grant permission to the `'gyroscope'` +/// device sensor through the +/// [Permissions API](https://developer.mozilla.org/en-US/docs/Web/API/Permissions_API). +/// In addition, this feature may be blocked by a +/// [Permissions Policy](https://developer.mozilla.org/en-US/docs/Web/HTTP/Permissions_Policy) +/// set on your server. +/// +/// --- +/// +/// API documentation sourced from +/// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/Gyroscope). +extension type Gyroscope._(JSObject _) implements Sensor, JSObject { + external factory Gyroscope([GyroscopeSensorOptions sensorOptions]); + + /// The **`x`** read-only property of the + /// [Gyroscope] interface returns a number specifying the + /// angular velocity of the device along its x-axis. + external num? get x; + + /// The **`y`** read-only property of the [Gyroscope] interface returns a + /// number specifying the angular velocity of the device along its y-axis. + external num? get y; + + /// The **`z`** read-only property of the + /// [Gyroscope] interface returns a number specifying the + /// angular velocity of the device along its z-axis. + external num? get z; +} +extension type GyroscopeSensorOptions._(JSObject _) + implements SensorOptions, JSObject { + external factory GyroscopeSensorOptions({ + num frequency, + GyroscopeLocalCoordinateSystem referenceFrame, + }); + + external GyroscopeLocalCoordinateSystem get referenceFrame; + external set referenceFrame(GyroscopeLocalCoordinateSystem value); +} diff --git a/lib/src/dom/hr_time.dart b/lib/src/dom/hr_time.dart index 0ce632f2..3444682b 100644 --- a/lib/src/dom/hr_time.dart +++ b/lib/src/dom/hr_time.dart @@ -14,6 +14,7 @@ library; import 'dart:js_interop'; import 'dom.dart'; +import 'event_timing.dart'; import 'html.dart'; import 'navigation_timing.dart'; import 'performance_timeline.dart'; @@ -185,6 +186,13 @@ extension type Performance._(JSObject _) implements EventTarget, JSObject { /// [PerformanceMeasure] objects from the browser's performance timeline. external void clearMeasures([String measureName]); + /// The read-only `performance.eventCounts` property is an [EventCounts] map + /// containing the number of events which have been dispatched per event type. + /// + /// Not all event types are exposed. You can only get counts for event types + /// supported by the [PerformanceEventTiming] interface. + external EventCounts get eventCounts; + /// The **`timeOrigin`** read-only property of the [Performance] interface /// returns the high resolution timestamp that is used as the baseline for /// performance-related timestamps. diff --git a/lib/src/dom/html.dart b/lib/src/dom/html.dart index 0f14b87c..b9cb3f94 100644 --- a/lib/src/dom/html.dart +++ b/lib/src/dom/html.dart @@ -13,11 +13,11 @@ library; import 'dart:js_interop'; +import 'battery_status.dart'; import 'clipboard_apis.dart'; import 'credential_management.dart'; import 'css_font_loading.dart'; import 'css_typed_om.dart'; -import 'css_view_transitions.dart'; import 'cssom.dart'; import 'cssom_view.dart'; import 'dom.dart'; @@ -35,8 +35,11 @@ import 'media_playback_quality.dart'; import 'media_source.dart'; import 'mediacapture_streams.dart'; import 'mediasession.dart'; -import 'performance_timeline.dart'; import 'permissions.dart'; +import 'picture_in_picture.dart'; +import 'remote_playback.dart'; +import 'requestidlecallback.dart'; +import 'scheduling_apis.dart'; import 'screen_wake_lock.dart'; import 'selection_api.dart'; import 'service_workers.dart'; @@ -45,9 +48,12 @@ import 'storage.dart'; import 'trusted_types.dart'; import 'uievents.dart'; import 'vibration.dart'; +import 'video_rvfc.dart'; import 'web_locks.dart'; +import 'web_share.dart'; import 'webcryptoapi.dart'; import 'webidl.dart'; +import 'webmidi.dart'; import 'xhr.dart'; typedef HTMLOrSVGScriptElement = JSObject; @@ -65,7 +71,6 @@ typedef MessageEventSource = JSObject; typedef BlobCallback = JSFunction; typedef CustomElementConstructor = JSFunction; typedef FunctionStringCallback = JSFunction; -typedef NavigationInterceptHandler = JSFunction; typedef EventHandlerNonNull = JSFunction; typedef OnErrorEventHandlerNonNull = JSFunction; typedef OnBeforeUnloadEventHandlerNonNull = JSFunction; @@ -90,10 +95,6 @@ typedef CanvasFontVariantCaps = String; typedef CanvasTextRendering = String; typedef OffscreenRenderingContextId = String; typedef ScrollRestoration = String; -typedef NavigationHistoryBehavior = String; -typedef NavigationType = String; -typedef NavigationFocusReset = String; -typedef NavigationScrollBehavior = String; typedef DOMParserSupportedType = String; typedef ImageOrientation = String; typedef PremultiplyAlpha = String; @@ -802,8 +803,6 @@ extension type HTMLElement._(JSObject _) implements Element, JSObject { external set onauxclick(EventHandler value); external EventHandler get onbeforeinput; external set onbeforeinput(EventHandler value); - external EventHandler get onbeforematch; - external set onbeforematch(EventHandler value); external EventHandler get onbeforetoggle; external set onbeforetoggle(EventHandler value); external EventHandler get onblur; @@ -936,14 +935,6 @@ extension type HTMLElement._(JSObject _) implements Element, JSObject { external set onvolumechange(EventHandler value); external EventHandler get onwaiting; external set onwaiting(EventHandler value); - external EventHandler get onwebkitanimationend; - external set onwebkitanimationend(EventHandler value); - external EventHandler get onwebkitanimationiteration; - external set onwebkitanimationiteration(EventHandler value); - external EventHandler get onwebkitanimationstart; - external set onwebkitanimationstart(EventHandler value); - external EventHandler get onwebkittransitionend; - external set onwebkittransitionend(EventHandler value); external EventHandler get onwheel; external set onwheel(EventHandler value); external EventHandler get onpointerover; @@ -954,8 +945,6 @@ extension type HTMLElement._(JSObject _) implements Element, JSObject { external set onpointerdown(EventHandler value); external EventHandler get onpointermove; external set onpointermove(EventHandler value); - external EventHandler get onpointerrawupdate; - external set onpointerrawupdate(EventHandler value); external EventHandler get onpointerup; external set onpointerup(EventHandler value); external EventHandler get onpointercancel; @@ -1414,7 +1403,6 @@ extension type HTMLLinkElement._(JSObject _) implements HTMLElement, JSObject { /// See the HTTP header for details. external String get referrerPolicy; external set referrerPolicy(String value); - external DOMTokenList get blocking; external bool get disabled; external set disabled(bool value); @@ -1538,7 +1526,6 @@ extension type HTMLStyleElement._(JSObject _) implements HTMLElement, JSObject { /// intended destination medium for style information. external String get media; external set media(String value); - external DOMTokenList get blocking; /// The **`HTMLStyleElement.type`** property returns the type of the current /// style. @@ -1569,6 +1556,8 @@ extension type HTMLBodyElement._(JSObject _) implements HTMLElement, JSObject { /// Creates an [HTMLBodyElement] using the tag 'body'. HTMLBodyElement() : _ = document.createElement('body'); + external EventHandler get onorientationchange; + external set onorientationchange(EventHandler value); external String get text; external set text(String value); external String get link; @@ -1605,8 +1594,6 @@ extension type HTMLBodyElement._(JSObject _) implements HTMLElement, JSObject { external set ononline(EventHandler value); external EventHandler get onpagehide; external set onpagehide(EventHandler value); - external EventHandler get onpagereveal; - external set onpagereveal(EventHandler value); external EventHandler get onpageshow; external set onpageshow(EventHandler value); external EventHandler get onpopstate; @@ -3049,6 +3036,27 @@ extension type HTMLVideoElement._(JSObject _) /// The data returned can be used to evaluate the quality of the video stream. external VideoPlaybackQuality getVideoPlaybackQuality(); + /// The **[HTMLVideoElement]** method + /// **`requestPictureInPicture()`** issues an asynchronous request + /// to display the video in picture-in-picture mode. + /// + /// It's not guaranteed that the video will be put into picture-in-picture. If + /// permission + /// to enter that mode is granted, the returned `Promise` will resolve and the + /// video will receive a [HTMLVideoElement.enterpictureinpicture_event] event + /// to let it know that it's now in picture-in-picture. + external JSPromise requestPictureInPicture(); + + /// The **`requestVideoFrameCallback()`** method of the [HTMLVideoElement] + /// interface registers a callback function that runs when a new video frame + /// is sent to the compositor. This enables developers to perform efficient + /// operations on each video frame. + external int requestVideoFrameCallback(VideoFrameRequestCallback callback); + + /// The **`cancelVideoFrameCallback()`** method of the [HTMLVideoElement] + /// interface cancels a previously-registered video frame callback. + external void cancelVideoFrameCallback(int handle); + /// The **`width`** property of the [HTMLVideoElement] interface returns an /// integer that reflects the `width` attribute of the `video` element, /// specifying the displayed width of the resource in CSS pixels. @@ -3088,6 +3096,16 @@ extension type HTMLVideoElement._(JSObject _) external set poster(String value); external bool get playsInline; external set playsInline(bool value); + external EventHandler get onenterpictureinpicture; + external set onenterpictureinpicture(EventHandler value); + external EventHandler get onleavepictureinpicture; + external set onleavepictureinpicture(EventHandler value); + + /// The [HTMLVideoElement] **`disablePictureInPicture`** property reflects the + /// HTML attribute indicating whether the picture-in-picture feature is + /// disabled for the current element. + external bool get disablePictureInPicture; + external set disablePictureInPicture(bool value); } /// The **`HTMLAudioElement`** interface provides access to the properties of @@ -3167,6 +3185,16 @@ extension type HTMLMediaElement._(JSObject _) implements HTMLElement, JSObject { external static int get HAVE_FUTURE_DATA; external static int get HAVE_ENOUGH_DATA; + /// The **`HTMLMediaElement.setSinkId()`** method of the + /// [Audio Output Devices API](https://developer.mozilla.org/en-US/docs/Web/API/Audio_Output_Devices_API) + /// sets the ID of the audio device to use for output and returns a `Promise`. + /// + /// This only works when the application is permitted to use the specified + /// device. + /// For more information see the + /// [security requirements](#security_requirements) below. + external JSPromise setSinkId(String sinkId); + /// The **`setMediaKeys()`** method of the /// [HTMLMediaElement] interface returns a `Promise` that resolves /// to the passed [MediaKeys], which are those used to decrypt media during @@ -3226,6 +3254,27 @@ extension type HTMLMediaElement._(JSObject _) implements HTMLElement, JSObject { String language, ]); + /// The **`captureStream()`** method of the [HTMLMediaElement] interface + /// returns a [MediaStream] object which is streaming a real-time capture of + /// the content being rendered in the media element. + /// + /// This can be used, for example, as a source for a + /// [WebRTC](https://developer.mozilla.org/en-US/docs/Web/API/WebRTC_API) + /// [RTCPeerConnection]. + external MediaStream captureStream(); + + /// The **`HTMLMediaElement.sinkId`** read-only property of the + /// [Audio Output Devices API](https://developer.mozilla.org/en-US/docs/Web/API/Audio_Output_Devices_API) + /// returns a string that is the unique ID of the device to be used for + /// playing audio output. + /// + /// This ID should be one of the [MediaDeviceInfo.deviceId] values returned + /// from [MediaDevices.enumerateDevices], `id-multimedia`, or + /// `id-communications`. + /// If the user agent default device is being used, it returns an empty + /// string. + external String get sinkId; + /// The read-only **`HTMLMediaElement.mediaKeys`** property returns a /// [MediaKeys] object, that is a set of keys that the element can use for /// decryption of media data during playback. @@ -3498,6 +3547,18 @@ extension type HTMLMediaElement._(JSObject _) implements HTMLElement, JSObject { /// to learn /// more about watching for changes to a media element's track list. external TextTrackList get textTracks; + + /// The **`remote`** read-only property of the [HTMLMediaElement] interface + /// returns the [RemotePlayback] object associated with the media element. The + /// `RemotePlayback` object allow the control of remote devices playing the + /// media. + external RemotePlayback get remote; + + /// The **`disableRemotePlayback`** property of the [HTMLMediaElement] + /// interface determines whether the media element is allowed to have a remote + /// playback UI. + external bool get disableRemotePlayback; + external set disableRemotePlayback(bool value); } /// The **`MediaError`** interface represents an error which occurred while @@ -5205,6 +5266,8 @@ extension type HTMLInputElement._(JSObject _) implements HTMLElement, JSObject { /// > origins as a Google Chrome-specific API. It's likely to be renamed /// > someday. external JSArray get webkitEntries; + external String get capture; + external set capture(String value); external String get accept; external set accept(String value); external String get alt; @@ -6259,7 +6322,6 @@ extension type HTMLScriptElement._(JSObject _) /// fetching the script and any scripts it imports. external String get referrerPolicy; external set referrerPolicy(String value); - external DOMTokenList get blocking; external String get fetchPriority; external set fetchPriority(String value); external String get charset; @@ -6288,8 +6350,6 @@ extension type HTMLTemplateElement._(JSObject _) external DocumentFragment get content; external String get shadowRootMode; external set shadowRootMode(String value); - external bool get shadowRootDelegatesFocus; - external set shadowRootDelegatesFocus(bool value); } /// The **`HTMLSlotElement`** interface of the @@ -6426,6 +6486,12 @@ extension type HTMLCanvasElement._(JSObject _) /// worker. external OffscreenCanvas transferControlToOffscreen(); + /// The **`captureStream()`** method of the [HTMLCanvasElement] interface + /// returns a [MediaStream] + /// which includes a [CanvasCaptureMediaStreamTrack] containing a real-time + /// video capture of the canvas's contents. + external MediaStream captureStream([num frameRequestRate]); + /// The **`HTMLCanvasElement.width`** property is a /// positive `integer` reflecting the /// [`width`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/canvas#width) @@ -6573,24 +6639,6 @@ extension type CanvasRenderingContext2D._(JSObject _) implements JSObject { /// and so on. external void reset(); - /// The **`CanvasRenderingContext2D.isContextLost()`** method of the Canvas 2D - /// API returns `true` if the rendering context is lost (and has not yet been - /// reset). - /// This might occur due to driver crashes, running out of memory, and so on. - /// - /// If the user agent detects that the canvas backing storage is lost it will - /// fire the - /// [`contextlost` event](https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/contextlost_event) - /// at the associated - /// [`HTMLCanvasElement`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement). - /// If this event is not cancelled it will attempt to reset the backing - /// storage to the default state (this is equivalent to calling - /// [CanvasRenderingContext2D.reset]). - /// On success it will fire the - /// [`contextrestored` event](https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/contextrestored_event), - /// indicating that the context is ready to reinitialize and redraw. - external bool isContextLost(); - /// The /// **`CanvasRenderingContext2D.scale()`** /// method of the Canvas 2D API adds a scaling transformation to the canvas @@ -6916,13 +6964,6 @@ extension type CanvasRenderingContext2D._(JSObject _) implements JSObject { Element element, ]); - /// The - /// **`CanvasRenderingContext2D.scrollPathIntoView()`** - /// method of the Canvas 2D API scrolls the current or given path into view. - /// It is similar - /// to [Element.scrollIntoView]. - external void scrollPathIntoView([Path2D path]); - /// The [CanvasRenderingContext2D] method /// **`fillText()`**, part of the Canvas 2D API, draws a text string /// at the specified coordinates, filling the string's characters with the @@ -7869,13 +7910,6 @@ extension type ImageBitmapRenderingContext._(JSObject _) implements JSObject { external void transferFromImageBitmap(ImageBitmap? bitmap); external JSObject get canvas; } -extension type ImageBitmapRenderingContextSettings._(JSObject _) - implements JSObject { - external factory ImageBitmapRenderingContextSettings({bool alpha}); - - external bool get alpha; - external set alpha(bool value); -} extension type ImageEncodeOptions._(JSObject _) implements JSObject { external factory ImageEncodeOptions({ String type, @@ -7991,7 +8025,6 @@ extension type OffscreenCanvasRenderingContext2D._(JSObject _) external void save(); external void restore(); external void reset(); - external bool isContextLost(); external void scale( num x, num y, @@ -8379,10 +8412,571 @@ extension type ElementInternals._(JSObject _) implements JSObject { /// returns the labels associated with the element. external NodeList get labels; - /// The **`states`** read-only property of the [ElementInternals] interface - /// returns a [CustomStateSet] representing the possible states of the custom - /// element. - external CustomStateSet get states; + /// The **`role`** read-only property of the [ElementInternals] interface + /// returns the + /// [WAI-ARIA role](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles) + /// for the element. For example, a checkbox might have + /// [`role="checkbox"`](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/checkbox_role). + external String? get role; + external set role(String? value); + + /// The **`ariaAtomic`** property of the [ElementInternals] interface reflects + /// the value of the + /// [`aria-atomic`](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-atomic) + /// attribute, which indicates whether assistive technologies will present + /// all, or only parts of, the changed region based on the change + /// notifications defined by the `aria-relevant` attribute. + /// + /// > **Note:** Setting aria attributes on `ElementInternals` allows default + /// > semantics to be defined on a custom element. These may be overwritten by + /// > author-defined attributes, but ensure that default semantics are + /// > retained should the author delete those attributes, or fail to add them + /// > at all. For more information see the + /// > [Accessibility Object Model explainer](https://wicg.github.io/aom/explainer.html#default-semantics-for-custom-elements-via-the-elementinternals-object). + external String? get ariaAtomic; + external set ariaAtomic(String? value); + + /// The **`ariaAutoComplete`** property of the [ElementInternals] interface + /// reflects the value of the + /// [`aria-autocomplete`](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-autocomplete) + /// attribute, which indicates whether inputting text could trigger display of + /// one or more predictions of the user's intended value for a combobox, + /// searchbox, or textbox and specifies how predictions would be presented if + /// they were made. + /// + /// > **Note:** Setting aria attributes on `ElementInternals` allows default + /// > semantics to be defined on a custom element. These may be overwritten by + /// > author-defined attributes, but ensure that default semantics are + /// > retained should the author delete those attributes, or fail to add them + /// > at all. For more information see the + /// > [Accessibility Object Model explainer](https://wicg.github.io/aom/explainer.html#default-semantics-for-custom-elements-via-the-elementinternals-object). + external String? get ariaAutoComplete; + external set ariaAutoComplete(String? value); + + /// The **`ariaBusy`** property of the [ElementInternals] interface reflects + /// the value of the + /// [`aria-busy`](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-busy) + /// attribute, which indicates whether an element is being modified, as + /// assistive technologies may want to wait until the modifications are + /// complete before exposing them to the user. + /// + /// > **Note:** Setting aria attributes on `ElementInternals` allows default + /// > semantics to be defined on a custom element. These may be overwritten by + /// > author-defined attributes, but ensure that default semantics are + /// > retained should the author delete those attributes, or fail to add them + /// > at all. For more information see the + /// > [Accessibility Object Model explainer](https://wicg.github.io/aom/explainer.html#default-semantics-for-custom-elements-via-the-elementinternals-object). + external String? get ariaBusy; + external set ariaBusy(String? value); + + /// The **`ariaChecked`** property of the [ElementInternals] interface + /// reflects the value of the + /// [`aria-checked`](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-checked) + /// attribute, which indicates the current "checked" state of checkboxes, + /// radio buttons, and other widgets that have a checked state. + /// + /// > **Note:** Setting aria attributes on `ElementInternals` allows default + /// > semantics to be defined on a custom element. These may be overwritten by + /// > author-defined attributes, but ensure that default semantics are + /// > retained should the author delete those attributes, or fail to add them + /// > at all. For more information see the + /// > [Accessibility Object Model explainer](https://wicg.github.io/aom/explainer.html#default-semantics-for-custom-elements-via-the-elementinternals-object). + external String? get ariaChecked; + external set ariaChecked(String? value); + + /// The **`ariaColCount`** property of the [ElementInternals] interface + /// reflects the value of the + /// [`aria-colcount`](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-colcount) + /// attribute, which defines the number of columns in a table, grid, or + /// treegrid. + /// + /// > **Note:** Setting aria attributes on `ElementInternals` allows default + /// > semantics to be defined on a custom element. These may be overwritten by + /// > author-defined attributes, but ensure that default semantics are + /// > retained should the author delete those attributes, or fail to add them + /// > at all. For more information see the + /// > [Accessibility Object Model explainer](https://wicg.github.io/aom/explainer.html#default-semantics-for-custom-elements-via-the-elementinternals-object). + external String? get ariaColCount; + external set ariaColCount(String? value); + + /// The **`ariaColIndex`** property of the [ElementInternals] interface + /// reflects the value of the + /// [`aria-colindex`](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-colindex) + /// attribute, which defines an element's column index or position with + /// respect to the total number of columns within a table, grid, or treegrid. + /// + /// > **Note:** Setting aria attributes on `ElementInternals` allows default + /// > semantics to be defined on a custom element. These may be overwritten by + /// > author-defined attributes, but ensure that default semantics are + /// > retained should the author delete those attributes, or fail to add them + /// > at all. For more information see the + /// > [Accessibility Object Model explainer](https://wicg.github.io/aom/explainer.html#default-semantics-for-custom-elements-via-the-elementinternals-object). + external String? get ariaColIndex; + external set ariaColIndex(String? value); + + /// The **`ariaColSpan`** property of the [ElementInternals] interface + /// reflects the value of the + /// [`aria-colspan`](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-colspan) + /// attribute, which defines the number of columns spanned by a cell or + /// gridcell within a table, grid, or treegrid. + /// + /// > **Note:** Setting aria attributes on `ElementInternals` allows default + /// > semantics to be defined on a custom element. These may be overwritten by + /// > author-defined attributes, but ensure that default semantics are + /// > retained should the author delete those attributes, or fail to add them + /// > at all. For more information see the + /// > [Accessibility Object Model explainer](https://wicg.github.io/aom/explainer.html#default-semantics-for-custom-elements-via-the-elementinternals-object). + external String? get ariaColSpan; + external set ariaColSpan(String? value); + + /// The **`ariaCurrent`** property of the [ElementInternals] interface + /// reflects the value of the + /// [`aria-current`](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-current) + /// attribute, which indicates the element that represents the current item + /// within a container or set of related elements. + /// + /// > **Note:** Setting aria attributes on `ElementInternals` allows default + /// > semantics to be defined on a custom element. These may be overwritten by + /// > author-defined attributes, but ensure that default semantics are + /// > retained should the author delete those attributes, or fail to add them + /// > at all. For more information see the + /// > [Accessibility Object Model explainer](https://wicg.github.io/aom/explainer.html#default-semantics-for-custom-elements-via-the-elementinternals-object). + external String? get ariaCurrent; + external set ariaCurrent(String? value); + + /// The **`ariaDescription`** property of the [ElementInternals] interface + /// reflects the value of the + /// [`aria-description`](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-description) + /// attribute, which defines a string value that describes or annotates the + /// current element. + /// + /// > **Note:** Setting aria attributes on `ElementInternals` allows default + /// > semantics to be defined on a custom element. These may be overwritten by + /// > author-defined attributes, but ensure that default semantics are + /// > retained should the author delete those attributes, or fail to add them + /// > at all. For more information see the + /// > [Accessibility Object Model explainer](https://wicg.github.io/aom/explainer.html#default-semantics-for-custom-elements-via-the-elementinternals-object). + external String? get ariaDescription; + external set ariaDescription(String? value); + + /// The **`ariaDisabled`** property of the [ElementInternals] interface + /// reflects the value of the + /// [`aria-disabled`](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-disabled) + /// attribute, which indicates that the element is perceivable but disabled, + /// so it is not editable or otherwise operable. + /// + /// > **Note:** Setting aria attributes on `ElementInternals` allows default + /// > semantics to be defined on a custom element. These may be overwritten by + /// > author-defined attributes, but ensure that default semantics are + /// > retained should the author delete those attributes, or fail to add them + /// > at all. For more information see the + /// > [Accessibility Object Model explainer](https://wicg.github.io/aom/explainer.html#default-semantics-for-custom-elements-via-the-elementinternals-object). + external String? get ariaDisabled; + external set ariaDisabled(String? value); + + /// The **`ariaExpanded`** property of the [ElementInternals] interface + /// reflects the value of the + /// [`aria-expanded`](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-expanded) + /// attribute, which indicates whether a grouping element owned or controlled + /// by this element is expanded or collapsed. + /// + /// > **Note:** Setting aria attributes on `ElementInternals` allows default + /// > semantics to be defined on a custom element. These may be overwritten by + /// > author-defined attributes, but ensure that default semantics are + /// > retained should the author delete those attributes, or fail to add them + /// > at all. For more information see the + /// > [Accessibility Object Model explainer](https://wicg.github.io/aom/explainer.html#default-semantics-for-custom-elements-via-the-elementinternals-object). + external String? get ariaExpanded; + external set ariaExpanded(String? value); + + /// The **`ariaHasPopup`** property of the [ElementInternals] interface + /// reflects the value of the + /// [`aria-haspopup`](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-haspopup) + /// attribute, which indicates the availability and type of interactive popup + /// element, such as menu or dialog, that can be triggered by an element. + /// + /// > **Note:** Setting aria attributes on `ElementInternals` allows default + /// > semantics to be defined on a custom element. These may be overwritten by + /// > author-defined attributes, but ensure that default semantics are + /// > retained should the author delete those attributes, or fail to add them + /// > at all. For more information see the + /// > [Accessibility Object Model explainer](https://wicg.github.io/aom/explainer.html#default-semantics-for-custom-elements-via-the-elementinternals-object). + external String? get ariaHasPopup; + external set ariaHasPopup(String? value); + + /// The **`ariaHidden`** property of the [ElementInternals] interface reflects + /// the value of the + /// [`aria-hidden`](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-hidden) + /// attribute, which indicates whether the element is exposed to an + /// accessibility API. + /// + /// > **Note:** Setting aria attributes on `ElementInternals` allows default + /// > semantics to be defined on a custom element. These may be overwritten by + /// > author-defined attributes, but ensure that default semantics are + /// > retained should the author delete those attributes, or fail to add them + /// > at all. For more information see the + /// > [Accessibility Object Model explainer](https://wicg.github.io/aom/explainer.html#default-semantics-for-custom-elements-via-the-elementinternals-object). + external String? get ariaHidden; + external set ariaHidden(String? value); + external String? get ariaInvalid; + external set ariaInvalid(String? value); + + /// The **`ariaKeyShortcuts`** property of the [ElementInternals] interface + /// reflects the value of the + /// [`aria-keyshortcuts`](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-keyshortcuts) + /// attribute, which indicates keyboard shortcuts that an author has + /// implemented to activate or give focus to an element. + /// + /// > **Note:** Setting aria attributes on `ElementInternals` allows default + /// > semantics to be defined on a custom element. These may be overwritten by + /// > author-defined attributes, but ensure that default semantics are + /// > retained should the author delete those attributes, or fail to add them + /// > at all. For more information see the + /// > [Accessibility Object Model explainer](https://wicg.github.io/aom/explainer.html#default-semantics-for-custom-elements-via-the-elementinternals-object). + external String? get ariaKeyShortcuts; + external set ariaKeyShortcuts(String? value); + + /// } + /// + /// The **`ariaLabel`** property of the [ElementInternals] interface reflects + /// the value of the + /// [`aria-label`](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-label) + /// attribute, which defines a string value that labels the current Element. + /// + /// > **Note:** Setting aria attributes on `ElementInternals` allows default + /// > semantics to be defined on a custom element. These may be overwritten by + /// > author-defined attributes, but ensure that default semantics are + /// > retained should the author delete those attributes, or fail to add them + /// > at all. For more information see the + /// > [Accessibility Object Model explainer](https://wicg.github.io/aom/explainer.html#default-semantics-for-custom-elements-via-the-elementinternals-object). + external String? get ariaLabel; + external set ariaLabel(String? value); + + /// The **`ariaLevel`** property of the [ElementInternals] interface reflects + /// the value of the + /// [`aria-level`](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-level) + /// attribute, which defines the hierarchical level of an element within a + /// structure. + /// + /// > **Note:** Setting aria attributes on `ElementInternals` allows default + /// > semantics to be defined on a custom element. These may be overwritten by + /// > author-defined attributes, but ensure that default semantics are + /// > retained should the author delete those attributes, or fail to add them + /// > at all. For more information see the + /// > [Accessibility Object Model explainer](https://wicg.github.io/aom/explainer.html#default-semantics-for-custom-elements-via-the-elementinternals-object). + external String? get ariaLevel; + external set ariaLevel(String? value); + + /// The **`ariaLive`** property of the [ElementInternals] interface reflects + /// the value of the + /// [`aria-live`](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Live_Regions) + /// attribute, which indicates that an element will be updated, and describes + /// the types of updates the user agents, assistive technologies, and user can + /// expect from the live region. + /// + /// > **Note:** Setting aria attributes on `ElementInternals` allows default + /// > semantics to be defined on a custom element. These may be overwritten by + /// > author-defined attributes, but ensure that default semantics are + /// > retained should the author delete those attributes, or fail to add them + /// > at all. For more information see the + /// > [Accessibility Object Model explainer](https://wicg.github.io/aom/explainer.html#default-semantics-for-custom-elements-via-the-elementinternals-object). + external String? get ariaLive; + external set ariaLive(String? value); + + /// The **`ariaModal`** property of the [ElementInternals] interface reflects + /// the value of the + /// [`aria-modal`](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-modal) + /// attribute, which indicates whether an element is modal when displayed. + /// + /// > **Note:** Setting aria attributes on `ElementInternals` allows default + /// > semantics to be defined on a custom element. These may be overwritten by + /// > author-defined attributes, but ensure that default semantics are + /// > retained should the author delete those attributes, or fail to add them + /// > at all. For more information see the + /// > [Accessibility Object Model explainer](https://wicg.github.io/aom/explainer.html#default-semantics-for-custom-elements-via-the-elementinternals-object). + external String? get ariaModal; + external set ariaModal(String? value); + + /// The **`ariaMultiLine`** property of the [ElementInternals] interface + /// reflects the value of the + /// [`aria-multiline`](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-multiline) + /// attribute, which indicates whether a text box accepts multiple lines of + /// input or only a single line. + /// + /// > **Note:** Setting aria attributes on `ElementInternals` allows default + /// > semantics to be defined on a custom element. These may be overwritten by + /// > author-defined attributes, but ensure that default semantics are + /// > retained should the author delete those attributes, or fail to add them + /// > at all. For more information see the + /// > [Accessibility Object Model explainer](https://wicg.github.io/aom/explainer.html#default-semantics-for-custom-elements-via-the-elementinternals-object). + external String? get ariaMultiLine; + external set ariaMultiLine(String? value); + + /// The **`ariaMultiSelectable`** property of the [ElementInternals] interface + /// reflects the value of the + /// [`aria-multiselectable`](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-multiselectable) + /// attribute, which indicates that the user may select more than one item + /// from the current selectable descendants. + /// + /// > **Note:** Setting aria attributes on `ElementInternals` allows default + /// > semantics to be defined on a custom element. These may be overwritten by + /// > author-defined attributes, but ensure that default semantics are + /// > retained should the author delete those attributes, or fail to add them + /// > at all. For more information see the + /// > [Accessibility Object Model explainer](https://wicg.github.io/aom/explainer.html#default-semantics-for-custom-elements-via-the-elementinternals-object). + external String? get ariaMultiSelectable; + external set ariaMultiSelectable(String? value); + + /// The **`ariaOrientation`** property of the [ElementInternals] interface + /// reflects the value of the + /// [`aria-orientation`](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-orientation) + /// attribute, which indicates whether the element's orientation is + /// horizontal, vertical, or unknown/ambiguous. + /// + /// > **Note:** Setting aria attributes on `ElementInternals` allows default + /// > semantics to be defined on a custom element. These may be overwritten by + /// > author-defined attributes, but ensure that default semantics are + /// > retained should the author delete those attributes, or fail to add them + /// > at all. For more information see the + /// > [Accessibility Object Model explainer](https://wicg.github.io/aom/explainer.html#default-semantics-for-custom-elements-via-the-elementinternals-object). + external String? get ariaOrientation; + external set ariaOrientation(String? value); + + /// The **`ariaPlaceholder`** property of the [ElementInternals] interface + /// reflects the value of the + /// [`aria-placeholder`](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-placeholder) + /// attribute, which defines a short hint intended to aid the user with data + /// entry when the control has no value. + /// + /// > **Note:** Setting aria attributes on `ElementInternals` allows default + /// > semantics to be defined on a custom element. These may be overwritten by + /// > author-defined attributes, but ensure that default semantics are + /// > retained should the author delete those attributes, or fail to add them + /// > at all. For more information see the + /// > [Accessibility Object Model explainer](https://wicg.github.io/aom/explainer.html#default-semantics-for-custom-elements-via-the-elementinternals-object). + external String? get ariaPlaceholder; + external set ariaPlaceholder(String? value); + + /// The **`ariaPosInSet`** property of the [ElementInternals] interface + /// reflects the value of the + /// [`aria-posinset`](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-posinset) + /// attribute, which defines an element's number or position in the current + /// set of listitems or treeitems. + /// + /// > **Note:** Setting aria attributes on `ElementInternals` allows default + /// > semantics to be defined on a custom element. These may be overwritten by + /// > author-defined attributes, but ensure that default semantics are + /// > retained should the author delete those attributes, or fail to add them + /// > at all. For more information see the + /// > [Accessibility Object Model explainer](https://wicg.github.io/aom/explainer.html#default-semantics-for-custom-elements-via-the-elementinternals-object). + external String? get ariaPosInSet; + external set ariaPosInSet(String? value); + + /// The **`ariaPressed`** property of the [ElementInternals] interface + /// reflects the value of the + /// [`aria-pressed`](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-pressed) + /// attribute, which indicates the current "pressed" state of toggle buttons. + /// + /// > **Note:** Setting aria attributes on `ElementInternals` allows default + /// > semantics to be defined on a custom element. These may be overwritten by + /// > author-defined attributes, but ensure that default semantics are + /// > retained should the author delete those attributes, or fail to add them + /// > at all. For more information see the + /// > [Accessibility Object Model explainer](https://wicg.github.io/aom/explainer.html#default-semantics-for-custom-elements-via-the-elementinternals-object). + external String? get ariaPressed; + external set ariaPressed(String? value); + + /// The **`ariaReadOnly`** property of the [ElementInternals] interface + /// reflects the value of the + /// [`aria-readonly`](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-readonly) + /// attribute, which indicates that the element is not editable, but is + /// otherwise operable. + /// + /// > **Note:** Setting aria attributes on `ElementInternals` allows default + /// > semantics to be defined on a custom element. These may be overwritten by + /// > author-defined attributes, but ensure that default semantics are + /// > retained should the author delete those attributes, or fail to add them + /// > at all. For more information see the + /// > [Accessibility Object Model explainer](https://wicg.github.io/aom/explainer.html#default-semantics-for-custom-elements-via-the-elementinternals-object). + external String? get ariaReadOnly; + external set ariaReadOnly(String? value); + + /// The **`ariaRequired`** property of the [Element] interface reflects the + /// value of the + /// [`aria-required`](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-required) + /// attribute, which indicates that user input is required on the element + /// before a form may be submitted. + /// + /// > **Note:** Setting aria attributes on `ElementInternals` allows default + /// > semantics to be defined on a custom element. These may be overwritten by + /// > author-defined attributes, but ensure that default semantics are + /// > retained should the author delete those attributes, or fail to add them + /// > at all. For more information see the + /// > [Accessibility Object Model explainer](https://wicg.github.io/aom/explainer.html#default-semantics-for-custom-elements-via-the-elementinternals-object). + external String? get ariaRequired; + external set ariaRequired(String? value); + + /// The **`ariaRoleDescription`** property of the [Element] interface reflects + /// the value of the + /// [`aria-roledescription`](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-roledescription) + /// attribute, which defines a human-readable, author-localized description + /// for the role of an element. + /// + /// > **Note:** Setting aria attributes on `ElementInternals` allows default + /// > semantics to be defined on a custom element. These may be overwritten by + /// > author-defined attributes, but ensure that default semantics are + /// > retained should the author delete those attributes, or fail to add them + /// > at all. For more information see the + /// > [Accessibility Object Model explainer](https://wicg.github.io/aom/explainer.html#default-semantics-for-custom-elements-via-the-elementinternals-object). + external String? get ariaRoleDescription; + external set ariaRoleDescription(String? value); + + /// The **`ariaRowCount`** property of the [ElementInternals] interface + /// reflects the value of the + /// [`aria-rowcount`](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-rowcount) + /// attribute, which defines the total number of rows in a table, grid, or + /// treegrid. + /// + /// > **Note:** Setting aria attributes on `ElementInternals` allows default + /// > semantics to be defined on a custom element. These may be overwritten by + /// > author-defined attributes, but ensure that default semantics are + /// > retained should the author delete those attributes, or fail to add them + /// > at all. For more information see the + /// > [Accessibility Object Model explainer](https://wicg.github.io/aom/explainer.html#default-semantics-for-custom-elements-via-the-elementinternals-object). + external String? get ariaRowCount; + external set ariaRowCount(String? value); + + /// The **`ariaRowIndex`** property of the [ElementInternals] interface + /// reflects the value of the + /// [`aria-rowindex`](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-rowindex) + /// attribute, which defines an element's row index or position with respect + /// to the total number of rows within a table, grid, or treegrid. + /// + /// > **Note:** Setting aria attributes on `ElementInternals` allows default + /// > semantics to be defined on a custom element. These may be overwritten by + /// > author-defined attributes, but ensure that default semantics are + /// > retained should the author delete those attributes, or fail to add them + /// > at all. For more information see the + /// > [Accessibility Object Model explainer](https://wicg.github.io/aom/explainer.html#default-semantics-for-custom-elements-via-the-elementinternals-object). + external String? get ariaRowIndex; + external set ariaRowIndex(String? value); + + /// The **`ariaRowSpan`** property of the [ElementInternals] interface + /// reflects the value of the + /// [`aria-rowspan`](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-rowspan) + /// attribute, which defines the number of rows spanned by a cell or gridcell + /// within a table, grid, or treegrid. + /// + /// > **Note:** Setting aria attributes on `ElementInternals` allows default + /// > semantics to be defined on a custom element. These may be overwritten by + /// > author-defined attributes, but ensure that default semantics are + /// > retained should the author delete those attributes, or fail to add them + /// > at all. For more information see the + /// > [Accessibility Object Model explainer](https://wicg.github.io/aom/explainer.html#default-semantics-for-custom-elements-via-the-elementinternals-object). + external String? get ariaRowSpan; + external set ariaRowSpan(String? value); + + /// The **`ariaSelected`** property of the [ElementInternals] interface + /// reflects the value of the + /// [`aria-selected`](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-selected) + /// attribute, which indicates the current "selected" state of elements that + /// have a selected state. + /// + /// > **Note:** Setting aria attributes on `ElementInternals` allows default + /// > semantics to be defined on a custom element. These may be overwritten by + /// > author-defined attributes, but ensure that default semantics are + /// > retained should the author delete those attributes, or fail to add them + /// > at all. For more information see the + /// > [Accessibility Object Model explainer](https://wicg.github.io/aom/explainer.html#default-semantics-for-custom-elements-via-the-elementinternals-object). + external String? get ariaSelected; + external set ariaSelected(String? value); + + /// The **`ariaSetSize`** property of the [ElementInternals] interface + /// reflects the value of the + /// [`aria-setsize`](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-setsize) + /// attribute, which defines the number of items in the current set of + /// listitems or treeitems. + /// + /// > **Note:** Setting aria attributes on `ElementInternals` allows default + /// > semantics to be defined on a custom element. These may be overwritten by + /// > author-defined attributes, but ensure that default semantics are + /// > retained should the author delete those attributes, or fail to add them + /// > at all. For more information see the + /// > [Accessibility Object Model explainer](https://wicg.github.io/aom/explainer.html#default-semantics-for-custom-elements-via-the-elementinternals-object). + external String? get ariaSetSize; + external set ariaSetSize(String? value); + + /// The **`ariaSort`** property of the [ElementInternals] interface reflects + /// the value of the + /// [`aria-sort`](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-sort) + /// attribute, which indicates if items in a table or grid are sorted in + /// ascending or descending order. + /// + /// > **Note:** Setting aria attributes on `ElementInternals` allows default + /// > semantics to be defined on a custom element. These may be overwritten by + /// > author-defined attributes, but ensure that default semantics are + /// > retained should the author delete those attributes, or fail to add them + /// > at all. For more information see the + /// > [Accessibility Object Model explainer](https://wicg.github.io/aom/explainer.html#default-semantics-for-custom-elements-via-the-elementinternals-object). + external String? get ariaSort; + external set ariaSort(String? value); + + /// The **`ariaValueMax`** property of the [ElementInternals] interface + /// reflects the value of the + /// [`aria-valuemax`](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-valuemax) + /// attribute, which defines the maximum allowed value for a range widget. + /// + /// > **Note:** Setting aria attributes on `ElementInternals` allows default + /// > semantics to be defined on a custom element. These may be overwritten by + /// > author-defined attributes, but ensure that default semantics are + /// > retained should the author delete those attributes, or fail to add them + /// > at all. For more information see the + /// > [Accessibility Object Model explainer](https://wicg.github.io/aom/explainer.html#default-semantics-for-custom-elements-via-the-elementinternals-object). + external String? get ariaValueMax; + external set ariaValueMax(String? value); + + /// The **`ariaValueMin`** property of the [ElementInternals] interface + /// reflects the value of the + /// [`aria-valuemin`](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-valuemin) + /// attribute, which defines the minimum allowed value for a range widget. + /// + /// > **Note:** Setting aria attributes on `ElementInternals` allows default + /// > semantics to be defined on a custom element. These may be overwritten by + /// > author-defined attributes, but ensure that default semantics are + /// > retained should the author delete those attributes, or fail to add them + /// > at all. For more information see the + /// > [Accessibility Object Model explainer](https://wicg.github.io/aom/explainer.html#default-semantics-for-custom-elements-via-the-elementinternals-object). + external String? get ariaValueMin; + external set ariaValueMin(String? value); + + /// The **`ariaValueNow`** property of the [ElementInternals] interface + /// reflects the value of the + /// [`aria-valuenow`](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-valuenow) + /// attribute, which defines the current value for a range widget. + /// + /// > **Note:** Setting aria attributes on `ElementInternals` allows default + /// > semantics to be defined on a custom element. These may be overwritten by + /// > author-defined attributes, but ensure that default semantics are + /// > retained should the author delete those attributes, or fail to add them + /// > at all. For more information see the + /// > [Accessibility Object Model explainer](https://wicg.github.io/aom/explainer.html#default-semantics-for-custom-elements-via-the-elementinternals-object). + external String? get ariaValueNow; + external set ariaValueNow(String? value); + + /// The **`ariaValueText`** property of the [ElementInternals] interface + /// reflects the value of the + /// [`aria-valuetext`](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-valuetext) + /// attribute, which defines the human-readable text alternative of + /// aria-valuenow for a range widget. + /// + /// > **Note:** Setting aria attributes on `ElementInternals` allows default + /// > semantics to be defined on a custom element. These may be overwritten by + /// > author-defined attributes, but ensure that default semantics are + /// > retained should the author delete those attributes, or fail to add them + /// > at all. For more information see the + /// > [Accessibility Object Model explainer](https://wicg.github.io/aom/explainer.html#default-semantics-for-custom-elements-via-the-elementinternals-object). + external String? get ariaValueText; + external set ariaValueText(String? value); } extension type ValidityStateFlags._(JSObject _) implements JSObject { external factory ValidityStateFlags({ @@ -8420,55 +9014,6 @@ extension type ValidityStateFlags._(JSObject _) implements JSObject { external set customError(bool value); } -/// The **`CustomStateSet`** interface of the -/// [Document Object Model](https://developer.mozilla.org/en-US/docs/Web/API/Document_Object_Model) -/// stores a list of states for an -/// [autonomous custom element](https://developer.mozilla.org/en-US/docs/Web/API/Web_components/Using_custom_elements#types_of_custom_element), -/// and allows states to be added and removed from the set. -/// -/// The interface can be used to expose the internal states of a custom element, -/// allowing them to be used in CSS selectors by code that uses the element. -/// -/// --- -/// -/// API documentation sourced from -/// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/CustomStateSet). -extension type CustomStateSet._(JSObject _) implements JSObject {} - -/// The **`VisibilityStateEntry`** interface provides timings of page visibility -/// state changes, i.e., when a tab changes from the foreground to the -/// background or vice versa. -/// -/// This can be used to pinpoint visibility changes on the performance timeline, -/// and cross-reference them against other performance entries such as -/// "first-contentful-paint" (see [PerformancePaintTiming]). -/// -/// There are two key visibility state change times that this API reports on: -/// -/// - `visible`: The time when the page becomes visible (i.e. when its tab moves -/// into the foreground). -/// - `hidden`: The time when the pages become hidden (i.e. when its tab moves -/// into the background). -/// -/// The performance timeline will always have a "`visibility-state`" entry with -/// a `startTime` of `0` and a `name` representing the initial page visibility -/// state. -/// -/// > **Note:** Like other Performance APIs, this API extends -/// > [PerformanceEntry]. -/// -/// --- -/// -/// API documentation sourced from -/// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/VisibilityStateEntry). -extension type VisibilityStateEntry._(JSObject _) - implements PerformanceEntry, JSObject { - external String get name; - external String get entryType; - external DOMHighResTimeStamp get startTime; - external int get duration; -} - /// The **`UserActivation`** interface provides information about whether a user /// is currently interacting with the page, or has completed an interaction /// since page load. @@ -8547,23 +9092,6 @@ extension type FocusOptions._(JSObject _) implements JSObject { external bool get focusVisible; external set focusVisible(bool value); } -extension type CloseWatcher._(JSObject _) implements EventTarget, JSObject { - external factory CloseWatcher([CloseWatcherOptions options]); - - external void requestClose(); - external void close(); - external void destroy(); - external EventHandler get oncancel; - external set oncancel(EventHandler value); - external EventHandler get onclose; - external set onclose(EventHandler value); -} -extension type CloseWatcherOptions._(JSObject _) implements JSObject { - external factory CloseWatcherOptions({AbortSignal signal}); - - external AbortSignal get signal; - external set signal(AbortSignal value); -} /// The **`DataTransfer`** object is used to hold the data that is being dragged /// during a drag and drop operation. It may hold one or more data items, each @@ -8878,6 +9406,7 @@ extension type DragEventInit._(JSObject _) implements MouseEventInit, JSObject { bool composed, Window? view, int detail, + JSObject? sourceCapabilities, int which, bool ctrlKey, bool shiftKey, @@ -8900,6 +9429,8 @@ extension type DragEventInit._(JSObject _) implements MouseEventInit, JSObject { int button, int buttons, EventTarget? relatedTarget, + num movementX, + num movementY, DataTransfer? dataTransfer, }); @@ -9148,6 +9679,35 @@ extension type Window._(JSObject _) implements EventTarget, JSObject { /// Releases the window from trapping events of a specific type. external void releaseEvents(); + /// The **`window.requestIdleCallback()`** method queues a function + /// to be called during a browser's idle periods. This enables developers to + /// perform + /// background and low priority work on the main event loop, without impacting + /// latency-critical events such as animation and input response. Functions + /// are generally + /// called in first-in-first-out order; however, callbacks which have a + /// `timeout` + /// specified may be called out-of-order if necessary in order to run them + /// before the + /// timeout elapses. + /// + /// You can call `requestIdleCallback()` within an idle callback function to + /// schedule another callback to take place no sooner than the next pass + /// through the event + /// loop. + /// + /// > **Note:** A `timeout` option is strongly recommended for required work, + /// > as otherwise it's possible multiple seconds will elapse before the + /// > callback is fired. + external int requestIdleCallback( + IdleRequestCallback callback, [ + IdleRequestOptions options, + ]); + + /// The **`window.cancelIdleCallback()`** method cancels a callback + /// previously scheduled with [window.requestIdleCallback]. + external void cancelIdleCallback(int handle); + /// The **`Window.getSelection()`** method returns a /// [Selection] object representing the range of text selected by the user or /// the current position of the caret. @@ -9219,6 +9779,18 @@ extension type Window._(JSObject _) implements EventTarget, JSObject { /// [window.requestAnimationFrame]. external void cancelAnimationFrame(int handle); + /// Returns the orientation in degrees (in 90-degree increments) of the + /// viewport relative to the device's natural orientation. + /// + /// Its only possible values are `-90`, `0`, `90`, and `180`. Positive values + /// are counterclockwise; negative values are clockwise. + /// + /// This property is deprecated. Use the [Screen.orientation] property + /// instead, available on the [window.screen] property. + external int get orientation; + external EventHandler get onorientationchange; + external set onorientationchange(EventHandler value); + /// The [Window] property **`screen`** returns a /// reference to the screen object associated with the window. The `screen` /// object, implementing the [Screen] interface, is a special object for @@ -9259,7 +9831,6 @@ extension type Window._(JSObject _) implements EventTarget, JSObject { /// document is scrolled vertically from the [Window.scrollY] /// property. external num get scrollX; - external num get pageXOffset; /// The read-only **`scrollY`** property /// of the [Window] interface returns the number of pixels that the document @@ -9271,7 +9842,6 @@ extension type Window._(JSObject _) implements EventTarget, JSObject { /// pixels the document is scrolled horizontally from the [Window.scrollX] /// property. external num get scrollY; - external num get pageYOffset; /// The **`Window.screenX`** read-only property returns the /// horizontal distance, in CSS pixels, of the left border of the user's @@ -9461,12 +10031,6 @@ extension type Window._(JSObject _) implements EventTarget, JSObject { /// that you should be aware of before using them. external History get history; - /// The **`navigation`** read-only property of the [Window] interface returns - /// the current `window`'s associated [Navigation] object. - /// - /// This is the entry point for the [Navigation API]. - external Navigation get navigation; - /// The **`customElements`** read-only property of the [Window] interface /// returns a reference to the [CustomElementRegistry] object, which can be /// used to register new @@ -9597,37 +10161,6 @@ extension type Window._(JSObject _) implements EventTarget, JSObject { /// about /// the application running the script. external Navigator get navigator; - external Navigator get clientInformation; - - /// The **`originAgentCluster`** read-only property of the [Window] interface - /// returns `true` if this window belongs to an _origin-keyed - /// [agent cluster](https://tc39.es/ecma262/#sec-agent-clusters)_: this means - /// that the operating system has provided dedicated resources (for example an - /// operating system process) to this window's origin that are not shared with - /// windows from other origins. - /// - /// Otherwise this property returns `false`. - /// - /// Windows that are part of an origin-keyed agent cluster are subjects to - /// some additional restrictions, compared with windows that are not. In - /// particular, they cannot: - /// - /// - Set [Document.domain], which is a legacy feature that normally allows - /// same-site cross-origin pages to synchronously access each other's DOM. - /// - Send - /// [`WebAssembly.Module`](https://developer.mozilla.org/en-US/docs/WebAssembly/JavaScript_interface/Module) - /// objects to other same-site cross-origin pages via [Window.postMessage]. - /// - Send `SharedArrayBuffer` or - /// [`WebAssembly.Memory`](https://developer.mozilla.org/en-US/docs/WebAssembly/JavaScript_interface/Memory) - /// objects to other same-site cross-origin pages. - /// - /// To request that the browser assign this window to an origin-keyed agent - /// cluster, the server must send the response header. - /// - /// Note that the origin-keyed agent cluster feature is only supported in . If - /// a site is not a secure context, the `window.originAgentCluster` will - /// always return `false`. - external bool get originAgentCluster; /// The `external` property of the [Window] API returns an instance of the /// `External` interface, which was intended to contain functions related to @@ -9635,6 +10168,10 @@ extension type Window._(JSObject _) implements EventTarget, JSObject { /// deprecated, and the contained methods are now dummy functions that do /// nothing as per spec. external External get external; + external EventHandler get onappinstalled; + external set onappinstalled(EventHandler value); + external EventHandler get onbeforeinstallprompt; + external set onbeforeinstallprompt(EventHandler value); external EventHandler get ondeviceorientation; external set ondeviceorientation(EventHandler value); external EventHandler get ondeviceorientationabsolute; @@ -9669,8 +10206,6 @@ extension type Window._(JSObject _) implements EventTarget, JSObject { external set onauxclick(EventHandler value); external EventHandler get onbeforeinput; external set onbeforeinput(EventHandler value); - external EventHandler get onbeforematch; - external set onbeforematch(EventHandler value); external EventHandler get onbeforetoggle; external set onbeforetoggle(EventHandler value); external EventHandler get onblur; @@ -9803,14 +10338,6 @@ extension type Window._(JSObject _) implements EventTarget, JSObject { external set onvolumechange(EventHandler value); external EventHandler get onwaiting; external set onwaiting(EventHandler value); - external EventHandler get onwebkitanimationend; - external set onwebkitanimationend(EventHandler value); - external EventHandler get onwebkitanimationiteration; - external set onwebkitanimationiteration(EventHandler value); - external EventHandler get onwebkitanimationstart; - external set onwebkitanimationstart(EventHandler value); - external EventHandler get onwebkittransitionend; - external set onwebkittransitionend(EventHandler value); external EventHandler get onwheel; external set onwheel(EventHandler value); external EventHandler get onpointerover; @@ -9821,8 +10348,6 @@ extension type Window._(JSObject _) implements EventTarget, JSObject { external set onpointerdown(EventHandler value); external EventHandler get onpointermove; external set onpointermove(EventHandler value); - external EventHandler get onpointerrawupdate; - external set onpointerrawupdate(EventHandler value); external EventHandler get onpointerup; external set onpointerup(EventHandler value); external EventHandler get onpointercancel; @@ -9871,8 +10396,6 @@ extension type Window._(JSObject _) implements EventTarget, JSObject { external set ononline(EventHandler value); external EventHandler get onpagehide; external set onpagehide(EventHandler value); - external EventHandler get onpagereveal; - external set onpagereveal(EventHandler value); external EventHandler get onpageshow; external set onpageshow(EventHandler value); external EventHandler get onpopstate; @@ -9891,6 +10414,7 @@ extension type Window._(JSObject _) implements EventTarget, JSObject { external String get origin; external bool get isSecureContext; external bool get crossOriginIsolated; + external Scheduler get scheduler; external CacheStorage get caches; external TrustedTypePolicyFactory get trustedTypes; @@ -10210,530 +10734,6 @@ extension type History._(JSObject _) implements JSObject { external JSAny? get state; } -/// The **`Navigation`** interface of the [Navigation API] allows control over -/// all navigation actions for the current `window` in one central place, -/// including initiating navigations programmatically, examining navigation -/// history entries, and managing navigations as they happen. -/// -/// It is accessed via the [Window.navigation] property. -/// -/// The Navigation API only exposes history entries created in the current -/// browsing context that have the same origin as the current page (e.g. not -/// navigations inside embedded `iframe`s, or cross-origin navigations), -/// providing an accurate list of all previous history entries just for your -/// app. This makes traversing the history a much less fragile proposition than -/// with the older [History API]. -/// -/// --- -/// -/// API documentation sourced from -/// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/Navigation). -extension type Navigation._(JSObject _) implements EventTarget, JSObject { - /// The **`entries()`** method of the - /// [Navigation] interface returns an array of [NavigationHistoryEntry] - /// objects representing all existing history entries. - external JSArray entries(); - - /// The **`updateCurrentEntry()`** method of the [Navigation] interface - /// updates the `state` of the [Navigation.currentEntry]; used in cases where - /// the state change will be independent of a navigation or reload. - external void updateCurrentEntry(NavigationUpdateCurrentEntryOptions options); - - /// The **`navigate()`** method of the - /// [Navigation] interface navigates to a specific URL, updating any provided - /// state in the history entries list. - external NavigationResult navigate( - String url, [ - NavigationNavigateOptions options, - ]); - - /// The **`reload()`** method of the - /// [Navigation] interface reloads the current URL, updating any provided - /// state in the history entries list. - external NavigationResult reload([NavigationReloadOptions options]); - - /// The **`traverseTo()`** method of the [Navigation] interface navigates to - /// the [NavigationHistoryEntry] identified by the given - /// [NavigationHistoryEntry.key]. - external NavigationResult traverseTo( - String key, [ - NavigationOptions options, - ]); - - /// The **`back()`** method of the - /// [Navigation] interface navigates backwards by one entry in the navigation - /// history. - external NavigationResult back([NavigationOptions options]); - - /// The **`forward()`** method of the - /// [Navigation] interface navigates forwards by one entry in the navigation - /// history. - external NavigationResult forward([NavigationOptions options]); - - /// The **`currentEntry`** read-only property of the - /// [Navigation] interface returns a [NavigationHistoryEntry] object - /// representing the location the user is currently navigated to right now. - external NavigationHistoryEntry? get currentEntry; - - /// The **`transition`** read-only property of the [Navigation] interface - /// returns a [NavigationTransition] object representing the status of an - /// in-progress navigation, which can be used to track it. - external NavigationTransition? get transition; - external NavigationActivation? get activation; - - /// The **`canGoBack`** read-only property of the - /// [Navigation] interface returns `true` - /// if it is possible to navigate backwards in the navigation history - /// (i.e. the [Navigation.currentEntry] is - /// not the first one in the history entry list), - /// and `false` if it is not. - external bool get canGoBack; - - /// The **`canGoForward`** read-only property of the - /// [Navigation] interface returns `true` if it is possible to navigate - /// forwards in the navigation history - /// (i.e. the [Navigation.currentEntry] is not the last one in the history - /// entry list), - /// and `false` if it is not. - external bool get canGoForward; - external EventHandler get onnavigate; - external set onnavigate(EventHandler value); - external EventHandler get onnavigatesuccess; - external set onnavigatesuccess(EventHandler value); - external EventHandler get onnavigateerror; - external set onnavigateerror(EventHandler value); - external EventHandler get oncurrententrychange; - external set oncurrententrychange(EventHandler value); -} -extension type NavigationUpdateCurrentEntryOptions._(JSObject _) - implements JSObject { - external factory NavigationUpdateCurrentEntryOptions({required JSAny? state}); - - external JSAny? get state; - external set state(JSAny? value); -} -extension type NavigationOptions._(JSObject _) implements JSObject { - external factory NavigationOptions({JSAny? info}); - - external JSAny? get info; - external set info(JSAny? value); -} -extension type NavigationNavigateOptions._(JSObject _) - implements NavigationOptions, JSObject { - external factory NavigationNavigateOptions({ - JSAny? info, - JSAny? state, - NavigationHistoryBehavior history, - }); - - external JSAny? get state; - external set state(JSAny? value); - external NavigationHistoryBehavior get history; - external set history(NavigationHistoryBehavior value); -} -extension type NavigationReloadOptions._(JSObject _) - implements NavigationOptions, JSObject { - external factory NavigationReloadOptions({ - JSAny? info, - JSAny? state, - }); - - external JSAny? get state; - external set state(JSAny? value); -} -extension type NavigationResult._(JSObject _) implements JSObject { - external factory NavigationResult({ - JSPromise committed, - JSPromise finished, - }); - - external JSPromise get committed; - external set committed(JSPromise value); - external JSPromise get finished; - external set finished(JSPromise value); -} - -/// The **`NavigationHistoryEntry`** interface of the [Navigation API] -/// represents a single navigation history entry. -/// -/// These objects are commonly accessed via the [Navigation.currentEntry] -/// property and [Navigation.entries] method. -/// -/// The Navigation API only exposes history entries created in the current -/// browsing context that have the same origin as the current page (e.g. not -/// navigations inside embedded `iframe`s, or cross-origin navigations), -/// providing an accurate list of all previous history entries just for your -/// app. This makes traversing the history a much less fragile proposition than -/// with the older [History API]. -/// -/// --- -/// -/// API documentation sourced from -/// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/NavigationHistoryEntry). -extension type NavigationHistoryEntry._(JSObject _) - implements EventTarget, JSObject { - /// The **`getState()`** method of the [NavigationHistoryEntry] interface - /// returns a clone of the developer-supplied state associated with this - /// history entry. - external JSAny? getState(); - - /// The **`url`** read-only property of the [NavigationHistoryEntry] interface - /// returns the absolute URL of this history entry. If the entry corresponds - /// to a different Document than the current one (like `sameDocument` property - /// is `false`), and that Document was fetched with a header set to - /// `no-referrer` or `origin`, the property returns `null`. If current - /// document is not fully active, it returns an empty string. - external String? get url; - - /// The **`key`** read-only property of the [NavigationHistoryEntry] interface - /// returns the `key` of the history entry, or an empty string if current - /// document is not fully active. This is a unique, UA-generated value that - /// represents the history entry's slot in the entries list. It is used to - /// navigate that particular slot via [Navigation.traverseTo]. The `key` will - /// be reused by other entries that replace the entry in the list (that is, if - /// the [NavigateEvent.navigationType] is `replace`). - /// - /// This differs from the [NavigationHistoryEntry.id] of a history entry. The - /// `id` is a unique, UA-generated value that always represents a specific - /// history entry rather than its slot in the entries list. This is useful to - /// correlate it with an external resource such as a storage cache. - external String get key; - - /// The **`id`** read-only property of the [NavigationHistoryEntry] interface - /// returns the `id` of the history entry, or an empty string if current - /// document is not fully active. This is a unique, UA-generated value that - /// always represents a specific history entry, useful to correlate it with an - /// external resource such as a storage cache. - /// - /// This differs from the [NavigationHistoryEntry.key] of a history entry. The - /// `key` is a unique, UA-generated value that represents the history entry's - /// slot in the entries list rather than the entry itself. It is used to - /// navigate that particular slot via [Navigation.traverseTo]. The `key` will - /// be reused by other entries that replace the entry in the list (that is, if - /// the [NavigateEvent.navigationType] is `replace`). - external String get id; - - /// The **`index`** read-only property of the [NavigationHistoryEntry] - /// interface returns the index of the history entry in the history entries - /// list (that is, the list returned by [Navigation.entries]), or `-1` if the - /// entry does not appear in the list or if current document is not fully - /// active. - external int get index; - - /// The **`sameDocument`** read-only property of the [NavigationHistoryEntry] - /// interface returns `true` if this history entry is for the same `document` - /// as the current [Document] value and current document is fully active, or - /// `false` otherwise. - external bool get sameDocument; - external EventHandler get ondispose; - external set ondispose(EventHandler value); -} - -/// The **`NavigationTransition`** interface of the [Navigation API] represents -/// an ongoing navigation, that is, a navigation that hasn't yet reached the -/// [Navigation.navigatesuccess_event] or [Navigation.navigateerror_event] -/// stage. -/// -/// It is accessed via the [Navigation.transition] property. -/// -/// --- -/// -/// API documentation sourced from -/// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/NavigationTransition). -extension type NavigationTransition._(JSObject _) implements JSObject { - /// The **`navigationType`** read-only property of the - /// [NavigationTransition] interface returns the type of the ongoing - /// navigation. - external NavigationType get navigationType; - - /// The **`from`** read-only property of the - /// [NavigationTransition] interface returns the [NavigationHistoryEntry] that - /// the transition is coming from. - external NavigationHistoryEntry get from; - - /// The **`finished`** read-only property of the - /// [NavigationTransition] interface returns a `Promise` that fulfills at the - /// same time the [Navigation.navigatesuccess_event] event fires, or rejects - /// at the same time the [Navigation.navigateerror_event] event fires. - external JSPromise get finished; -} -extension type NavigationActivation._(JSObject _) implements JSObject { - external NavigationHistoryEntry? get from; - external NavigationHistoryEntry get entry; - external NavigationType get navigationType; -} - -/// The **`NavigateEvent`** interface of the [Navigation API] is the event -/// object for the [Navigation.navigate_event] event, which fires when -/// [any type of navigation](https://github.com/WICG/navigation-api#appendix-types-of-navigations) -/// is initiated (this includes usage of [History API] features like -/// [History.go]). `NavigateEvent` provides access to information about that -/// navigation, and allows developers to intercept and control the navigation -/// handling. -/// -/// --- -/// -/// API documentation sourced from -/// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/NavigateEvent). -extension type NavigateEvent._(JSObject _) implements Event, JSObject { - external factory NavigateEvent( - String type, - NavigateEventInit eventInitDict, - ); - - /// The **`intercept()`** method of the - /// [NavigateEvent] interface intercepts this navigation, turning it into a - /// same-document navigation to the [NavigationDestination.url] URL. - external void intercept([NavigationInterceptOptions options]); - - /// The **`scroll()`** method of the - /// [NavigateEvent] interface can be called to manually trigger the - /// browser-driven scrolling behavior that occurs in response to the - /// navigation, if you want it to happen before the navigation handling has - /// completed. - external void scroll(); - - /// The **`navigationType`** read-only property of the - /// [NavigateEvent] interface returns the type of the navigation — `push`, - /// `reload`, `replace`, or `traverse`. - external NavigationType get navigationType; - - /// The **`destination`** read-only property of the - /// [NavigateEvent] interface returns a [NavigationDestination] object - /// representing the destination being navigated to. - external NavigationDestination get destination; - - /// The **`canIntercept`** read-only property of the - /// [NavigateEvent] interface returns `true` if the navigation can be - /// intercepted and have its URL rewritten, or `false` otherwise - /// - /// There are several rules around when a navigation can be intercepted. For - /// example: - /// - /// - You can't intercept cross-origin navigations. - /// - You can intercept `http` or `https` URLs if only the `path`, `query`, - /// and `fragment` portions of the new URL differ from the current URL. - /// - You can intercept `file` URLs if only the `query` and `fragment` - /// portions of the new URL differ. - /// - For other URL types you can intercept the navigation if only the - /// `fragment` portion differs. - /// - /// See the spec for more explanation on - /// [when a Document can have its URL rewritten](https://html.spec.whatwg.org/multipage/nav-history-apis.html#can-have-its-url-rewritten), - /// including a table of examples. - external bool get canIntercept; - - /// The **`userInitiated`** read-only property of the - /// [NavigateEvent] interface returns `true` if the navigation was initiated - /// by the user (e.g. by clicking a link, submitting a form, or pressing the - /// browser's "Back"/"Forward" buttons), or `false` otherwise. - /// - /// > **Note:** The table found at [Appendix: types of - /// > navigations](https://github.com/WICG/navigation-api#appendix-types-of-navigations) - /// > shows which navigation types are user-initiated. - external bool get userInitiated; - - /// The **`hashChange`** read-only property of the - /// [NavigateEvent] interface returns `true` if the navigation is a fragment - /// navigation (i.e. to a fragment identifier in the same document), or - /// `false` otherwise. - external bool get hashChange; - - /// The **`signal`** read-only property of the - /// [NavigateEvent] interface returns an [AbortSignal], which will become - /// aborted if the navigation is cancelled (e.g. by the user pressing the - /// browser's "Stop" button, or another navigation starting and thus - /// cancelling the ongoing one). - external AbortSignal get signal; - - /// The **`formData`** read-only property of the - /// [NavigateEvent] interface returns the [FormData] object representing the - /// submitted data in the case of a - /// [`POST`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/POST) - /// form submission, or `null` otherwise. - external FormData? get formData; - - /// The **`downloadRequest`** read-only property of the - /// [NavigateEvent] interface returns the filename of the file requested for - /// download, in the case of a download navigation (e.g. an `a` or `area` - /// element with a `download` attribute), or `null` otherwise. - external String? get downloadRequest; - - /// The **`info`** read-only property of the - /// [NavigateEvent] interface returns the `info` data value passed by the - /// initiating navigation operation (e.g. [Navigation.back], or - /// [Navigation.navigate]), or `undefined` if no `info` data was passed. - external JSAny? get info; - external bool get hasUAVisualTransition; -} -extension type NavigateEventInit._(JSObject _) implements EventInit, JSObject { - external factory NavigateEventInit({ - bool bubbles, - bool cancelable, - bool composed, - NavigationType navigationType, - required NavigationDestination destination, - bool canIntercept, - bool userInitiated, - bool hashChange, - required AbortSignal signal, - FormData? formData, - String? downloadRequest, - JSAny? info, - bool hasUAVisualTransition, - }); - - external NavigationType get navigationType; - external set navigationType(NavigationType value); - external NavigationDestination get destination; - external set destination(NavigationDestination value); - external bool get canIntercept; - external set canIntercept(bool value); - external bool get userInitiated; - external set userInitiated(bool value); - external bool get hashChange; - external set hashChange(bool value); - external AbortSignal get signal; - external set signal(AbortSignal value); - external FormData? get formData; - external set formData(FormData? value); - external String? get downloadRequest; - external set downloadRequest(String? value); - external JSAny? get info; - external set info(JSAny? value); - external bool get hasUAVisualTransition; - external set hasUAVisualTransition(bool value); -} -extension type NavigationInterceptOptions._(JSObject _) implements JSObject { - external factory NavigationInterceptOptions({ - NavigationInterceptHandler handler, - NavigationFocusReset focusReset, - NavigationScrollBehavior scroll, - }); - - external NavigationInterceptHandler get handler; - external set handler(NavigationInterceptHandler value); - external NavigationFocusReset get focusReset; - external set focusReset(NavigationFocusReset value); - external NavigationScrollBehavior get scroll; - external set scroll(NavigationScrollBehavior value); -} - -/// The **`NavigationDestination`** interface of the [Navigation API] represents -/// the destination being navigated to in the current navigation. -/// -/// It is accessed via the [NavigateEvent.destination] property. -/// -/// --- -/// -/// API documentation sourced from -/// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/NavigationDestination). -extension type NavigationDestination._(JSObject _) implements JSObject { - /// The **`getState()`** method of the - /// [NavigationDestination] interface returns a clone of the - /// developer-supplied state associated with the destination - /// [NavigationHistoryEntry], or navigation operation (e.g. - /// [Navigation.navigate]) as appropriate. - external JSAny? getState(); - - /// The **`url`** read-only property of the - /// [NavigationDestination] interface returns the URL being navigated to. - external String get url; - - /// The **`key`** read-only property of the - /// [NavigationDestination] interface returns the [NavigationHistoryEntry.key] - /// value of the destination [NavigationHistoryEntry] if the - /// [NavigateEvent.navigationType] is `traverse`, or an empty string - /// otherwise. - /// - /// The `key` is a unique, UA-generated value that represents the history - /// entry's slot in the history entries list, used to navigate to this place - /// in the history via [Navigation.traverseTo]. It will be reused by other - /// entries that replace the entry in the list (i.e. if the - /// [NavigateEvent.navigationType] is `replace`). - external String get key; - - /// The **`id`** read-only property of the - /// [NavigationDestination] interface returns the [NavigationHistoryEntry.id] - /// value of the destination [NavigationHistoryEntry] if the - /// [NavigateEvent.navigationType] is `traverse`, or an empty string - /// otherwise. - /// - /// The `id` is a unique, UA-generated value that always represents the - /// history entry, useful to correlate a history entry with an external - /// resource such as a storage cache. - external String get id; - - /// The **`index`** read-only property of the - /// [NavigationDestination] interface returns the - /// [NavigationHistoryEntry.index] value of the destination - /// [NavigationHistoryEntry] if the [NavigateEvent.navigationType] is - /// `traverse`, or `-1` otherwise. - external int get index; - - /// The **`sameDocument`** read-only property of the - /// [NavigationDestination] interface returns `true` if the navigation is to - /// the same `document` as the current [Document] value, or `false` otherwise. - /// - /// This is useful for checking whether the navigation will be same-document - /// or cross-document. - external bool get sameDocument; -} - -/// The **`NavigationCurrentEntryChangeEvent`** interface of the -/// [Navigation API] is the event object for the -/// [Navigation.currententrychange_event] event, which fires when the -/// [Navigation.currentEntry] has changed. -/// -/// This event will fire for same-document navigations (e.g. [Navigation.back] -/// or [Navigation.traverseTo]), replacements (i.e. a [Navigation.navigate] call -/// with `history` set to `replace`), or other calls that change the entry's -/// state (e.g. [Navigation.updateCurrentEntry], or the [History API]'s -/// [History.replaceState]). -/// -/// This event fires after the navigation is committed, meaning that the visible -/// URL has changed and the [NavigationHistoryEntry] update has occurred. It is -/// useful for migrating from usage of older API features like the -/// [Window.hashchange_event] or [Window.popstate_event] events. -/// -/// --- -/// -/// API documentation sourced from -/// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/NavigationCurrentEntryChangeEvent). -extension type NavigationCurrentEntryChangeEvent._(JSObject _) - implements Event, JSObject { - external factory NavigationCurrentEntryChangeEvent( - String type, - NavigationCurrentEntryChangeEventInit eventInitDict, - ); - - /// The **`navigationType`** read-only property of the - /// [NavigationCurrentEntryChangeEvent] interface returns the type of the - /// navigation that resulted in the change. The property may be `null` if the - /// change occurs due to [Navigation.updateCurrentEntry]. - external NavigationType? get navigationType; - - /// The **`from`** read-only property of the - /// [NavigationCurrentEntryChangeEvent] interface returns the - /// [NavigationHistoryEntry] that was navigated from. - external NavigationHistoryEntry get from; -} -extension type NavigationCurrentEntryChangeEventInit._(JSObject _) - implements EventInit, JSObject { - external factory NavigationCurrentEntryChangeEventInit({ - bool bubbles, - bool cancelable, - bool composed, - NavigationType? navigationType, - required NavigationHistoryEntry from, - }); - - external NavigationType? get navigationType; - external set navigationType(NavigationType? value); - external NavigationHistoryEntry get from; - external set from(NavigationHistoryEntry value); -} - /// **`PopStateEvent`** is an interface for the /// [`popstate`](https://developer.mozilla.org/en-US/docs/Web/API/Window/popstate_event) /// event. @@ -10762,7 +10762,6 @@ extension type PopStateEvent._(JSObject _) implements Event, JSObject { /// Practically it is a value provided by the call to [history.pushState] or /// [history.replaceState] external JSAny? get state; - external bool get hasUAVisualTransition; } extension type PopStateEventInit._(JSObject _) implements EventInit, JSObject { external factory PopStateEventInit({ @@ -10820,26 +10819,6 @@ extension type HashChangeEventInit._(JSObject _) external String get newURL; external set newURL(String value); } -extension type PageRevealEvent._(JSObject _) implements Event, JSObject { - external factory PageRevealEvent( - String type, [ - PageRevealEventInit eventInitDict, - ]); - - external ViewTransition? get viewTransition; -} -extension type PageRevealEventInit._(JSObject _) - implements EventInit, JSObject { - external factory PageRevealEventInit({ - bool bubbles, - bool cancelable, - bool composed, - ViewTransition? viewTransition, - }); - - external ViewTransition? get viewTransition; - external set viewTransition(ViewTransition? value); -} /// The **`PageTransitionEvent`** event object is available inside handler /// functions for the @@ -11044,6 +11023,43 @@ extension type DOMParser._(JSObject _) implements JSObject { /// API documentation sourced from /// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/Navigator). extension type Navigator._(JSObject _) implements JSObject { + /// The **`getBattery()`** method provides information about the system's + /// battery. + /// It returns a battery promise, which resolves with a [BatteryManager] + /// object providing some properties to get the battery status also some + /// events you can handle to monitor the battery status. + /// This implements the [Battery Status API]; see that documentation for + /// additional details, a guide to using the API, and sample code. + /// + /// Since Chrome 103, the `Navigator.getBattery()` method of + /// [Battery Status API] only expose to secure context. + /// + /// > **Note:** Access to this feature may be controlled by the directive . + external JSPromise getBattery(); + + /// The **`navigator.sendBeacon()`** + /// method sends an + /// [HTTP POST](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/POST) + /// request containing a small amount of data to a web server. + /// + /// It's intended to be used for + /// sending analytics data to a web server, and avoids some of the problems + /// with + /// legacy techniques for sending analytics, such as the use of + /// [XMLHttpRequest]. + /// + /// > **Note:** For use cases that need the ability to send requests with + /// > methods other than `POST`, or to change any request properties, or that + /// > need access to the server response, instead use the + /// > [`fetch()`](https://developer.mozilla.org/en-US/docs/Web/API/fetch) + /// > method with + /// > [`keepalive`](https://developer.mozilla.org/en-US/docs/Web/API/fetch#keepalive) + /// > set to true. + external bool sendBeacon( + String url, [ + BodyInit? data, + ]); + /// The **`Navigator.requestMediaKeySystemAccess()`** method /// returns a `Promise` which delivers a [MediaKeySystemAccess] /// object that can be used to access a particular media key system, which can @@ -11114,6 +11130,70 @@ extension type Navigator._(JSObject _) implements JSObject { /// implementation. external bool vibrate(VibratePattern pattern); + /// The **`navigator.share()`** method of the + /// [Web Share API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Share_API) + /// invokes the native sharing mechanism of the device to share data such as + /// text, URLs, or files. The available _share targets_ depend on the device, + /// but might include the clipboard, contacts and email applications, + /// websites, Bluetooth, etc. + /// + /// The method resolves a `Promise` with `undefined`. + /// On Windows this happens when the share popup is launched, while on Android + /// the promise resolves once the data has successfully been passed to the + /// _share target_. + external JSPromise share([ShareData data]); + + /// The **`Navigator.canShare()`** method of the + /// [Web Share API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Share_API) + /// returns `true` if the equivalent call to [navigator.share] would succeed. + /// + /// The method returns `false` if the data cannot be _validated_. Reasons the + /// data might be invalid include: + /// + /// - The `data` parameter has been omitted or only contains properties with + /// unknown values. Note that any properties that are not recognized by the + /// user agent are ignored. + /// - A URL is badly formatted. + /// - Files are specified but the implementation does not support file + /// sharing. + /// - Sharing the specified data would be considered a "hostile share" by the + /// user-agent. + /// + /// The Web Share API is gated by the + /// [web-share](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Permissions-Policy/web-share) + /// permission policy. + /// The **`canShare()`** method will return `false` if the permission is + /// supported but has not been granted. + external bool canShare([ShareData data]); + + /// The **`requestMIDIAccess()`** method of the [Navigator] interface returns + /// a `Promise` representing a request for access to MIDI devices on a user's + /// system. + /// This method is part of the + /// [Web MIDI API](https://developer.mozilla.org/en-US/docs/Web/API/Web_MIDI_API), + /// which provides a means for accessing, enumerating, and manipulating MIDI + /// devices. + /// + /// This method may prompt the user for access to MIDI devices available to + /// their system, or it may use a previously established preference to grant + /// or deny access. + /// If permission is granted then the `Promise` resolves and a + /// [`MIDIAccess`](https://developer.mozilla.org/en-US/docs/Web/API/MIDIAccess) + /// object is returned. + external JSPromise requestMIDIAccess([MIDIOptions options]); + + /// The **`setAppBadge()`** method of the [Navigator] interface sets a badge + /// on the icon associated with this app. If a value is passed to the method, + /// this will be set as the value of the badge. Otherwise the badge will + /// display as a dot, or other indicator as defined by the platform. + external JSPromise setAppBadge([int contents]); + + /// The **`clearAppBadge()`** method of the [Navigator] interface clears a + /// badge on the current app's icon by setting it to `nothing`. The value + /// `nothing` indicates that no badge is currently set, and the status of the + /// badge is _cleared_. + external JSPromise clearAppBadge(); + /// The **`Navigator.taintEnabled()`** method always returns /// `false`. /// @@ -11229,6 +11309,13 @@ extension type Navigator._(JSObject _) implements JSObject { /// contact points are supported by the current device. external int get maxTouchPoints; + /// The `presentation` read-only property of [Navigator] serves as the entry + /// point for the + /// [Presentation API](https://developer.mozilla.org/en-US/docs/Web/API/Presentation_API) + /// and + /// returns a reference to [Presentation] object. + external JSObject get presentation; + /// The **`wakeLock`** read-only property of the [Navigator] interface returns /// a [WakeLock] interface that allows a document to acquire a screen wake /// lock. @@ -11246,6 +11333,42 @@ extension type Navigator._(JSObject _) implements JSObject { /// The feature may not be available in private mode. external ServiceWorkerContainer get serviceWorker; + /// The **`usb`** read-only property of the [Navigator] interface returns a + /// [USB] object for the current document, providing access to + /// [WebUSB API](https://developer.mozilla.org/en-US/docs/Web/API/WebUSB_API) + /// functionality. + external JSObject get usb; + + /// The **`windowControlsOverlay`** read-only property of the [Navigator] + /// interface returns the [WindowControlsOverlay] interface, which exposes + /// information about the title bar geometry in desktop Progressive Web Apps + /// that use the + /// [Window Controls Overlay API](https://developer.mozilla.org/en-US/docs/Web/API/Window_Controls_Overlay_API). + /// + /// Progressive Web Apps installed on desktop Operating Systems can opt-in to + /// the + /// Window Controls Overlay feature by using the `window-controls-overlay` + /// value in the + /// [`display_override`](https://developer.mozilla.org/en-US/docs/Web/Manifest/display_override) + /// web app manifest member. + /// + /// Doing so hides the default window title bar and gives the app access to + /// the full area + /// of the app window. + external JSObject get windowControlsOverlay; + + /// The **`deviceMemory`** read-only + /// property of the [Navigator] interface returns the approximate amount of + /// device memory in gigabytes. + /// + /// The reported value is imprecise to curtail . It's approximated by + /// rounding down to the nearest power of 2, then dividing that number by + /// 1024. It is then + /// clamped within lower and upper bounds to protect the privacy of owners of + /// very low-memory or + /// high-memory devices. + external num get deviceMemory; + /// The value of the **`Navigator.appCodeName`** property is /// always "`Mozilla`", in any browser. This property is kept only for /// compatibility purposes. @@ -11492,6 +11615,27 @@ extension type Navigator._(JSObject _) implements JSObject { /// which provides methods for requesting a new [Lock] object and querying /// for an existing `Lock` object. external LockManager get locks; + + /// The **`webdriver`** read-only property + /// of the [navigator] interface indicates whether the user agent is + /// controlled by automation. + /// + /// It defines a standard way for co-operating user agents to inform the + /// document that it + /// is controlled by + /// [WebDriver](https://developer.mozilla.org/en-US/docs/Web/WebDriver), for + /// example, so that + /// alternate code paths can be triggered during automation. + /// + /// The `navigator.webdriver` property is true when in: + /// + /// - Chrome + /// - : The `--enable-automation` or the `--headless` flag or the + /// `--remote-debugging-port` is used. + /// - Firefox + /// - : The `marionette.enabled` preference or `--marionette` flag is + /// passed. + external bool get webdriver; } /// The `PluginArray` interface is used to store a list of [Plugin] objects @@ -12028,6 +12172,7 @@ extension type WorkerGlobalScope._(JSObject _) external String get origin; external bool get isSecureContext; external bool get crossOriginIsolated; + external Scheduler get scheduler; external CacheStorage get caches; external TrustedTypePolicyFactory get trustedTypes; } @@ -12266,8 +12411,6 @@ extension type SharedWorker._(JSObject _) implements EventTarget, JSObject { /// API documentation sourced from /// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/WorkerNavigator). extension type WorkerNavigator._(JSObject _) implements JSObject { - external bool taintEnabled(); - /// The read-only **`WorkerNavigator.mediaCapabilities`** property /// returns a [MediaCapabilities] object that can expose information about the /// decoding and encoding capabilities for a given format and output @@ -12291,6 +12434,25 @@ extension type WorkerNavigator._(JSObject _) implements JSObject { /// The feature may not be available in private mode. external ServiceWorkerContainer get serviceWorker; + /// The **`usb`** read-only property of the [WorkerNavigator] interface + /// returns a [USB] object for the current document, providing access to + /// [WebUSB API](https://developer.mozilla.org/en-US/docs/Web/API/WebUSB_API) + /// functionality. + external JSObject get usb; + + /// The **`deviceMemory`** read-only + /// property of the [WorkerNavigator] interface returns the approximate amount + /// of + /// device memory in gigabytes. + /// + /// The reported value is imprecise to curtail . It's approximated by + /// rounding down to the nearest power of 2, then dividing that number by + /// 1024. It is then + /// clamped within lower and upper bounds to protect the privacy of owners of + /// very low-memory or + /// high-memory devices. + external num get deviceMemory; + /// The value of the **`WorkerNavigator.appCodeName`** property is /// always "`Mozilla`", in any browser. This property is kept only for /// compatibility purposes. @@ -12329,7 +12491,6 @@ extension type WorkerNavigator._(JSObject _) implements JSObject { /// > **Note:** Do not rely on this property to return a real product name. /// > All browsers return "`Gecko`" as the value of this property. external String get product; - external String get productSub; /// The **`WorkerNavigator.userAgent`** read-only property returns the /// user agent string for the current browser. @@ -12364,9 +12525,6 @@ extension type WorkerNavigator._(JSObject _) implements JSObject { /// - Opera 6+ allows users to set the browser identification string via a /// menu. external String get userAgent; - external String get vendor; - external String get vendorSub; - external String get oscpu; /// The **`WorkerNavigator.language`** read-only property returns /// a string representing the preferred language of the user, usually the @@ -12427,6 +12585,15 @@ extension type WorkerNavigator._(JSObject _) implements JSObject { /// computer. external int get hardwareConcurrency; + /// The **`WorkerNavigator.connection`** read-only property returns + /// a [NetworkInformation] object containing information about the system's + /// connection, such as the current bandwidth of the user's device or whether + /// the connection + /// is metered. This could be used to select high definition content or low + /// definition + /// content based on the user's connection. + external JSObject get connection; + /// The **`storage`** read-only property of the [WorkerNavigator] interface /// returns the singleton [StorageManager] object used to /// access the overall storage capabilities of the browser for the current @@ -12759,8 +12926,6 @@ extension type HTMLFrameSetElement._(JSObject _) external set ononline(EventHandler value); external EventHandler get onpagehide; external set onpagehide(EventHandler value); - external EventHandler get onpagereveal; - external set onpagereveal(EventHandler value); external EventHandler get onpageshow; external set onpageshow(EventHandler value); external EventHandler get onpopstate; diff --git a/lib/src/dom/image_capture.dart b/lib/src/dom/image_capture.dart new file mode 100644 index 00000000..7324d5e8 --- /dev/null +++ b/lib/src/dom/image_capture.dart @@ -0,0 +1,52 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. +// +// API docs from [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web). +// Attributions and copyright licensing by Mozilla Contributors is licensed +// under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/. + +// Generated from Web IDL definitions. + +@JS() +library; + +import 'dart:js_interop'; + +typedef ConstrainPoint2D = JSObject; +extension type MediaSettingsRange._(JSObject _) implements JSObject { + external factory MediaSettingsRange({ + num max, + num min, + num step, + }); + + external num get max; + external set max(num value); + external num get min; + external set min(num value); + external num get step; + external set step(num value); +} +extension type ConstrainPoint2DParameters._(JSObject _) implements JSObject { + external factory ConstrainPoint2DParameters({ + JSArray exact, + JSArray ideal, + }); + + external JSArray get exact; + external set exact(JSArray value); + external JSArray get ideal; + external set ideal(JSArray value); +} +extension type Point2D._(JSObject _) implements JSObject { + external factory Point2D({ + num x, + num y, + }); + + external num get x; + external set x(num value); + external num get y; + external set y(num value); +} diff --git a/lib/src/dom/intersection_observer.dart b/lib/src/dom/intersection_observer.dart index 126d526f..512ffd55 100644 --- a/lib/src/dom/intersection_observer.dart +++ b/lib/src/dom/intersection_observer.dart @@ -132,7 +132,6 @@ extension type IntersectionObserver._(JSObject _) implements JSObject { /// for a more in-depth look at the root margin and how it works with /// the root's bounding box. external String get rootMargin; - external String get scrollMargin; /// The [IntersectionObserver] interface's read-only /// **`thresholds`** property returns the list of intersection @@ -163,9 +162,6 @@ extension type IntersectionObserver._(JSObject _) implements JSObject { /// API documentation sourced from /// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/IntersectionObserverEntry). extension type IntersectionObserverEntry._(JSObject _) implements JSObject { - external factory IntersectionObserverEntry( - IntersectionObserverEntryInit intersectionObserverEntryInit); - /// The [IntersectionObserverEntry] interface's /// read-only **`time`** property is a /// [DOMHighResTimeStamp] that indicates the time at which the intersection @@ -216,32 +212,6 @@ extension type IntersectionObserverEntry._(JSObject _) implements JSObject { /// root. external Element get target; } -extension type IntersectionObserverEntryInit._(JSObject _) implements JSObject { - external factory IntersectionObserverEntryInit({ - required DOMHighResTimeStamp time, - required DOMRectInit? rootBounds, - required DOMRectInit boundingClientRect, - required DOMRectInit intersectionRect, - required bool isIntersecting, - required num intersectionRatio, - required Element target, - }); - - external DOMHighResTimeStamp get time; - external set time(DOMHighResTimeStamp value); - external DOMRectInit? get rootBounds; - external set rootBounds(DOMRectInit? value); - external DOMRectInit get boundingClientRect; - external set boundingClientRect(DOMRectInit value); - external DOMRectInit get intersectionRect; - external set intersectionRect(DOMRectInit value); - external bool get isIntersecting; - external set isIntersecting(bool value); - external num get intersectionRatio; - external set intersectionRatio(num value); - external Element get target; - external set target(Element value); -} extension type IntersectionObserverInit._(JSObject _) implements JSObject { external factory IntersectionObserverInit({ JSObject? root, diff --git a/lib/src/dom/khr_parallel_shader_compile.dart b/lib/src/dom/khr_parallel_shader_compile.dart new file mode 100644 index 00000000..b98c82b2 --- /dev/null +++ b/lib/src/dom/khr_parallel_shader_compile.dart @@ -0,0 +1,20 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. +// +// API docs from [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web). +// Attributions and copyright licensing by Mozilla Contributors is licensed +// under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/. + +// Generated from Web IDL definitions. + +@JS() +library; + +import 'dart:js_interop'; + +import 'webgl1.dart'; + +extension type KHR_parallel_shader_compile._(JSObject _) implements JSObject { + external static GLenum get COMPLETION_STATUS_KHR; +} diff --git a/lib/src/dom/largest_contentful_paint.dart b/lib/src/dom/largest_contentful_paint.dart new file mode 100644 index 00000000..4d78d987 --- /dev/null +++ b/lib/src/dom/largest_contentful_paint.dart @@ -0,0 +1,61 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. +// +// API docs from [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web). +// Attributions and copyright licensing by Mozilla Contributors is licensed +// under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/. + +// Generated from Web IDL definitions. + +@JS() +library; + +import 'dart:js_interop'; + +import 'dom.dart'; +import 'hr_time.dart'; +import 'performance_timeline.dart'; + +/// The `LargestContentfulPaint` interface provides timing information about the +/// largest image or text paint before user input on a web page. +/// +/// --- +/// +/// API documentation sourced from +/// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/LargestContentfulPaint). +extension type LargestContentfulPaint._(JSObject _) + implements PerformanceEntry, JSObject { + /// The **`toJSON()`** method of the [LargestContentfulPaint] interface is a ; + /// it returns a JSON representation of the [LargestContentfulPaint] object. + external JSObject toJSON(); + + /// The **`renderTime`** read-only property of the [LargestContentfulPaint] + /// interface represents the time that the element was rendered to the screen. + external DOMHighResTimeStamp get renderTime; + + /// The **`loadTime`** read-only property of the [LargestContentfulPaint] + /// interface returns the time that the element was loaded. + external DOMHighResTimeStamp get loadTime; + + /// The **`size`** read-only property of the [LargestContentfulPaint] + /// interface returns the intrinsic size of the element that is the largest + /// contentful paint. + /// + /// The `size` of the element is the `width` times `height` of the + /// [DOMRectReadOnly] that this element creates on the screen. + external int get size; + + /// The **`id`** read-only property of the [LargestContentfulPaint] interface + /// returns the ID of the element that is the largest contentful paint. + external String get id; + + /// The **`url`** read-only property of the [LargestContentfulPaint] interface + /// returns the request URL of the element, if the element is an image. + external String get url; + + /// The **`element`** read-only property of the [LargestContentfulPaint] + /// interface returns an object representing the [Element] that is the largest + /// contentful paint. + external Element? get element; +} diff --git a/lib/src/dom/mathml_core.dart b/lib/src/dom/mathml_core.dart index 9db12244..fbfe5b2b 100644 --- a/lib/src/dom/mathml_core.dart +++ b/lib/src/dom/mathml_core.dart @@ -302,8 +302,6 @@ extension type MathMLElement._(JSObject _) implements Element, JSObject { external set onauxclick(EventHandler value); external EventHandler get onbeforeinput; external set onbeforeinput(EventHandler value); - external EventHandler get onbeforematch; - external set onbeforematch(EventHandler value); external EventHandler get onbeforetoggle; external set onbeforetoggle(EventHandler value); external EventHandler get onblur; @@ -436,14 +434,6 @@ extension type MathMLElement._(JSObject _) implements Element, JSObject { external set onvolumechange(EventHandler value); external EventHandler get onwaiting; external set onwaiting(EventHandler value); - external EventHandler get onwebkitanimationend; - external set onwebkitanimationend(EventHandler value); - external EventHandler get onwebkitanimationiteration; - external set onwebkitanimationiteration(EventHandler value); - external EventHandler get onwebkitanimationstart; - external set onwebkitanimationstart(EventHandler value); - external EventHandler get onwebkittransitionend; - external set onwebkittransitionend(EventHandler value); external EventHandler get onwheel; external set onwheel(EventHandler value); external EventHandler get onpointerover; @@ -454,8 +444,6 @@ extension type MathMLElement._(JSObject _) implements Element, JSObject { external set onpointerdown(EventHandler value); external EventHandler get onpointermove; external set onpointermove(EventHandler value); - external EventHandler get onpointerrawupdate; - external set onpointerrawupdate(EventHandler value); external EventHandler get onpointerup; external set onpointerup(EventHandler value); external EventHandler get onpointercancel; diff --git a/lib/src/dom/media_source.dart b/lib/src/dom/media_source.dart index ed7bc40b..aa62f0c8 100644 --- a/lib/src/dom/media_source.dart +++ b/lib/src/dom/media_source.dart @@ -34,7 +34,6 @@ extension type MediaSource._(JSObject _) implements EventTarget, JSObject { external factory MediaSource(); external static bool isTypeSupported(String type); - external static bool get canConstructInDedicatedWorker; /// The **`addSourceBuffer()`** method of the /// [MediaSource] interface creates a new [SourceBuffer] of the @@ -65,23 +64,6 @@ extension type MediaSource._(JSObject _) implements EventTarget, JSObject { /// to [MediaSource.setLiveSeekableRange]. external void clearLiveSeekableRange(); - /// The **`handle`** read-only property of the [MediaSource] interface returns - /// a [MediaSourceHandle] object, a proxy for the `MediaSource` that can be - /// transferred from a dedicated worker back to the main thread and attached - /// to a media element via its [HTMLMediaElement.srcObject] property. - /// - /// > **Note:** `handle` is only visible on [MediaSource] instances inside - /// > dedicated workers. - /// - /// Each `MediaSource` object created inside a dedicated worker has its own - /// distinct `MediaSourceHandle`. The `handle` getter will always return the - /// `MediaSourceHandle` instance specific to the associated dedicated worker - /// `MediaSource` instance. If the handle has already been transferred to the - /// main thread using [DedicatedWorkerGlobalScope.postMessage], the handle - /// instance in the worker is technically detached and can't be transferred - /// again. - external MediaSourceHandle get handle; - /// The **`sourceBuffers`** read-only property of the /// [MediaSource] interface returns a [SourceBufferList] object /// containing the list of [SourceBuffer] objects associated with this @@ -119,29 +101,6 @@ extension type MediaSource._(JSObject _) implements EventTarget, JSObject { external set onsourceclose(EventHandler value); } -/// The **`MediaSourceHandle`** interface of the [Media Source Extensions API] -/// is a proxy for a [MediaSource] that can be transferred from a dedicated -/// worker back to the main thread and attached to a media element via its -/// [HTMLMediaElement.srcObject] property. `MediaSource` objects are not -/// transferable because they are event targets, hence the need for -/// `MediaSourceHandle`s. -/// -/// It can be accessed via the [MediaSource.handle] property. -/// -/// Each `MediaSource` object created inside a dedicated worker has its own -/// distinct `MediaSourceHandle`. The `MediaSource.handle` getter will always -/// return the `MediaSourceHandle` instance specific to the associated dedicated -/// worker `MediaSource` instance. If the handle has already been transferred to -/// the main thread using [DedicatedWorkerGlobalScope.postMessage], the handle -/// instance in the worker is technically detached and can't be transferred -/// again. -/// -/// --- -/// -/// API documentation sourced from -/// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/MediaSourceHandle). -extension type MediaSourceHandle._(JSObject _) implements JSObject {} - /// The **`SourceBuffer`** interface represents a chunk of media to be passed /// into an [HTMLMediaElement] and played, via a [MediaSource] object. This can /// be made up of one or several media segments. @@ -251,11 +210,6 @@ extension type SourceBuffer._(JSObject _) implements EventTarget, JSObject { /// contained inside the `SourceBuffer`. external VideoTrackList get videoTracks; - /// The **`textTracks`** read-only property of the - /// [SourceBuffer] interface returns a list of the text tracks currently - /// contained inside the `SourceBuffer`. - external TextTrackList get textTracks; - /// The **`appendWindowStart`** property of the /// [SourceBuffer] interface controls the timestamp for the start of the /// [append window](https://w3c.github.io/media-source/#append-window), a @@ -319,42 +273,3 @@ extension type SourceBufferList._(JSObject _) implements EventTarget, JSObject { external EventHandler get onremovesourcebuffer; external set onremovesourcebuffer(EventHandler value); } -extension type ManagedMediaSource._(JSObject _) - implements MediaSource, JSObject { - external factory ManagedMediaSource(); - - external bool get streaming; - external EventHandler get onstartstreaming; - external set onstartstreaming(EventHandler value); - external EventHandler get onendstreaming; - external set onendstreaming(EventHandler value); -} -extension type BufferedChangeEvent._(JSObject _) implements Event, JSObject { - external factory BufferedChangeEvent( - String type, [ - BufferedChangeEventInit eventInitDict, - ]); - - external TimeRanges get addedRanges; - external TimeRanges get removedRanges; -} -extension type BufferedChangeEventInit._(JSObject _) - implements EventInit, JSObject { - external factory BufferedChangeEventInit({ - bool bubbles, - bool cancelable, - bool composed, - TimeRanges addedRanges, - TimeRanges removedRanges, - }); - - external TimeRanges get addedRanges; - external set addedRanges(TimeRanges value); - external TimeRanges get removedRanges; - external set removedRanges(TimeRanges value); -} -extension type ManagedSourceBuffer._(JSObject _) - implements SourceBuffer, JSObject { - external EventHandler get onbufferedchange; - external set onbufferedchange(EventHandler value); -} diff --git a/lib/src/dom/mediacapture_fromelement.dart b/lib/src/dom/mediacapture_fromelement.dart new file mode 100644 index 00000000..3336b1da --- /dev/null +++ b/lib/src/dom/mediacapture_fromelement.dart @@ -0,0 +1,49 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. +// +// API docs from [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web). +// Attributions and copyright licensing by Mozilla Contributors is licensed +// under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/. + +// Generated from Web IDL definitions. + +@JS() +library; + +import 'dart:js_interop'; + +import 'html.dart'; +import 'mediacapture_streams.dart'; + +/// The **`CanvasCaptureMediaStreamTrack`** interface of the +/// [Media Capture and Streams API] represents the video track contained in a +/// [MediaStream] being generated from a `canvas` following a call to +/// [HTMLCanvasElement.captureStream]. +/// +/// --- +/// +/// API documentation sourced from +/// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/CanvasCaptureMediaStreamTrack). +extension type CanvasCaptureMediaStreamTrack._(JSObject _) + implements MediaStreamTrack, JSObject { + /// The **`requestFrame()`** method of the [CanvasCaptureMediaStreamTrack] + /// interface requests that a frame be captured from the canvas and sent to + /// the stream. + /// + /// Applications that need to carefully control + /// the timing of rendering and frame capture can use `requestFrame()` to + /// directly specify when it's time to capture a frame. + /// + /// To prevent automatic capture of frames, so that frames are only captured + /// when + /// `requestFrame()` is called, specify a value of 0 for the + /// [HTMLCanvasElement.captureStream] method when creating + /// the stream. + external void requestFrame(); + + /// The **`canvas`** read-only property of the [CanvasCaptureMediaStreamTrack] + /// interface returns the [HTMLCanvasElement] from which frames are being + /// captured. + external HTMLCanvasElement get canvas; +} diff --git a/lib/src/dom/mediacapture_streams.dart b/lib/src/dom/mediacapture_streams.dart index 4fad4972..f2560dad 100644 --- a/lib/src/dom/mediacapture_streams.dart +++ b/lib/src/dom/mediacapture_streams.dart @@ -15,7 +15,8 @@ import 'dart:js_interop'; import 'dom.dart'; import 'html.dart'; -import 'permissions.dart'; +import 'image_capture.dart'; +import 'screen_capture.dart'; import 'webidl.dart'; typedef ConstrainULong = JSAny; @@ -25,8 +26,6 @@ typedef ConstrainDOMString = JSAny; typedef NavigatorUserMediaSuccessCallback = JSFunction; typedef NavigatorUserMediaErrorCallback = JSFunction; typedef MediaStreamTrackState = String; -typedef VideoFacingModeEnum = String; -typedef VideoResizeModeEnum = String; typedef MediaDeviceKind = String; /// The **`MediaStream`** interface of the [Media Capture and Streams API] @@ -276,6 +275,12 @@ extension type MediaStreamTrack._(JSObject _) implements EventTarget, JSObject { external MediaStreamTrackState get readyState; external EventHandler get onended; external set onended(EventHandler value); + + /// The **`contentHint`** property of the [MediaStreamTrack] interface is a + /// string that hints at the type of content the track contains. Allowable + /// values depend on the value of the [MediaStreamTrack.kind] property. + external String get contentHint; + external set contentHint(String value); } /// The **`MediaTrackSupportedConstraints`** dictionary establishes the list of @@ -321,6 +326,28 @@ extension type MediaTrackSupportedConstraints._(JSObject _) bool channelCount, bool deviceId, bool groupId, + bool whiteBalanceMode, + bool exposureMode, + bool focusMode, + bool pointsOfInterest, + bool exposureCompensation, + bool exposureTime, + bool colorTemperature, + bool iso, + bool brightness, + bool contrast, + bool pan, + bool saturation, + bool sharpness, + bool focusDistance, + bool tilt, + bool zoom, + bool torch, + bool displaySurface, + bool logicalSurface, + bool cursor, + bool restrictOwnAudio, + bool suppressLocalAudioPlayback, }); /// The [MediaTrackSupportedConstraints] dictionary's @@ -532,6 +559,74 @@ extension type MediaTrackSupportedConstraints._(JSObject _) /// `navigator.mediaDevices.getSupportedConstraints()`. external bool get groupId; external set groupId(bool value); + external bool get whiteBalanceMode; + external set whiteBalanceMode(bool value); + external bool get exposureMode; + external set exposureMode(bool value); + external bool get focusMode; + external set focusMode(bool value); + external bool get pointsOfInterest; + external set pointsOfInterest(bool value); + external bool get exposureCompensation; + external set exposureCompensation(bool value); + external bool get exposureTime; + external set exposureTime(bool value); + external bool get colorTemperature; + external set colorTemperature(bool value); + external bool get iso; + external set iso(bool value); + external bool get brightness; + external set brightness(bool value); + external bool get contrast; + external set contrast(bool value); + external bool get pan; + external set pan(bool value); + external bool get saturation; + external set saturation(bool value); + external bool get sharpness; + external set sharpness(bool value); + external bool get focusDistance; + external set focusDistance(bool value); + external bool get tilt; + external set tilt(bool value); + external bool get zoom; + external set zoom(bool value); + external bool get torch; + external set torch(bool value); + + /// The [MediaTrackSupportedConstraints] dictionary's **`displaySurface`** + /// property indicates whether or not the + /// [MediaTrackConstraints.displaySurface] constraint is supported by the user + /// agent and the device on which the content is being used. + /// + /// The supported constraints list is obtained by calling + /// [MediaDevices.getSupportedConstraints]. + external bool get displaySurface; + external set displaySurface(bool value); + + /// The [MediaTrackSupportedConstraints] dictionary's **`logicalSurface`** + /// property indicates whether or not the + /// [MediaTrackConstraints.logicalSurface] constraint is supported by the user + /// agent and the device on which the content is being used. + /// + /// The supported constraints list is obtained by calling + /// [MediaDevices.getSupportedConstraints]. + external bool get logicalSurface; + external set logicalSurface(bool value); + external bool get cursor; + external set cursor(bool value); + external bool get restrictOwnAudio; + external set restrictOwnAudio(bool value); + + /// The [MediaTrackSupportedConstraints] dictionary's + /// **`suppressLocalAudioPlayback`** property indicates whether or not the + /// [MediaTrackConstraints.suppressLocalAudioPlayback] constraint is supported + /// by the user agent and the device on which the content is being used. + /// + /// The supported constraints list is obtained by calling + /// [MediaDevices.getSupportedConstraints]. + external bool get suppressLocalAudioPlayback; + external set suppressLocalAudioPlayback(bool value); } extension type MediaTrackCapabilities._(JSObject _) implements JSObject { external factory MediaTrackCapabilities({ @@ -550,6 +645,25 @@ extension type MediaTrackCapabilities._(JSObject _) implements JSObject { ULongRange channelCount, String deviceId, String groupId, + JSArray whiteBalanceMode, + JSArray exposureMode, + JSArray focusMode, + MediaSettingsRange exposureCompensation, + MediaSettingsRange exposureTime, + MediaSettingsRange colorTemperature, + MediaSettingsRange iso, + MediaSettingsRange brightness, + MediaSettingsRange contrast, + MediaSettingsRange saturation, + MediaSettingsRange sharpness, + MediaSettingsRange focusDistance, + MediaSettingsRange pan, + MediaSettingsRange tilt, + MediaSettingsRange zoom, + JSArray torch, + String displaySurface, + bool logicalSurface, + JSArray cursor, }); external ULongRange get width; @@ -582,6 +696,44 @@ extension type MediaTrackCapabilities._(JSObject _) implements JSObject { external set deviceId(String value); external String get groupId; external set groupId(String value); + external JSArray get whiteBalanceMode; + external set whiteBalanceMode(JSArray value); + external JSArray get exposureMode; + external set exposureMode(JSArray value); + external JSArray get focusMode; + external set focusMode(JSArray value); + external MediaSettingsRange get exposureCompensation; + external set exposureCompensation(MediaSettingsRange value); + external MediaSettingsRange get exposureTime; + external set exposureTime(MediaSettingsRange value); + external MediaSettingsRange get colorTemperature; + external set colorTemperature(MediaSettingsRange value); + external MediaSettingsRange get iso; + external set iso(MediaSettingsRange value); + external MediaSettingsRange get brightness; + external set brightness(MediaSettingsRange value); + external MediaSettingsRange get contrast; + external set contrast(MediaSettingsRange value); + external MediaSettingsRange get saturation; + external set saturation(MediaSettingsRange value); + external MediaSettingsRange get sharpness; + external set sharpness(MediaSettingsRange value); + external MediaSettingsRange get focusDistance; + external set focusDistance(MediaSettingsRange value); + external MediaSettingsRange get pan; + external set pan(MediaSettingsRange value); + external MediaSettingsRange get tilt; + external set tilt(MediaSettingsRange value); + external MediaSettingsRange get zoom; + external set zoom(MediaSettingsRange value); + external JSArray get torch; + external set torch(JSArray value); + external String get displaySurface; + external set displaySurface(String value); + external bool get logicalSurface; + external set logicalSurface(bool value); + external JSArray get cursor; + external set cursor(JSArray value); } /// The **`MediaTrackConstraints`** dictionary is used to describe a set of @@ -614,6 +766,28 @@ extension type MediaTrackConstraints._(JSObject _) ConstrainULong channelCount, ConstrainDOMString deviceId, ConstrainDOMString groupId, + ConstrainDOMString whiteBalanceMode, + ConstrainDOMString exposureMode, + ConstrainDOMString focusMode, + ConstrainPoint2D pointsOfInterest, + ConstrainDouble exposureCompensation, + ConstrainDouble exposureTime, + ConstrainDouble colorTemperature, + ConstrainDouble iso, + ConstrainDouble brightness, + ConstrainDouble contrast, + ConstrainDouble saturation, + ConstrainDouble sharpness, + ConstrainDouble focusDistance, + JSAny pan, + JSAny tilt, + JSAny zoom, + ConstrainBoolean torch, + ConstrainDOMString displaySurface, + ConstrainBoolean logicalSurface, + ConstrainDOMString cursor, + ConstrainBoolean restrictOwnAudio, + ConstrainBoolean suppressLocalAudioPlayback, JSArray advanced, }); @@ -637,6 +811,28 @@ extension type MediaTrackConstraintSet._(JSObject _) implements JSObject { ConstrainULong channelCount, ConstrainDOMString deviceId, ConstrainDOMString groupId, + ConstrainDOMString whiteBalanceMode, + ConstrainDOMString exposureMode, + ConstrainDOMString focusMode, + ConstrainPoint2D pointsOfInterest, + ConstrainDouble exposureCompensation, + ConstrainDouble exposureTime, + ConstrainDouble colorTemperature, + ConstrainDouble iso, + ConstrainDouble brightness, + ConstrainDouble contrast, + ConstrainDouble saturation, + ConstrainDouble sharpness, + ConstrainDouble focusDistance, + JSAny pan, + JSAny tilt, + JSAny zoom, + ConstrainBoolean torch, + ConstrainDOMString displaySurface, + ConstrainBoolean logicalSurface, + ConstrainDOMString cursor, + ConstrainBoolean restrictOwnAudio, + ConstrainBoolean suppressLocalAudioPlayback, }); external ConstrainULong get width; @@ -669,6 +865,50 @@ extension type MediaTrackConstraintSet._(JSObject _) implements JSObject { external set deviceId(ConstrainDOMString value); external ConstrainDOMString get groupId; external set groupId(ConstrainDOMString value); + external ConstrainDOMString get whiteBalanceMode; + external set whiteBalanceMode(ConstrainDOMString value); + external ConstrainDOMString get exposureMode; + external set exposureMode(ConstrainDOMString value); + external ConstrainDOMString get focusMode; + external set focusMode(ConstrainDOMString value); + external ConstrainPoint2D get pointsOfInterest; + external set pointsOfInterest(ConstrainPoint2D value); + external ConstrainDouble get exposureCompensation; + external set exposureCompensation(ConstrainDouble value); + external ConstrainDouble get exposureTime; + external set exposureTime(ConstrainDouble value); + external ConstrainDouble get colorTemperature; + external set colorTemperature(ConstrainDouble value); + external ConstrainDouble get iso; + external set iso(ConstrainDouble value); + external ConstrainDouble get brightness; + external set brightness(ConstrainDouble value); + external ConstrainDouble get contrast; + external set contrast(ConstrainDouble value); + external ConstrainDouble get saturation; + external set saturation(ConstrainDouble value); + external ConstrainDouble get sharpness; + external set sharpness(ConstrainDouble value); + external ConstrainDouble get focusDistance; + external set focusDistance(ConstrainDouble value); + external JSAny get pan; + external set pan(JSAny value); + external JSAny get tilt; + external set tilt(JSAny value); + external JSAny get zoom; + external set zoom(JSAny value); + external ConstrainBoolean get torch; + external set torch(ConstrainBoolean value); + external ConstrainDOMString get displaySurface; + external set displaySurface(ConstrainDOMString value); + external ConstrainBoolean get logicalSurface; + external set logicalSurface(ConstrainBoolean value); + external ConstrainDOMString get cursor; + external set cursor(ConstrainDOMString value); + external ConstrainBoolean get restrictOwnAudio; + external set restrictOwnAudio(ConstrainBoolean value); + external ConstrainBoolean get suppressLocalAudioPlayback; + external set suppressLocalAudioPlayback(ConstrainBoolean value); } /// The **`MediaTrackSettings`** dictionary is used to return the current values @@ -704,6 +944,28 @@ extension type MediaTrackSettings._(JSObject _) implements JSObject { int channelCount, String deviceId, String groupId, + String whiteBalanceMode, + String exposureMode, + String focusMode, + JSArray pointsOfInterest, + num exposureCompensation, + num exposureTime, + num colorTemperature, + num iso, + num brightness, + num contrast, + num saturation, + num sharpness, + num focusDistance, + num pan, + num tilt, + num zoom, + bool torch, + String displaySurface, + bool logicalSurface, + String cursor, + bool restrictOwnAudio, + bool suppressLocalAudioPlayback, }); /// The [MediaTrackSettings] dictionary's **`width`** @@ -1036,6 +1298,77 @@ extension type MediaTrackSettings._(JSObject _) implements JSObject { /// will never include this property. external String get groupId; external set groupId(String value); + external String get whiteBalanceMode; + external set whiteBalanceMode(String value); + external String get exposureMode; + external set exposureMode(String value); + external String get focusMode; + external set focusMode(String value); + external JSArray get pointsOfInterest; + external set pointsOfInterest(JSArray value); + external num get exposureCompensation; + external set exposureCompensation(num value); + external num get exposureTime; + external set exposureTime(num value); + external num get colorTemperature; + external set colorTemperature(num value); + external num get iso; + external set iso(num value); + external num get brightness; + external set brightness(num value); + external num get contrast; + external set contrast(num value); + external num get saturation; + external set saturation(num value); + external num get sharpness; + external set sharpness(num value); + external num get focusDistance; + external set focusDistance(num value); + external num get pan; + external set pan(num value); + external num get tilt; + external set tilt(num value); + external num get zoom; + external set zoom(num value); + external bool get torch; + external set torch(bool value); + + /// The [MediaTrackSettings] dictionary's + /// **`displaySurface`** property indicates the type of display + /// surface being captured. + external String get displaySurface; + external set displaySurface(String value); + + /// The [MediaTrackSettings] dictionary's + /// **`logicalSurface`** property indicates whether or not the + /// display area being captured is a logical surface. Logical surfaces are + /// those which are + /// not necessarily entirely onscreen, or may even be off-screen, such as + /// windows' backing + /// buffers (where only part of the buffer is visible without scrolling the + /// containing + /// window) and offscreen rendering contexts. + external bool get logicalSurface; + external set logicalSurface(bool value); + + /// The [MediaTrackSettings] dictionary's **`cursor`** property indicates + /// whether or not the cursor should be captured as part of the video track + /// included in the [MediaStream] returned by [MediaDevices.getDisplayMedia]. + external String get cursor; + external set cursor(String value); + external bool get restrictOwnAudio; + external set restrictOwnAudio(bool value); + + /// The [MediaTrackSettings] dictionary's **`suppressLocalAudioPlayback`** + /// property controls whether the audio playing in a tab will continue to be + /// played out of a user's local speakers when the tab is captured. + /// + /// For example, in cases where you broadcast a video call to an external AV + /// system in a conference room, you will want the audio to play out of the AV + /// system, and not the local speakers. This way, the audio will be louder and + /// clearer, and also in sync with the conference video. + external bool get suppressLocalAudioPlayback; + external set suppressLocalAudioPlayback(bool value); } /// The **`MediaStreamTrackEvent`** interface of the @@ -1153,6 +1486,24 @@ extension type MediaDevices._(JSObject _) implements EventTarget, JSObject { /// > ignore the request. external JSPromise getUserMedia( [MediaStreamConstraints constraints]); + + /// The **`getDisplayMedia()`** method of the [MediaDevices] interface prompts + /// the user to select and + /// grant permission to capture the contents of a display or portion thereof + /// (such as a window) as a [MediaStream]. + /// + /// The resulting stream can then be + /// recorded using the + /// [MediaStream Recording API](https://developer.mozilla.org/en-US/docs/Web/API/MediaStream_Recording_API) + /// or transmitted as part of a + /// [WebRTC](https://developer.mozilla.org/en-US/docs/Web/API/WebRTC_API) + /// session. + /// + /// See + /// [Using the Screen Capture API](https://developer.mozilla.org/en-US/docs/Web/API/Screen_Capture_API/Using_Screen_Capture) + /// for more details and an example. + external JSPromise getDisplayMedia( + [DisplayMediaStreamOptions options]); external EventHandler get ondevicechange; external set ondevicechange(EventHandler value); } @@ -1229,12 +1580,18 @@ extension type MediaStreamConstraints._(JSObject _) implements JSObject { external factory MediaStreamConstraints({ JSAny video, JSAny audio, + bool preferCurrentTab, + String peerIdentity, }); external JSAny get video; external set video(JSAny value); external JSAny get audio; external set audio(JSAny value); + external bool get preferCurrentTab; + external set preferCurrentTab(bool value); + external String get peerIdentity; + external set peerIdentity(String value); } extension type DoubleRange._(JSObject _) implements JSObject { external factory DoubleRange({ @@ -1308,13 +1665,3 @@ extension type ConstrainDOMStringParameters._(JSObject _) implements JSObject { external JSAny get ideal; external set ideal(JSAny value); } -extension type CameraDevicePermissionDescriptor._(JSObject _) - implements PermissionDescriptor, JSObject { - external factory CameraDevicePermissionDescriptor({ - required String name, - bool panTiltZoom, - }); - - external bool get panTiltZoom; - external set panTiltZoom(bool value); -} diff --git a/lib/src/dom/mediasession.dart b/lib/src/dom/mediasession.dart index 59e8d1ed..0eabe25f 100644 --- a/lib/src/dom/mediasession.dart +++ b/lib/src/dom/mediasession.dart @@ -55,28 +55,6 @@ extension type MediaSession._(JSObject _) implements JSObject { /// [navigator.mediaSession] object. external void setPositionState([MediaPositionState state]); - /// The **`setMicrophoneActive()`** method of the [MediaSession] interface is - /// used to indicate to the user agent whether the user's microphone is - /// considered to be currently muted. - /// - /// Call this method on the `navigator` object's - /// [navigator.mediaSession] object. - /// - /// Note that the status of the microphone is not tracked in the - /// [MediaSession] itself, but must be tracked separately. - external void setMicrophoneActive(bool active); - - /// The **`setCameraActive()`** method of the [MediaSession] interface is used - /// to indicate to the user agent whether the user's camera is considered to - /// be active. - /// - /// Call this method on the `navigator` object's - /// [navigator.mediaSession] object. - /// - /// Note that the status of the camera is not tracked in the [MediaSession] - /// itself, but must be tracked separately. - external void setCameraActive(bool active); - /// The **`metadata`** property of the [MediaSession] /// interface contains a [MediaMetadata] object providing descriptive /// information about the currently playing media, or `null` if the metadata @@ -174,20 +152,3 @@ extension type MediaPositionState._(JSObject _) implements JSObject { external num get position; external set position(num value); } -extension type MediaSessionActionDetails._(JSObject _) implements JSObject { - external factory MediaSessionActionDetails({ - required MediaSessionAction action, - num seekOffset, - num seekTime, - bool fastSeek, - }); - - external MediaSessionAction get action; - external set action(MediaSessionAction value); - external num get seekOffset; - external set seekOffset(num value); - external num get seekTime; - external set seekTime(num value); - external bool get fastSeek; - external set fastSeek(bool value); -} diff --git a/lib/src/dom/mediastream_recording.dart b/lib/src/dom/mediastream_recording.dart index 77c24aac..f50c0cd9 100644 --- a/lib/src/dom/mediastream_recording.dart +++ b/lib/src/dom/mediastream_recording.dart @@ -198,10 +198,6 @@ extension type MediaRecorder._(JSObject _) implements EventTarget, JSObject { /// This may differ from the bit rate specified in the constructor (if /// it was provided). external int get audioBitsPerSecond; - - /// The **`audioBitrateMode`** read-only property of the [MediaRecorder] - /// interface returns the bitrate mode used to encode audio tracks. - external BitrateMode get audioBitrateMode; } extension type MediaRecorderOptions._(JSObject _) implements JSObject { external factory MediaRecorderOptions({ diff --git a/lib/src/dom/mst_content_hint.dart b/lib/src/dom/mst_content_hint.dart new file mode 100644 index 00000000..1c373848 --- /dev/null +++ b/lib/src/dom/mst_content_hint.dart @@ -0,0 +1,16 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. +// +// API docs from [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web). +// Attributions and copyright licensing by Mozilla Contributors is licensed +// under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/. + +// Generated from Web IDL definitions. + +@JS() +library; + +import 'dart:js_interop'; + +typedef RTCDegradationPreference = String; diff --git a/lib/src/dom/navigation_timing.dart b/lib/src/dom/navigation_timing.dart index 67ded5e0..5c1423d4 100644 --- a/lib/src/dom/navigation_timing.dart +++ b/lib/src/dom/navigation_timing.dart @@ -161,20 +161,6 @@ extension type PerformanceNavigationTiming._(JSObject _) /// Note that client side redirects, such as `` are not considered here. external int get redirectCount; - - /// A website can indicate that a particular - /// [Client Hint](https://developer.mozilla.org/en-US/docs/Web/HTTP/Client_hints) - /// is critical to the page by including it in a HTTP response header (as - /// well as the HTTP request header which is needed for all client hints - /// whether critical or not). Doing so will trigger a connection restart if - /// the hint listed in the `Critical-CH` HTTP response header could have been, - /// but wasn't, included in the HTTP request initially sent. If the browser - /// does not support that client hint, it is ignored and no connection restart - /// occurs. - /// - /// The **`criticalCHRestart`** read-only property represents the time at - /// which the connection restart occurred. - external DOMHighResTimeStamp get criticalCHRestart; } /// > **Warning:** This interface is deprecated in the diff --git a/lib/src/dom/notifications.dart b/lib/src/dom/notifications.dart index 4cf5552e..2ec04ece 100644 --- a/lib/src/dom/notifications.dart +++ b/lib/src/dom/notifications.dart @@ -43,7 +43,6 @@ extension type Notification._(JSObject _) implements EventTarget, JSObject { external static JSPromise requestPermission( [NotificationPermissionCallback deprecatedCallback]); external static NotificationPermission get permission; - external static int get maxActions; /// The **`close()`** method of the [Notification] interface is used to /// close/remove a previously displayed notification. @@ -115,12 +114,6 @@ extension type Notification._(JSObject _) implements EventTarget, JSObject { /// notifications. external String get tag; - /// The **`image`** read-only property of the - /// [Notification] interface contains the URL of an image to be displayed as - /// part of the notification, as specified in the `image` option of the - /// [Notification.Notification] constructor. - external String get image; - /// The **`icon`** read-only property of the /// [Notification] interface contains the URL of an icon to be displayed as /// part of the notification, as specified in the `icon` option of the @@ -135,38 +128,6 @@ extension type Notification._(JSObject _) implements EventTarget, JSObject { /// image will be automatically masked. external String get badge; - /// The **`vibrate`** read-only property of the [Notification] - /// interface specifies a - /// [vibration pattern](https://developer.mozilla.org/en-US/docs/Web/API/Vibration_API#vibration_patterns) - /// for the device's vibration hardware to emit when the notification fires. - /// This is - /// specified in the `vibrate` option of the - /// [Notification.Notification] constructor. - external JSArray get vibrate; - - /// The **`timestamp`** read-only property of the - /// [Notification] interface returns a number, as - /// specified in the `timestamp` option of the - /// [Notification.Notification] constructor. - /// - /// The notification's timestamp can represent the time, in milliseconds since - /// 00:00:00 UTC - /// on 1 January 1970, of the event for which the notification was created, or - /// it can be an - /// arbitrary timestamp that you want associated with the notification. For - /// example, a - /// timestamp for an upcoming meeting could be set in the future, whereas a - /// timestamp for a - /// missed message could be set in the past. - external EpochTimeStamp get timestamp; - - /// The **`renotify`** read-only property of the - /// [Notification] interface specifies whether the user should be notified - /// after a new notification replaces an old one, as specified in the - /// `renotify` - /// option of the [Notification.Notification] constructor. - external bool get renotify; - /// The **`silent`** read-only property of the /// [Notification] interface specifies whether the notification should be /// silent, i.e., no sounds or vibrations should be issued, regardless of the @@ -194,19 +155,6 @@ extension type Notification._(JSObject _) implements EventTarget, JSObject { /// with the /// notification. external JSAny? get data; - - /// The **`actions`** read-only property of the [Notification] interface - /// provides the actions available for users to choose from for interacting - /// with the notification. - /// - /// The actions are set using the `actions` option of the second argument for - /// the [ServiceWorkerRegistration.showNotification] method and - /// [Notification.Notification] constructor. - /// - /// > **Note:** Browsers typically limit the maximum number of actions they - /// > will display for a particular notification. Check the static - /// > [Notification.maxActions_static] property to determine the limit. - external JSArray get actions; } extension type NotificationOptions._(JSObject _) implements JSObject { external factory NotificationOptions({ diff --git a/lib/src/dom/oes_vertex_array_object.dart b/lib/src/dom/oes_vertex_array_object.dart index a1674841..7f76dc4d 100644 --- a/lib/src/dom/oes_vertex_array_object.dart +++ b/lib/src/dom/oes_vertex_array_object.dart @@ -15,8 +15,7 @@ import 'dart:js_interop'; import 'webgl1.dart'; -extension type WebGLVertexArrayObjectOES._(JSObject _) - implements WebGLObject, JSObject {} +extension type WebGLVertexArrayObjectOES._(JSObject _) implements JSObject {} extension type OES_vertex_array_object._(JSObject _) implements JSObject { external static GLenum get VERTEX_ARRAY_BINDING_OES; external WebGLVertexArrayObjectOES? createVertexArrayOES(); diff --git a/lib/src/dom/orientation_event.dart b/lib/src/dom/orientation_event.dart index 0cdb9b32..bbf1d2bf 100644 --- a/lib/src/dom/orientation_event.dart +++ b/lib/src/dom/orientation_event.dart @@ -29,8 +29,6 @@ extension type DeviceOrientationEvent._(JSObject _) implements Event, JSObject { DeviceOrientationEventInit eventInitDict, ]); - external static JSPromise requestPermission([bool absolute]); - /// The **`alpha`** read-only property of the [DeviceOrientationEvent] /// interface returns the rotation of the device around the Z axis; that is, /// the number of degrees by @@ -166,8 +164,6 @@ extension type DeviceMotionEvent._(JSObject _) implements Event, JSObject { DeviceMotionEventInit eventInitDict, ]); - external static JSPromise requestPermission(); - /// The **`acceleration`** read-only property of the [DeviceMotionEvent] /// interface returns the amount of acceleration recorded by /// the device, in [meters per second squared diff --git a/lib/src/dom/orientation_sensor.dart b/lib/src/dom/orientation_sensor.dart new file mode 100644 index 00000000..641f2202 --- /dev/null +++ b/lib/src/dom/orientation_sensor.dart @@ -0,0 +1,116 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. +// +// API docs from [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web). +// Attributions and copyright licensing by Mozilla Contributors is licensed +// under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/. + +// Generated from Web IDL definitions. + +@JS() +library; + +import 'dart:js_interop'; + +import 'generic_sensor.dart'; + +typedef RotationMatrixType = JSObject; +typedef OrientationSensorLocalCoordinateSystem = String; + +/// The **`OrientationSensor`** interface of the +/// [Sensor APIs](https://developer.mozilla.org/en-US/docs/Web/API/Sensor_APIs) +/// is the base class for orientation sensors. This interface cannot be used +/// directly. Instead it provides properties and methods accessed by interfaces +/// that inherit from it. +/// +/// This feature may be blocked by a +/// [Permissions Policy](https://developer.mozilla.org/en-US/docs/Web/HTTP/Permissions_Policy) +/// set on your server. +/// +/// --- +/// +/// API documentation sourced from +/// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/OrientationSensor). +extension type OrientationSensor._(JSObject _) implements Sensor, JSObject { + /// The **`populateMatrix()`** method of the + /// [OrientationSensor] interface populates the given target matrix with the + /// rotation matrix based on the latest sensor reading. The rotation matrix is + /// shown + /// below. + /// + /// ![The formulas used to convert the sensor's quaternion to the provided + /// matrix.](quaternion_to_rotation_matrix.png) + /// + /// where: + /// + /// - W = cos(θ/2) + /// - X = Vx \* sin(θ/2) + /// - Y = Vy \* sin(θ/2) + /// - Z = Vz \* sin(θ/2) + external void populateMatrix(RotationMatrixType targetMatrix); + + /// The **`quaternion`** read-only + /// property of the [OrientationSensor] interface returns a four element + /// `Array` whose elements contain the components of the unit + /// representing the device's orientation. + /// + /// Because [OrientationSensor] is a base class, `quaternion` may + /// only be read from one of its derived classes. + external JSArray? get quaternion; +} +extension type OrientationSensorOptions._(JSObject _) + implements SensorOptions, JSObject { + external factory OrientationSensorOptions({ + num frequency, + OrientationSensorLocalCoordinateSystem referenceFrame, + }); + + external OrientationSensorLocalCoordinateSystem get referenceFrame; + external set referenceFrame(OrientationSensorLocalCoordinateSystem value); +} + +/// The **`AbsoluteOrientationSensor`** interface of the +/// [Sensor APIs](https://developer.mozilla.org/en-US/docs/Web/API/Sensor_APIs) +/// describes the device's physical orientation in relation to the Earth's +/// reference coordinate system. +/// +/// To use this sensor, the user must grant permission to the `'accelerometer'`, +/// `'gyroscope'`, and `'magnetometer'` device sensors through the +/// [Permissions API](https://developer.mozilla.org/en-US/docs/Web/API/Permissions_API). +/// +/// This feature may be blocked by a +/// [Permissions Policy](https://developer.mozilla.org/en-US/docs/Web/HTTP/Permissions_Policy) +/// set on your server. +/// +/// --- +/// +/// API documentation sourced from +/// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/AbsoluteOrientationSensor). +extension type AbsoluteOrientationSensor._(JSObject _) + implements OrientationSensor, JSObject { + external factory AbsoluteOrientationSensor( + [OrientationSensorOptions sensorOptions]); +} + +/// The **`RelativeOrientationSensor`** interface of the +/// [Sensor APIs](https://developer.mozilla.org/en-US/docs/Web/API/Sensor_APIs) +/// describes the device's physical orientation without regard to the Earth's +/// reference coordinate system. +/// +/// To use this sensor, the user must grant permission to the `'accelerometer'`, +/// and `'gyroscope'` device sensors through the +/// [Permissions API](https://developer.mozilla.org/en-US/docs/Web/API/Permissions_API). +/// In addition, this feature may be blocked by a +/// [Permissions Policy](https://developer.mozilla.org/en-US/docs/Web/HTTP/Permissions_Policy) +/// set on your server. +/// +/// --- +/// +/// API documentation sourced from +/// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/RelativeOrientationSensor). +extension type RelativeOrientationSensor._(JSObject _) + implements OrientationSensor, JSObject { + external factory RelativeOrientationSensor( + [OrientationSensorOptions sensorOptions]); +} diff --git a/lib/src/dom/ovr_multiview2.dart b/lib/src/dom/ovr_multiview2.dart new file mode 100644 index 00000000..f50ed90e --- /dev/null +++ b/lib/src/dom/ovr_multiview2.dart @@ -0,0 +1,31 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. +// +// API docs from [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web). +// Attributions and copyright licensing by Mozilla Contributors is licensed +// under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/. + +// Generated from Web IDL definitions. + +@JS() +library; + +import 'dart:js_interop'; + +import 'webgl1.dart'; + +extension type OVR_multiview2._(JSObject _) implements JSObject { + external static GLenum get FRAMEBUFFER_ATTACHMENT_TEXTURE_NUM_VIEWS_OVR; + external static GLenum get FRAMEBUFFER_ATTACHMENT_TEXTURE_BASE_VIEW_INDEX_OVR; + external static GLenum get MAX_VIEWS_OVR; + external static GLenum get FRAMEBUFFER_INCOMPLETE_VIEW_TARGETS_OVR; + external void framebufferTextureMultiviewOVR( + GLenum target, + GLenum attachment, + WebGLTexture? texture, + GLint level, + GLint baseViewIndex, + GLsizei numViews, + ); +} diff --git a/lib/src/dom/performance_timeline.dart b/lib/src/dom/performance_timeline.dart index 9a7f2129..bc316944 100644 --- a/lib/src/dom/performance_timeline.dart +++ b/lib/src/dom/performance_timeline.dart @@ -53,7 +53,6 @@ extension type PerformanceEntry._(JSObject _) implements JSObject { /// The **`toJSON()`** method is a ; it returns a JSON representation of the /// [PerformanceEntry] object. external JSObject toJSON(); - external int get id; /// The read-only **`name`** property of the [PerformanceEntry] interface is a /// string representing the name for a performance entry. It acts as an @@ -77,7 +76,6 @@ extension type PerformanceEntry._(JSObject _) implements JSObject { /// the . The meaning of this property depends on the value of this entry's /// [PerformanceEntry.entryType]. external DOMHighResTimeStamp get duration; - external int get navigationId; } /// The **`PerformanceObserver`** interface is used to observe performance @@ -114,19 +112,12 @@ extension type PerformanceObserver._(JSObject _) implements JSObject { /// observer, emptying it out. external PerformanceEntryList takeRecords(); } -extension type PerformanceObserverCallbackOptions._(JSObject _) - implements JSObject { - external factory PerformanceObserverCallbackOptions( - {int droppedEntriesCount}); - - external int get droppedEntriesCount; - external set droppedEntriesCount(int value); -} extension type PerformanceObserverInit._(JSObject _) implements JSObject { external factory PerformanceObserverInit({ JSArray entryTypes, String type, bool buffered, + DOMHighResTimeStamp durationThreshold, }); external JSArray get entryTypes; @@ -135,6 +126,8 @@ extension type PerformanceObserverInit._(JSObject _) implements JSObject { external set type(String value); external bool get buffered; external set buffered(bool value); + external DOMHighResTimeStamp get durationThreshold; + external set durationThreshold(DOMHighResTimeStamp value); } /// The **`PerformanceObserverEntryList`** interface is a list of diff --git a/lib/src/dom/permissions.dart b/lib/src/dom/permissions.dart index 8ba2b585..e5368139 100644 --- a/lib/src/dom/permissions.dart +++ b/lib/src/dom/permissions.dart @@ -28,16 +28,17 @@ typedef PermissionState = String; /// API documentation sourced from /// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/Permissions). extension type Permissions._(JSObject _) implements JSObject { + /// The **`Permissions.revoke()`** method of the + /// [Permissions] interface reverts a currently set permission back to its + /// default state, which is usually `prompt`. + /// This method is called on the global [Permissions] object + /// [navigator.permissions]. + external JSPromise revoke(JSObject permissionDesc); + /// The **`Permissions.query()`** method of the [Permissions] interface /// returns the state of a user permission on the global scope. external JSPromise query(JSObject permissionDesc); } -extension type PermissionDescriptor._(JSObject _) implements JSObject { - external factory PermissionDescriptor({required String name}); - - external String get name; - external set name(String value); -} /// The **`PermissionStatus`** interface of the /// [Permissions API](https://developer.mozilla.org/en-US/docs/Web/API/Permissions_API) @@ -61,14 +62,3 @@ extension type PermissionStatus._(JSObject _) implements EventTarget, JSObject { external EventHandler get onchange; external set onchange(EventHandler value); } -extension type PermissionSetParameters._(JSObject _) implements JSObject { - external factory PermissionSetParameters({ - required PermissionDescriptor descriptor, - required PermissionState state, - }); - - external PermissionDescriptor get descriptor; - external set descriptor(PermissionDescriptor value); - external PermissionState get state; - external set state(PermissionState value); -} diff --git a/lib/src/dom/picture_in_picture.dart b/lib/src/dom/picture_in_picture.dart new file mode 100644 index 00000000..76b81b45 --- /dev/null +++ b/lib/src/dom/picture_in_picture.dart @@ -0,0 +1,75 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. +// +// API docs from [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web). +// Attributions and copyright licensing by Mozilla Contributors is licensed +// under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/. + +// Generated from Web IDL definitions. + +@JS() +library; + +import 'dart:js_interop'; + +import 'dom.dart'; +import 'html.dart'; + +/// The **`PictureInPictureWindow`** interface represents an object able to +/// programmatically obtain the **`width`** and **`height`** and **`resize +/// event`** of the floating video window. +/// +/// An object with this interface is obtained using the +/// [HTMLVideoElement.requestPictureInPicture] promise return value. +/// +/// --- +/// +/// API documentation sourced from +/// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/PictureInPictureWindow). +extension type PictureInPictureWindow._(JSObject _) + implements EventTarget, JSObject { + /// The read-only **`width`** property of the [PictureInPictureWindow] + /// inbterface returns the width of the floating video window in pixels. + external int get width; + + /// The read-only **`height`** property of the [PictureInPictureWindow] + /// interface returns the height of the floating video window in pixels. + external int get height; + external EventHandler get onresize; + external set onresize(EventHandler value); +} + +/// The **`PictureInPictureEvent`** interface represents +/// picture-in-picture-related events, including +/// [HTMLVideoElement.enterpictureinpicture_event], +/// [HTMLVideoElement.leavepictureinpicture_event] and +/// [PictureInPictureWindow.resize_event] +/// +/// --- +/// +/// API documentation sourced from +/// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/PictureInPictureEvent). +extension type PictureInPictureEvent._(JSObject _) implements Event, JSObject { + external factory PictureInPictureEvent( + String type, + PictureInPictureEventInit eventInitDict, + ); + + /// The read-only **`pictureInPictureWindow`** property of the + /// [PictureInPictureEvent] interface returns the [PictureInPictureWindow] the + /// event relates to. + external PictureInPictureWindow get pictureInPictureWindow; +} +extension type PictureInPictureEventInit._(JSObject _) + implements EventInit, JSObject { + external factory PictureInPictureEventInit({ + bool bubbles, + bool cancelable, + bool composed, + required PictureInPictureWindow pictureInPictureWindow, + }); + + external PictureInPictureWindow get pictureInPictureWindow; + external set pictureInPictureWindow(PictureInPictureWindow value); +} diff --git a/lib/src/dom/pointerevents.dart b/lib/src/dom/pointerevents.dart index 46e289fe..b3dff44e 100644 --- a/lib/src/dom/pointerevents.dart +++ b/lib/src/dom/pointerevents.dart @@ -25,6 +25,7 @@ extension type PointerEventInit._(JSObject _) bool composed, Window? view, int detail, + JSObject? sourceCapabilities, int which, bool ctrlKey, bool shiftKey, @@ -47,6 +48,8 @@ extension type PointerEventInit._(JSObject _) int button, int buttons, EventTarget? relatedTarget, + num movementX, + num movementY, int pointerId, num width, num height, @@ -224,38 +227,6 @@ extension type PointerEvent._(JSObject _) implements MouseEvent, JSObject { /// (e.g., pen stylus) around its major axis, in degrees. external int get twist; - /// The **`altitudeAngle`** read-only property of the [PointerEvent] interface - /// represents the angle between a transducer (a pointer or stylus) axis and - /// the X-Y plane of a device screen. - /// The altitude angle describes whether the transducer is perpendicular to - /// the screen, parallel, or at some angle in between. - /// - /// Depending on the specific hardware and platform, user agents will likely - /// only receive one set of values for the transducer orientation relative to - /// the screen plane — either [PointerEvent.tiltx] and [PointerEvent.tilty] or - /// `altitudeAngle` and [PointerEvent.azimuthAngle]. - /// - /// ![The azimuth angle of a pointer compared to the altitude angle](./azimuth_altitude_angles.svg) - /// - /// For an additional illustration of this property, see - /// [Figure 4 in the specification](https://w3c.github.io/pointerevents/#figure_altitudeAngle). - external num get altitudeAngle; - - /// The **`azimuthAngle`** read-only property of the [PointerEvent] interface - /// represents the angle between the Y-Z plane and the plane containing both - /// the transducer (pointer or stylus) axis and the Y axis. - /// - /// Depending on the specific hardware and platform, user agents will likely - /// only receive one set of values for the transducer orientation relative to - /// the screen plane — either [PointerEvent.tiltx] and [PointerEvent.tilty] or - /// [PointerEvent.altitudeAngle] and `azimuthAngle`. - /// - /// ![The azimuth angle of a pointer compared to the altitude angle](azimuth_altitude_angles.svg) - /// - /// For an additional illustration of this property, see - /// [Figure 5 in the specification](https://w3c.github.io/pointerevents/#figure_azimuthAngle). - external num get azimuthAngle; - /// The **`pointerType`** read-only property of the /// [PointerEvent] interface indicates the device type (mouse, pen, or touch) /// that caused a given pointer event. diff --git a/lib/src/dom/private_network_access.dart b/lib/src/dom/private_network_access.dart new file mode 100644 index 00000000..090e0c33 --- /dev/null +++ b/lib/src/dom/private_network_access.dart @@ -0,0 +1,16 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. +// +// API docs from [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web). +// Attributions and copyright licensing by Mozilla Contributors is licensed +// under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/. + +// Generated from Web IDL definitions. + +@JS() +library; + +import 'dart:js_interop'; + +typedef IPAddressSpace = String; diff --git a/lib/src/dom/push_api.dart b/lib/src/dom/push_api.dart index 7ad43ad8..ad153731 100644 --- a/lib/src/dom/push_api.dart +++ b/lib/src/dom/push_api.dart @@ -15,21 +15,10 @@ import 'dart:js_interop'; import 'fileapi.dart'; import 'hr_time.dart'; -import 'permissions.dart'; import 'service_workers.dart'; typedef PushMessageDataInit = JSAny; typedef PushEncryptionKeyName = String; -extension type PushPermissionDescriptor._(JSObject _) - implements PermissionDescriptor, JSObject { - external factory PushPermissionDescriptor({ - required String name, - bool userVisibleOnly, - }); - - external bool get userVisibleOnly; - external set userVisibleOnly(bool value); -} /// The **`PushManager`** interface of the /// [Push API](https://developer.mozilla.org/en-US/docs/Web/API/Push_API) @@ -255,26 +244,6 @@ extension type PushEventInit._(JSObject _) } extension type PushSubscriptionChangeEvent._(JSObject _) implements ExtendableEvent, JSObject { - external factory PushSubscriptionChangeEvent( - String type, [ - PushSubscriptionChangeEventInit eventInitDict, - ]); - external PushSubscription? get newSubscription; external PushSubscription? get oldSubscription; } -extension type PushSubscriptionChangeEventInit._(JSObject _) - implements ExtendableEventInit, JSObject { - external factory PushSubscriptionChangeEventInit({ - bool bubbles, - bool cancelable, - bool composed, - PushSubscription newSubscription, - PushSubscription oldSubscription, - }); - - external PushSubscription get newSubscription; - external set newSubscription(PushSubscription value); - external PushSubscription get oldSubscription; - external set oldSubscription(PushSubscription value); -} diff --git a/lib/src/dom/remote_playback.dart b/lib/src/dom/remote_playback.dart new file mode 100644 index 00000000..5fa5b662 --- /dev/null +++ b/lib/src/dom/remote_playback.dart @@ -0,0 +1,63 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. +// +// API docs from [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web). +// Attributions and copyright licensing by Mozilla Contributors is licensed +// under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/. + +// Generated from Web IDL definitions. + +@JS() +library; + +import 'dart:js_interop'; + +import 'dom.dart'; +import 'html.dart'; + +typedef RemotePlaybackAvailabilityCallback = JSFunction; +typedef RemotePlaybackState = String; + +/// The **`RemotePlayback`** interface of the [Remote Playback API] allows the +/// page to detect availability of remote playback devices, then connect to and +/// control playing on these devices. +/// +/// --- +/// +/// API documentation sourced from +/// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/RemotePlayback). +extension type RemotePlayback._(JSObject _) implements EventTarget, JSObject { + /// The **`watchAvailability()`** method of the [RemotePlayback] interface + /// watches the list of available remote playback devices and returns a + /// `Promise` that resolves with the `callbackId` of a remote playback device. + external JSPromise watchAvailability( + RemotePlaybackAvailabilityCallback callback); + + /// The **`cancelWatchAvailability()`** method of the [RemotePlayback] + /// interface cancels the request to watch for one or all available devices. + external JSPromise cancelWatchAvailability([int id]); + + /// The **`prompt()`** method of the [RemotePlayback] interface prompts the + /// user to select an available remote playback device and give permission for + /// the current media to be played using that device. + /// + /// If the user gives permission, the [RemotePlayback.state] will be set to + /// `connecting` and the user agent will connect to the device to initiate + /// playback. + /// + /// If the user chooses to instead disconnect from the device, the + /// [RemotePlayback.state] will be set to `disconnected` and user agent will + /// disconnect from this device. + external JSPromise prompt(); + + /// The **`state`** read-only property of the [RemotePlayback] interface + /// returns the current state of the `RemotePlayback` connection. + external RemotePlaybackState get state; + external EventHandler get onconnecting; + external set onconnecting(EventHandler value); + external EventHandler get onconnect; + external set onconnect(EventHandler value); + external EventHandler get ondisconnect; + external set ondisconnect(EventHandler value); +} diff --git a/lib/src/dom/reporting.dart b/lib/src/dom/reporting.dart index db59bd38..c3b29a01 100644 --- a/lib/src/dom/reporting.dart +++ b/lib/src/dom/reporting.dart @@ -123,14 +123,3 @@ extension type ReportingObserverOptions._(JSObject _) implements JSObject { external bool get buffered; external set buffered(bool value); } -extension type GenerateTestReportParameters._(JSObject _) implements JSObject { - external factory GenerateTestReportParameters({ - required String message, - String group, - }); - - external String get message; - external set message(String value); - external String get group; - external set group(String value); -} diff --git a/lib/src/dom/requestidlecallback.dart b/lib/src/dom/requestidlecallback.dart new file mode 100644 index 00000000..62a8ea25 --- /dev/null +++ b/lib/src/dom/requestidlecallback.dart @@ -0,0 +1,83 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. +// +// API docs from [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web). +// Attributions and copyright licensing by Mozilla Contributors is licensed +// under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/. + +// Generated from Web IDL definitions. + +@JS() +library; + +import 'dart:js_interop'; + +import 'hr_time.dart'; + +typedef IdleRequestCallback = JSFunction; +extension type IdleRequestOptions._(JSObject _) implements JSObject { + external factory IdleRequestOptions({int timeout}); + + external int get timeout; + external set timeout(int value); +} + +/// The `IdleDeadline` interface is used as the data type of the input parameter +/// to idle callbacks established by calling [Window.requestIdleCallback]. It +/// offers a method, [IdleDeadline.timeRemaining], which lets you determine how +/// much longer the user agent estimates it will remain idle and a property, +/// [IdleDeadline.didTimeout], which lets you determine if your callback is +/// executing because its timeout duration expired. +/// +/// To learn more about how request callbacks work, see +/// [Collaborative Scheduling of Background Tasks](https://developer.mozilla.org/en-US/docs/Web/API/Background_Tasks_API). +/// +/// --- +/// +/// API documentation sourced from +/// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/IdleDeadline). +extension type IdleDeadline._(JSObject _) implements JSObject { + /// The **`timeRemaining()`** method + /// on the [IdleDeadline] interface returns the estimated number of + /// milliseconds remaining in the current idle period. The callback can call + /// this method at + /// any time to determine how much time it can continue to work before it must + /// return. For + /// example, if the callback finishes a task and has another one to begin, it + /// can call + /// `timeRemaining()` to see if there's enough time to complete the next task. + /// If + /// there isn't, the callback can just return immediately, or look for other + /// work to do with + /// the remaining time. + /// + /// By the time `timeRemaining()` reaches 0, it is suggested that the callback + /// should return control to the user agent's event loop. + external DOMHighResTimeStamp timeRemaining(); + + /// The read-only **`didTimeout`** property on the + /// **[IdleDeadline]** interface is a Boolean value which + /// indicates whether or not the idle callback is being invoked because the + /// timeout interval + /// specified when [Window.requestIdleCallback] was called has expired. + /// + /// If `didTimeout` is `true`, the `IdleDeadline` object's + /// [IdleDeadline.timeRemaining] method will return + /// approximately 0. + /// + /// Idle callbacks support the concept of a timeout in order to ensure that + /// whatever task + /// they're meant to perform actually happens, even if the user agent never + /// has enough idle + /// time available. Your callback will typically check the value of + /// `didTimeout` + /// if it needs to perform an action even if the browser is too busy to grant + /// you the time; + /// you should react by performing the needed task or, ideally, a minimal + /// amount of work + /// that can be done to keep things moving along, then schedule a new callback + /// to try again + /// to get the rest of the work done. + external bool get didTimeout; +} diff --git a/lib/src/dom/resource_timing.dart b/lib/src/dom/resource_timing.dart index 31194b8f..22355064 100644 --- a/lib/src/dom/resource_timing.dart +++ b/lib/src/dom/resource_timing.dart @@ -45,11 +45,6 @@ extension type PerformanceResourceTiming._(JSObject _) /// > in a CSS file, the `initiatorType` will be `css` and not `img`. external String get initiatorType; - /// The **`deliveryType`** read-only property is a string indicating how the - /// resource was delivered — for example from the cache or from a navigational - /// prefetch. - external String get deliveryType; - /// The **`nextHopProtocol`** read-only property is a string representing the /// network protocol used to fetch the resource, as identified by the [ALPN /// Protocol ID @@ -153,14 +148,6 @@ extension type PerformanceResourceTiming._(JSObject _) /// (see the example below). external DOMHighResTimeStamp get requestStart; - /// The **`firstInterimResponseStart`** read-only property returns a - /// [DOMHighResTimeStamp] immediately after the browser receives the first - /// byte of the interim 1xx response (for example, 100 Continue or 103 Early - /// Hints) from the server. - /// - /// There is no _end_ property for `firstInterimResponseStart`. - external DOMHighResTimeStamp get firstInterimResponseStart; - /// The **`responseStart`** read-only property returns a [DOMHighResTimeStamp] /// immediately after the browser receives the first byte of the response from /// the server, cache, or local resource. @@ -201,13 +188,6 @@ extension type PerformanceResourceTiming._(JSObject _) /// size of the payload after removing any applied content encoding. external int get decodedBodySize; - /// The **`responseStatus`** read-only property represents the HTTP response - /// status code returned when fetching the resource. - /// - /// This property maps to [Response.status] from the - /// [Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API). - external int get responseStatus; - /// The **`renderBlockingStatus`** read-only property returns the /// render-blocking status of the resource. /// @@ -216,7 +196,6 @@ extension type PerformanceResourceTiming._(JSObject _) /// - weren't render-blocking and therefore could be delayed, or /// - were render-blocking and therefore could be preloaded. external RenderBlockingStatusType get renderBlockingStatus; - external String get contentType; /// The **`serverTiming`** read-only property returns an array of /// [PerformanceServerTiming] entries containing server timing metrics. diff --git a/lib/src/dom/scheduling_apis.dart b/lib/src/dom/scheduling_apis.dart new file mode 100644 index 00000000..75ff8c0b --- /dev/null +++ b/lib/src/dom/scheduling_apis.dart @@ -0,0 +1,239 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. +// +// API docs from [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web). +// Attributions and copyright licensing by Mozilla Contributors is licensed +// under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/. + +// Generated from Web IDL definitions. + +@JS() +library; + +import 'dart:js_interop'; + +import 'dom.dart'; +import 'html.dart'; + +typedef SchedulerPostTaskCallback = JSFunction; +typedef TaskPriority = String; +extension type SchedulerPostTaskOptions._(JSObject _) implements JSObject { + external factory SchedulerPostTaskOptions({ + AbortSignal signal, + TaskPriority priority, + int delay, + }); + + external AbortSignal get signal; + external set signal(AbortSignal value); + external TaskPriority get priority; + external set priority(TaskPriority value); + external int get delay; + external set delay(int value); +} + +/// The **`Scheduler`** interface of the +/// [Prioritized Task Scheduling API](https://developer.mozilla.org/en-US/docs/Web/API/Prioritized_Task_Scheduling_API) +/// provides the [Scheduler.postTask] method that can be used for adding +/// prioritized tasks to be scheduled. +/// +/// A `Scheduler` can be accessed from the global object [Window] or +/// [WorkerGlobalScope] (`this.scheduler`). +/// +/// --- +/// +/// API documentation sourced from +/// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/Scheduler). +extension type Scheduler._(JSObject _) implements JSObject { + /// The **`postTask()`** method of the [Scheduler] interface is used for + /// adding tasks to be + /// [scheduled](https://developer.mozilla.org/en-US/docs/Web/API/Prioritized_Task_Scheduling_API) + /// according to their + /// [priority](https://developer.mozilla.org/en-US/docs/Web/API/Prioritized_Task_Scheduling_API#task_priorities). + /// + /// The method allows users to optionally specify a minimum delay before the + /// task will run, a priority for the task, and a signal that can be used to + /// modify the task priority and/or abort the task. + /// It returns a promise that is resolved with the result of the task callback + /// function, or rejected with the abort reason or an error thrown in the + /// task. + /// + /// Task priority can be + /// [mutable or immutable](https://developer.mozilla.org/en-US/docs/Web/API/Prioritized_Task_Scheduling_API#mutable_and_immutable_task_priority). + /// If the task priority will never need to change then it should be set using + /// the `options.priority` parameter (any priority set through a signal will + /// then be ignored). + /// You can still pass an [AbortSignal] (which has no priority) or + /// [TaskSignal] to the `options.signal` parameter for aborting the task. + /// + /// If the task priority might need to be changed the `options.priority` + /// parameter must not be set. + /// Instead a [TaskController] should be created and its [TaskSignal] should + /// be passed to `options.signal`. + /// The task priority will be initialized from the signal priority, and can + /// later be modified using the signal's associated [TaskController]. + /// + /// If no priority is set then the task priority defaults to + /// [`"user-visible"`](/en-US/docs/Web/API/Prioritized_Task_Scheduling_API#user-visible). + /// + /// If a delay is specified and greater than 0, then the execution of the task + /// will be delayed for at least that many milliseconds. + /// Otherwise the task is immediately scheduled for prioritization. + external JSPromise postTask( + SchedulerPostTaskCallback callback, [ + SchedulerPostTaskOptions options, + ]); +} + +/// The **`TaskPriorityChangeEvent`** is the interface for the +/// [`prioritychange`](https://developer.mozilla.org/en-US/docs/Web/API/TaskSignal/prioritychange_event) +/// event. +/// +/// --- +/// +/// API documentation sourced from +/// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/TaskPriorityChangeEvent). +extension type TaskPriorityChangeEvent._(JSObject _) + implements Event, JSObject { + external factory TaskPriorityChangeEvent( + String type, + TaskPriorityChangeEventInit priorityChangeEventInitDict, + ); + + /// The readonly **`previousPriority`** property of the + /// [TaskPriorityChangeEvent] interface returns the priority of the + /// corresponding [TaskSignal] before it was changed and this + /// [`prioritychange`](https://developer.mozilla.org/en-US/docs/Web/API/TaskSignal/prioritychange_event) + /// event was emitted. + /// + /// This is the value that was set in the + /// [`TaskPriorityChangeEvent` constructor](https://developer.mozilla.org/en-US/docs/Web/API/TaskPriorityChangeEvent/TaskPriorityChangeEvent) + /// argument `options.previous`. + /// + /// The new priority of the task can be read from `event.target.priority`. + external TaskPriority get previousPriority; +} +extension type TaskPriorityChangeEventInit._(JSObject _) + implements EventInit, JSObject { + external factory TaskPriorityChangeEventInit({ + bool bubbles, + bool cancelable, + bool composed, + required TaskPriority previousPriority, + }); + + external TaskPriority get previousPriority; + external set previousPriority(TaskPriority value); +} +extension type TaskControllerInit._(JSObject _) implements JSObject { + external factory TaskControllerInit({TaskPriority priority}); + + external TaskPriority get priority; + external set priority(TaskPriority value); +} + +/// The **`TaskController`** interface of the +/// [Prioritized Task Scheduling API](https://developer.mozilla.org/en-US/docs/Web/API/Prioritized_Task_Scheduling_API) +/// represents a controller object that can be used to both abort and change the +/// [priority](https://developer.mozilla.org/en-US/docs/Web/API/Prioritized_Task_Scheduling_API#task_priorities) +/// of one or more prioritized tasks. +/// If there is no need to change task priorities, then [AbortController] can be +/// used instead. +/// +/// A new `TaskController` instance is created using the +/// [TaskController.TaskController] constructor, optionally specifying a +/// [priority](https://developer.mozilla.org/en-US/docs/Web/API/Prioritized_Task_Scheduling_API#task_priorities) +/// for its associated signal (a [TaskSignal]). +/// If not specified, the signal will have a priority of +/// [`"user-visible"`](/en-US/docs/Web/API/Prioritized_Task_Scheduling_API#user-visible) +/// by default. +/// +/// The controller's signal can be passed as an argument to the +/// [Scheduler.postTask] method for one or more tasks. +/// For +/// [mutable tasks](https://developer.mozilla.org/en-US/docs/Web/API/Prioritized_Task_Scheduling_API#mutable_and_immutable_task_priority) +/// (only) the task is initialized with the signal priority, and can later be +/// changed by calling [TaskController.setPriority]. +/// For immutable tasks, any priority initialized or set by the controller is +/// ignored. +/// +/// Tasks can be aborted by calling [AbortController.abort] on the controller. +/// +/// --- +/// +/// API documentation sourced from +/// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/TaskController). +extension type TaskController._(JSObject _) + implements AbortController, JSObject { + external factory TaskController([TaskControllerInit init]); + + /// The **`setPriority()`** method of the [TaskController] interface can be + /// called to set a new + /// [priority](https://developer.mozilla.org/en-US/docs/Web/API/Prioritized_Task_Scheduling_API#task_priorities) + /// for this controller's + /// [`signal`](https://developer.mozilla.org/en-US/docs/Web/API/TaskController#taskcontroller.signal). + /// If a prioritized task is + /// [configured](https://developer.mozilla.org/en-US/docs/Web/API/Scheduler/postTask#signal) + /// to use the signal, this will also change the task priority. + /// + /// Observers are notified of priority changes by dispatching a + /// [`prioritychange`](https://developer.mozilla.org/en-US/docs/Web/API/TaskSignal/prioritychange_event) + /// event. + /// The method will only notify if the priority actually changes (the event is + /// not fired if the priority would not be changed by the call). + /// + /// Note that task priority can only be changed for + /// [tasks with mutable priorities](https://developer.mozilla.org/en-US/docs/Web/API/Prioritized_Task_Scheduling_API#mutable_and_immutable_task_priority). + /// If the task is immutable, the function call is ignored. + external void setPriority(TaskPriority priority); +} + +/// The **`TaskSignal`** interface of the +/// [Prioritized Task Scheduling API](https://developer.mozilla.org/en-US/docs/Web/API/Prioritized_Task_Scheduling_API) +/// represents a signal object that allows you to communicate with a prioritized +/// task, and abort it or change the +/// [priority](https://developer.mozilla.org/en-US/docs/Web/API/Prioritized_Task_Scheduling_API#task_priorities) +/// (if required) via a [TaskController] object. +/// +/// An object of this type is created, and associated with, a [TaskController]. +/// The initial priority of the signal may be set by specifying it as an +/// argument to the [TaskController.TaskController] constructor (by default it +/// is `"user-visible"`). +/// The priority can be changed by calling [TaskController.setPriority] on the +/// controller. +/// +/// The signal may be passed as the `options.signal` argument in +/// [Scheduler.postTask], after which it's associated controller can be used to +/// abort the task. +/// If the +/// [task priority is mutable](https://developer.mozilla.org/en-US/docs/Web/API/Prioritized_Task_Scheduling_API#mutable_and_immutable_task_priority), +/// the controller can also be used to change the task's priority. +/// Abortable tasks that do not need the priority to change may instead specify +/// an [AbortSignal] as the `options.signal` argument. +/// +/// --- +/// +/// API documentation sourced from +/// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/TaskSignal). +extension type TaskSignal._(JSObject _) implements AbortSignal, JSObject { + /// The read-only **`priority`** property of the [TaskSignal] interface + /// indicates the signal + /// [priority](https://developer.mozilla.org/en-US/docs/Web/API/Prioritized_Task_Scheduling_API#task_priorities). + /// + /// The initial value is set in the associated [TaskController] by specifying + /// it as an argument to the + /// [`TaskController` constructor](https://developer.mozilla.org/en-US/docs/Web/API/TaskController/TaskController) + /// (by default it is `"user-visible"`). + /// The priority of the signal can be changed by calling + /// [TaskController.setPriority] on the associated controller. + /// + /// For + /// [tasks with a mutable priority](https://developer.mozilla.org/en-US/docs/Web/API/Prioritized_Task_Scheduling_API#mutable_and_immutable_task_priority), + /// this value is used to set the initial task priority and later to change + /// it. + /// Tasks with an immutable priority will ignore the value. + external TaskPriority get priority; + external EventHandler get onprioritychange; + external set onprioritychange(EventHandler value); +} diff --git a/lib/src/dom/screen_capture.dart b/lib/src/dom/screen_capture.dart new file mode 100644 index 00000000..aec66026 --- /dev/null +++ b/lib/src/dom/screen_capture.dart @@ -0,0 +1,45 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. +// +// API docs from [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web). +// Attributions and copyright licensing by Mozilla Contributors is licensed +// under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/. + +// Generated from Web IDL definitions. + +@JS() +library; + +import 'dart:js_interop'; + +typedef SelfCapturePreferenceEnum = String; +typedef SystemAudioPreferenceEnum = String; +typedef SurfaceSwitchingPreferenceEnum = String; +typedef MonitorTypeSurfacesEnum = String; +extension type DisplayMediaStreamOptions._(JSObject _) implements JSObject { + external factory DisplayMediaStreamOptions({ + JSAny video, + JSAny audio, + JSObject controller, + SelfCapturePreferenceEnum selfBrowserSurface, + SystemAudioPreferenceEnum systemAudio, + SurfaceSwitchingPreferenceEnum surfaceSwitching, + MonitorTypeSurfacesEnum monitorTypeSurfaces, + }); + + external JSAny get video; + external set video(JSAny value); + external JSAny get audio; + external set audio(JSAny value); + external JSObject get controller; + external set controller(JSObject value); + external SelfCapturePreferenceEnum get selfBrowserSurface; + external set selfBrowserSurface(SelfCapturePreferenceEnum value); + external SystemAudioPreferenceEnum get systemAudio; + external set systemAudio(SystemAudioPreferenceEnum value); + external SurfaceSwitchingPreferenceEnum get surfaceSwitching; + external set surfaceSwitching(SurfaceSwitchingPreferenceEnum value); + external MonitorTypeSurfacesEnum get monitorTypeSurfaces; + external set monitorTypeSurfaces(MonitorTypeSurfacesEnum value); +} diff --git a/lib/src/dom/secure_payment_confirmation.dart b/lib/src/dom/secure_payment_confirmation.dart new file mode 100644 index 00000000..a31962eb --- /dev/null +++ b/lib/src/dom/secure_payment_confirmation.dart @@ -0,0 +1,58 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. +// +// API docs from [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web). +// Attributions and copyright licensing by Mozilla Contributors is licensed +// under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/. + +// Generated from Web IDL definitions. + +@JS() +library; + +import 'dart:js_interop'; + +import 'payment_request.dart'; + +extension type AuthenticationExtensionsPaymentInputs._(JSObject _) + implements JSObject { + external factory AuthenticationExtensionsPaymentInputs({ + bool isPayment, + String rpId, + String topOrigin, + String payeeName, + String payeeOrigin, + PaymentCurrencyAmount total, + PaymentCredentialInstrument instrument, + }); + + external bool get isPayment; + external set isPayment(bool value); + external String get rpId; + external set rpId(String value); + external String get topOrigin; + external set topOrigin(String value); + external String get payeeName; + external set payeeName(String value); + external String get payeeOrigin; + external set payeeOrigin(String value); + external PaymentCurrencyAmount get total; + external set total(PaymentCurrencyAmount value); + external PaymentCredentialInstrument get instrument; + external set instrument(PaymentCredentialInstrument value); +} +extension type PaymentCredentialInstrument._(JSObject _) implements JSObject { + external factory PaymentCredentialInstrument({ + required String displayName, + required String icon, + bool iconMustBeShown, + }); + + external String get displayName; + external set displayName(String value); + external String get icon; + external set icon(String value); + external bool get iconMustBeShown; + external set iconMustBeShown(bool value); +} diff --git a/lib/src/dom/selection_api.dart b/lib/src/dom/selection_api.dart index a877597d..638652f9 100644 --- a/lib/src/dom/selection_api.dart +++ b/lib/src/dom/selection_api.dart @@ -63,7 +63,6 @@ extension type Selection._(JSObject _) implements JSObject { /// > **Note:** This method is an alias for the [Selection.removeAllRanges] /// > method. external void empty(); - external JSArray getComposedRanges(ShadowRoot shadowRoots); /// The **`Selection.collapse()`** method collapses the current selection to a /// single point. The document is not modified. If the content is focused and @@ -223,5 +222,4 @@ extension type Selection._(JSObject _) implements JSObject { /// [Selection] interface returns a string describing the /// type of the current selection. external String get type; - external String get direction; } diff --git a/lib/src/dom/service_workers.dart b/lib/src/dom/service_workers.dart index 83b64176..33a2afc5 100644 --- a/lib/src/dom/service_workers.dart +++ b/lib/src/dom/service_workers.dart @@ -419,6 +419,8 @@ extension type ServiceWorkerGlobalScope._(JSObject _) /// underlying service worker take effect immediately for both the current /// client and all other active clients. external JSPromise skipWaiting(); + external EventHandler get onsync; + external set onsync(EventHandler value); external EventHandler get onnotificationclick; external set onnotificationclick(EventHandler value); external EventHandler get onnotificationclose; @@ -528,16 +530,6 @@ extension type WindowClient._(JSObject _) implements Client, JSObject { /// [WindowClient] interface is a boolean value that indicates whether /// the current client has focus. external bool get focused; - - /// The **`ancestorOrigins`** read-only property of the [WindowClient] - /// interface is an array of strings listing the origins of all ancestors of - /// the browsing context represented by this `WindowClient` in reverse order. - /// - /// The first element in the array is the origin of this window's parent, and - /// the last element is the origin of the top-level browsing context. If this - /// window is itself a top-level browsing context, then `ancestorOrigins` is - /// an empty array. - external JSArray get ancestorOrigins; } /// The `Clients` interface provides access to [Client] objects. Access it via diff --git a/lib/src/dom/speech_api.dart b/lib/src/dom/speech_api.dart index 4a44e751..97bd689d 100644 --- a/lib/src/dom/speech_api.dart +++ b/lib/src/dom/speech_api.dart @@ -65,8 +65,8 @@ extension type SpeechRecognition._(JSObject _) /// [SpeechGrammar] objects that represent the grammars that will be /// understood /// by the current `SpeechRecognition`. - external SpeechGrammarList get grammars; - external set grammars(SpeechGrammarList value); + external JSObject get grammars; + external set grammars(JSObject value); /// The **`lang`** property of the [SpeechRecognition] /// interface returns and sets the language of the current @@ -139,11 +139,6 @@ extension type SpeechRecognition._(JSObject _) /// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/SpeechRecognitionErrorEvent). extension type SpeechRecognitionErrorEvent._(JSObject _) implements Event, JSObject { - external factory SpeechRecognitionErrorEvent( - String type, - SpeechRecognitionErrorEventInit eventInitDict, - ); - /// The **`error`** read-only property of the /// [SpeechRecognitionErrorEvent] interface returns the type of error raised. external SpeechRecognitionErrorCode get error; @@ -153,21 +148,6 @@ extension type SpeechRecognitionErrorEvent._(JSObject _) /// error in more detail. external String get message; } -extension type SpeechRecognitionErrorEventInit._(JSObject _) - implements EventInit, JSObject { - external factory SpeechRecognitionErrorEventInit({ - bool bubbles, - bool cancelable, - bool composed, - required SpeechRecognitionErrorCode error, - String message, - }); - - external SpeechRecognitionErrorCode get error; - external set error(SpeechRecognitionErrorCode value); - external String get message; - external set message(String value); -} /// The **`SpeechRecognitionAlternative`** interface of the /// [Web Speech API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Speech_API) @@ -269,11 +249,6 @@ extension type SpeechRecognitionResultList._(JSObject _) implements JSObject { /// API documentation sourced from /// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/SpeechRecognitionEvent). extension type SpeechRecognitionEvent._(JSObject _) implements Event, JSObject { - external factory SpeechRecognitionEvent( - String type, - SpeechRecognitionEventInit eventInitDict, - ); - /// The **`resultIndex`** read-only property of the /// [SpeechRecognitionEvent] interface returns the lowest index value result /// in @@ -301,99 +276,6 @@ extension type SpeechRecognitionEvent._(JSObject _) implements Event, JSObject { /// will not be overwritten or removed. external SpeechRecognitionResultList get results; } -extension type SpeechRecognitionEventInit._(JSObject _) - implements EventInit, JSObject { - external factory SpeechRecognitionEventInit({ - bool bubbles, - bool cancelable, - bool composed, - int resultIndex, - required SpeechRecognitionResultList results, - }); - - external int get resultIndex; - external set resultIndex(int value); - external SpeechRecognitionResultList get results; - external set results(SpeechRecognitionResultList value); -} - -/// The **`SpeechGrammar`** interface of the -/// [Web Speech API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Speech_API) -/// represents a set of words or patterns of words that we want the recognition -/// service to recognize. -/// -/// Grammar is defined using -/// [JSpeech Grammar Format](https://www.w3.org/TR/jsgf/) (**JSGF**.) Other -/// formats may also be supported in the future. -/// -/// --- -/// -/// API documentation sourced from -/// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/SpeechGrammar). -extension type SpeechGrammar._(JSObject _) implements JSObject { - /// The **`src`** property of the [SpeechGrammar] - /// interface sets and returns a string containing the grammar from within in - /// the - /// `SpeechGrammar` object. - external String get src; - external set src(String value); - - /// The optional **`weight`** property of the - /// [SpeechGrammar] interface sets and returns the weight of the - /// `SpeechGrammar` object. - external num get weight; - external set weight(num value); -} - -/// The **`SpeechGrammarList`** interface of the -/// [Web Speech API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Speech_API) -/// represents a list of [SpeechGrammar] objects containing words or patterns of -/// words that we want the recognition service to recognize. -/// -/// Grammar is defined using -/// [JSpeech Grammar Format](https://www.w3.org/TR/jsgf/) (**JSGF**.) Other -/// formats may also be supported in the future. -/// -/// --- -/// -/// API documentation sourced from -/// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/SpeechGrammarList). -extension type SpeechGrammarList._(JSObject _) implements JSObject { - external factory SpeechGrammarList(); - - /// The **`item`** getter of the [SpeechGrammarList] - /// interface is a standard getter — it allows individual [SpeechGrammar] - /// objects to be retrieved from the `SpeechGrammarList` using array syntax. - external SpeechGrammar item(int index); - - /// The **`addFromURI()`** method of the - /// [SpeechGrammarList] interface takes a grammar present at a specific URI - /// and - /// adds it to the `SpeechGrammarList` as a new [SpeechGrammar] - /// object. - /// - /// Note that some speech recognition services may support built-in grammars - /// that can be - /// specified by URI. - external void addFromURI( - String src, [ - num weight, - ]); - - /// The **`addFromString()`** method of the - /// [SpeechGrammarList] interface takes a grammar present in a specific - /// string within the code base (e.g. stored in a variable) and adds it to - /// the `SpeechGrammarList` as a new [SpeechGrammar] object. - external void addFromString( - String string, [ - num weight, - ]); - - /// The **`length`** read-only property of the - /// [SpeechGrammarList] interface returns the number of - /// [SpeechGrammar] objects contained in the [SpeechGrammarList]. - external int get length; -} /// The **`SpeechSynthesis`** interface of the /// [Web Speech API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Speech_API) diff --git a/lib/src/dom/streams.dart b/lib/src/dom/streams.dart index d276754b..16f5df3a 100644 --- a/lib/src/dom/streams.dart +++ b/lib/src/dom/streams.dart @@ -17,21 +17,8 @@ import 'dom.dart'; import 'webidl.dart'; typedef ReadableStreamReader = JSObject; -typedef ReadableStreamController = JSObject; -typedef UnderlyingSourceStartCallback = JSFunction; -typedef UnderlyingSourcePullCallback = JSFunction; -typedef UnderlyingSourceCancelCallback = JSFunction; -typedef UnderlyingSinkStartCallback = JSFunction; -typedef UnderlyingSinkWriteCallback = JSFunction; -typedef UnderlyingSinkCloseCallback = JSFunction; -typedef UnderlyingSinkAbortCallback = JSFunction; -typedef TransformerStartCallback = JSFunction; -typedef TransformerFlushCallback = JSFunction; -typedef TransformerTransformCallback = JSFunction; -typedef TransformerCancelCallback = JSFunction; typedef QueuingStrategySize = JSFunction; typedef ReadableStreamReaderMode = String; -typedef ReadableStreamType = String; /// The `ReadableStream` interface of the /// [Streams API](https://developer.mozilla.org/en-US/docs/Web/API/Streams_API) @@ -53,8 +40,6 @@ extension type ReadableStream._(JSObject _) implements JSObject { QueuingStrategy strategy, ]); - external static ReadableStream from(JSAny? asyncIterable); - /// The **`cancel()`** method of the [ReadableStream] interface returns a /// `Promise` that resolves when the stream is canceled. /// @@ -161,12 +146,6 @@ extension type ReadableStreamGetReaderOptions._(JSObject _) external ReadableStreamReaderMode get mode; external set mode(ReadableStreamReaderMode value); } -extension type ReadableStreamIteratorOptions._(JSObject _) implements JSObject { - external factory ReadableStreamIteratorOptions({bool preventCancel}); - - external bool get preventCancel; - external set preventCancel(bool value); -} extension type ReadableWritablePair._(JSObject _) implements JSObject { external factory ReadableWritablePair({ required ReadableStream readable, @@ -195,26 +174,6 @@ extension type StreamPipeOptions._(JSObject _) implements JSObject { external AbortSignal get signal; external set signal(AbortSignal value); } -extension type UnderlyingSource._(JSObject _) implements JSObject { - external factory UnderlyingSource({ - UnderlyingSourceStartCallback start, - UnderlyingSourcePullCallback pull, - UnderlyingSourceCancelCallback cancel, - ReadableStreamType type, - int autoAllocateChunkSize, - }); - - external UnderlyingSourceStartCallback get start; - external set start(UnderlyingSourceStartCallback value); - external UnderlyingSourcePullCallback get pull; - external set pull(UnderlyingSourcePullCallback value); - external UnderlyingSourceCancelCallback get cancel; - external set cancel(UnderlyingSourceCancelCallback value); - external ReadableStreamType get type; - external set type(ReadableStreamType value); - external int get autoAllocateChunkSize; - external set autoAllocateChunkSize(int value); -} /// The **`ReadableStreamDefaultReader`** interface of the /// [Streams API](https://developer.mozilla.org/en-US/docs/Web/API/Streams_API) @@ -706,26 +665,6 @@ extension type WritableStream._(JSObject _) implements JSObject { /// writer. external bool get locked; } -extension type UnderlyingSink._(JSObject _) implements JSObject { - external factory UnderlyingSink({ - UnderlyingSinkStartCallback start, - UnderlyingSinkWriteCallback write, - UnderlyingSinkCloseCallback close, - UnderlyingSinkAbortCallback abort, - JSAny? type, - }); - - external UnderlyingSinkStartCallback get start; - external set start(UnderlyingSinkStartCallback value); - external UnderlyingSinkWriteCallback get write; - external set write(UnderlyingSinkWriteCallback value); - external UnderlyingSinkCloseCallback get close; - external set close(UnderlyingSinkCloseCallback value); - external UnderlyingSinkAbortCallback get abort; - external set abort(UnderlyingSinkAbortCallback value); - external JSAny? get type; - external set type(JSAny? value); -} /// The **`WritableStreamDefaultWriter`** interface of the /// [Streams API](https://developer.mozilla.org/en-US/docs/Web/API/Streams_API) @@ -874,29 +813,6 @@ extension type TransformStream._(JSObject _) implements JSObject { /// `TransformStream`. external WritableStream get writable; } -extension type Transformer._(JSObject _) implements JSObject { - external factory Transformer({ - TransformerStartCallback start, - TransformerTransformCallback transform, - TransformerFlushCallback flush, - TransformerCancelCallback cancel, - JSAny? readableType, - JSAny? writableType, - }); - - external TransformerStartCallback get start; - external set start(TransformerStartCallback value); - external TransformerTransformCallback get transform; - external set transform(TransformerTransformCallback value); - external TransformerFlushCallback get flush; - external set flush(TransformerFlushCallback value); - external TransformerCancelCallback get cancel; - external set cancel(TransformerCancelCallback value); - external JSAny? get readableType; - external set readableType(JSAny? value); - external JSAny? get writableType; - external set writableType(JSAny? value); -} /// The **`TransformStreamDefaultController`** interface of the /// [Streams API](https://developer.mozilla.org/en-US/docs/Web/API/Streams_API) diff --git a/lib/src/dom/svg.dart b/lib/src/dom/svg.dart index 4d4d4409..eb2a0c11 100644 --- a/lib/src/dom/svg.dart +++ b/lib/src/dom/svg.dart @@ -18,7 +18,6 @@ import 'cssom.dart'; import 'dom.dart'; import 'geometry.dart'; import 'html.dart'; -import 'web_animations.dart'; /// All of the SVG DOM interfaces that correspond directly to elements in the /// SVG language derive from the `SVGElement` interface. @@ -54,8 +53,6 @@ extension type SVGElement._(JSObject _) implements Element, JSObject { external set onauxclick(EventHandler value); external EventHandler get onbeforeinput; external set onbeforeinput(EventHandler value); - external EventHandler get onbeforematch; - external set onbeforematch(EventHandler value); external EventHandler get onbeforetoggle; external set onbeforetoggle(EventHandler value); external EventHandler get onblur; @@ -188,14 +185,6 @@ extension type SVGElement._(JSObject _) implements Element, JSObject { external set onvolumechange(EventHandler value); external EventHandler get onwaiting; external set onwaiting(EventHandler value); - external EventHandler get onwebkitanimationend; - external set onwebkitanimationend(EventHandler value); - external EventHandler get onwebkitanimationiteration; - external set onwebkitanimationiteration(EventHandler value); - external EventHandler get onwebkitanimationstart; - external set onwebkitanimationstart(EventHandler value); - external EventHandler get onwebkittransitionend; - external set onwebkittransitionend(EventHandler value); external EventHandler get onwheel; external set onwheel(EventHandler value); external EventHandler get onpointerover; @@ -206,8 +195,6 @@ extension type SVGElement._(JSObject _) implements Element, JSObject { external set onpointerdown(EventHandler value); external EventHandler get onpointermove; external set onpointermove(EventHandler value); - external EventHandler get onpointerrawupdate; - external set onpointerrawupdate(EventHandler value); external EventHandler get onpointerup; external set onpointerup(EventHandler value); external EventHandler get onpointercancel; @@ -232,8 +219,6 @@ extension type SVGElement._(JSObject _) implements Element, JSObject { external set ontouchmove(EventHandler value); external EventHandler get ontouchcancel; external set ontouchcancel(EventHandler value); - external SVGElement? get correspondingElement; - external SVGUseElement? get correspondingUseElement; external DOMStringMap get dataset; external String get nonce; external set nonce(String value); @@ -543,7 +528,6 @@ extension type SVGStringList._(JSObject _) implements JSObject { ); external String removeItem(int index); external String appendItem(String newItem); - external int get length; external int get numberOfItems; } @@ -828,8 +812,6 @@ extension type SVGSVGElement._(JSObject _) external set ononline(EventHandler value); external EventHandler get onpagehide; external set onpagehide(EventHandler value); - external EventHandler get onpagereveal; - external set onpagereveal(EventHandler value); external EventHandler get onpageshow; external set onpageshow(EventHandler value); external EventHandler get onpopstate; @@ -960,20 +942,8 @@ extension type SVGUseElement._(JSObject _) external SVGAnimatedLength get y; external SVGAnimatedLength get width; external SVGAnimatedLength get height; - external SVGElement? get instanceRoot; - external SVGElement? get animatedInstanceRoot; external SVGAnimatedString get href; } -extension type SVGUseElementShadowRoot._(JSObject _) - implements ShadowRoot, JSObject {} -extension type ShadowAnimation._(JSObject _) implements Animation, JSObject { - external factory ShadowAnimation( - Animation source, - JSObject newTarget, - ); - - external Animation get sourceAnimation; -} /// The **`SVGSwitchElement`** interface corresponds to the element. /// @@ -1095,7 +1065,6 @@ extension type SVGTransformList._(JSObject _) implements JSObject { external SVGTransform appendItem(SVGTransform newItem); external SVGTransform createSVGTransformFromMatrix([DOMMatrix2DInit matrix]); external SVGTransform? consolidate(); - external int get length; external int get numberOfItems; } @@ -1805,25 +1774,6 @@ extension type SVGAElement._(JSObject _) external set text(String value); external String get referrerPolicy; external set referrerPolicy(String value); - external String get origin; - external String get protocol; - external set protocol(String value); - external String get username; - external set username(String value); - external String get password; - external set password(String value); - external String get host; - external set host(String value); - external String get hostname; - external set hostname(String value); - external String get port; - external set port(String value); - external String get pathname; - external set pathname(String value); - external String get search; - external set search(String value); - external String get hash; - external set hash(String value); external SVGAnimatedString get href; } diff --git a/lib/src/dom/svg_animations.dart b/lib/src/dom/svg_animations.dart index d01d372e..03d9d555 100644 --- a/lib/src/dom/svg_animations.dart +++ b/lib/src/dom/svg_animations.dart @@ -61,12 +61,8 @@ extension type SVGAnimationElement._(JSObject _) /// example, because the `href` attribute specifies an unknown element), the /// value returned is `null`. external SVGElement? get targetElement; - external EventHandler get onbegin; - external set onbegin(EventHandler value); external EventHandler get onend; external set onend(EventHandler value); - external EventHandler get onrepeat; - external set onrepeat(EventHandler value); external SVGStringList get requiredExtensions; external SVGStringList get systemLanguage; } @@ -151,5 +147,3 @@ extension type SVGAnimateTransformElement._(JSObject _) 'animateTransform', ); } -extension type SVGDiscardElement._(JSObject _) - implements SVGAnimationElement, JSObject {} diff --git a/lib/src/dom/touch_events.dart b/lib/src/dom/touch_events.dart index 1f8fde1b..668e22f2 100644 --- a/lib/src/dom/touch_events.dart +++ b/lib/src/dom/touch_events.dart @@ -216,6 +216,7 @@ extension type TouchEventInit._(JSObject _) bool composed, Window? view, int detail, + JSObject? sourceCapabilities, int which, bool ctrlKey, bool shiftKey, @@ -264,8 +265,6 @@ extension type TouchEvent._(JSObject _) implements UIEvent, JSObject { TouchEventInit eventInitDict, ]); - external bool getModifierState(String keyArg); - /// **`touches`** is a read-only [TouchList] listing /// all the [Touch] objects for touch points that are currently in contact /// with the touch surface, regardless of whether or not they've changed or diff --git a/lib/src/dom/trust_token_api.dart b/lib/src/dom/trust_token_api.dart new file mode 100644 index 00000000..5f33fa29 --- /dev/null +++ b/lib/src/dom/trust_token_api.dart @@ -0,0 +1,35 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. +// +// API docs from [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web). +// Attributions and copyright licensing by Mozilla Contributors is licensed +// under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/. + +// Generated from Web IDL definitions. + +@JS() +library; + +import 'dart:js_interop'; + +typedef RefreshPolicy = String; +typedef TokenVersion = String; +typedef OperationType = String; +extension type PrivateToken._(JSObject _) implements JSObject { + external factory PrivateToken({ + required TokenVersion version, + required OperationType operation, + RefreshPolicy refreshPolicy, + JSArray issuers, + }); + + external TokenVersion get version; + external set version(TokenVersion value); + external OperationType get operation; + external set operation(OperationType value); + external RefreshPolicy get refreshPolicy; + external set refreshPolicy(RefreshPolicy value); + external JSArray get issuers; + external set issuers(JSArray value); +} diff --git a/lib/src/dom/trusted_types.dart b/lib/src/dom/trusted_types.dart index 6b460ac0..3668ed22 100644 --- a/lib/src/dom/trusted_types.dart +++ b/lib/src/dom/trusted_types.dart @@ -13,10 +13,6 @@ library; import 'dart:js_interop'; -typedef HTMLString = String; -typedef ScriptString = String; -typedef ScriptURLString = String; -typedef TrustedType = JSObject; typedef CreateHTMLCallback = JSFunction; typedef CreateScriptCallback = JSFunction; typedef CreateScriptURLCallback = JSFunction; @@ -35,8 +31,6 @@ typedef CreateScriptURLCallback = JSFunction; /// API documentation sourced from /// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/TrustedHTML). extension type TrustedHTML._(JSObject _) implements JSObject { - external static TrustedHTML fromLiteral(JSObject templateStringsArray); - /// The **`toJSON()`** method of the [TrustedHTML] interface returns a JSON /// representation of the stored data. external String toJSON(); @@ -56,8 +50,6 @@ extension type TrustedHTML._(JSObject _) implements JSObject { /// API documentation sourced from /// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/TrustedScript). extension type TrustedScript._(JSObject _) implements JSObject { - external static TrustedScript fromLiteral(JSObject templateStringsArray); - /// The **`toJSON()`** method of the [TrustedScript] interface returns a JSON /// representation of the stored data. external String toJSON(); @@ -77,8 +69,6 @@ extension type TrustedScript._(JSObject _) implements JSObject { /// API documentation sourced from /// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/TrustedScriptURL). extension type TrustedScriptURL._(JSObject _) implements JSObject { - external static TrustedScriptURL fromLiteral(JSObject templateStringsArray); - /// The **`toJSON()`** method of the [TrustedScriptURL] interface returns a /// JSON representation of the stored data. external String toJSON(); diff --git a/lib/src/dom/uievents.dart b/lib/src/dom/uievents.dart index 33bebbdb..1fef1e4f 100644 --- a/lib/src/dom/uievents.dart +++ b/lib/src/dom/uievents.dart @@ -88,6 +88,7 @@ extension type UIEventInit._(JSObject _) implements EventInit, JSObject { bool composed, Window? view, int detail, + JSObject? sourceCapabilities, int which, }); @@ -95,6 +96,8 @@ extension type UIEventInit._(JSObject _) implements EventInit, JSObject { external set view(Window? value); external int get detail; external set detail(int value); + external JSObject? get sourceCapabilities; + external set sourceCapabilities(JSObject? value); external int get which; external set which(int value); } @@ -166,6 +169,7 @@ extension type FocusEventInit._(JSObject _) implements UIEventInit, JSObject { bool composed, Window? view, int detail, + JSObject? sourceCapabilities, int which, EventTarget? relatedTarget, }); @@ -286,6 +290,38 @@ extension type MouseEvent._(JSObject _) implements UIEvent, JSObject { /// event and the padding edge of the target node. external num get offsetY; + /// The **`movementX`** read-only property of the [MouseEvent] interface + /// provides the difference in the X coordinate of the mouse pointer between + /// the given event and the previous [Element.mousemove_event] event. + /// In other words, the value of the property is computed like this: + /// `currentEvent.movementX = currentEvent.screenX - previousEvent.screenX`. + /// + /// > **Warning:** Browsers [use different units for `movementX` and + /// > [MouseEvent.screenX]](https://github.com/w3c/pointerlock/issues/42) than + /// > what the specification defines. Depending on the browser and operating + /// > system, the `movementX` units may be a physical pixel, a logical pixel, + /// > or a CSS pixel. You may want to avoid the movement properties, and + /// > instead calculate the delta between the current client values + /// > ([MouseEvent.screenX], [MouseEvent.screenY]) and the previous client + /// > values. + external num get movementX; + + /// The **`movementY`** read-only property of the [MouseEvent] interface + /// provides the difference in the Y coordinate of the mouse pointer between + /// the given event and the previous [Element.mousemove_event] event. + /// In other words, the value of the property is computed like this: + /// `currentEvent.movementY = currentEvent.screenY - previousEvent.screenY`. + /// + /// > **Warning:** Browsers [use different units for `movementY` and + /// > [MouseEvent.screenY]](https://github.com/w3c/pointerlock/issues/42) than + /// > what the specification defines. Depending on the browser and operating + /// > system, the `movementY` units may be a physical pixel, a logical pixel, + /// > or a CSS pixel. You may want to avoid the movement properties, and + /// > instead calculate the delta between the current client values + /// > ([MouseEvent.screenX], [MouseEvent.screenY]) and the previous client + /// > values. + external num get movementY; + /// The **`screenX`** read-only property of the [MouseEvent] interface /// provides the horizontal coordinate (offset) of the mouse pointer in /// [screen coordinates](https://developer.mozilla.org/en-US/docs/Web/CSS/CSSOM_view/Coordinate_systems#screen). @@ -318,26 +354,6 @@ extension type MouseEvent._(JSObject _) implements UIEvent, JSObject { /// page is scrolled vertically. external int get clientY; - /// The **`MouseEvent.layerX`** read-only property returns the - /// horizontal coordinate of the event relative to the current layer. - /// - /// This property takes scrolling of the page into account and returns a value - /// relative to - /// the whole of the document unless the event occurs inside a positioned - /// element, where the - /// returned value is relative to the top left of the positioned element. - external int get layerX; - - /// The **`MouseEvent.layerY`** read-only property returns the - /// vertical coordinate of the event relative to the current layer. - /// - /// This property takes scrolling of the page into account, and returns a - /// value relative to - /// the whole of the document, unless the event occurs inside a positioned - /// element, where - /// the returned value is relative to the top left of the positioned element. - external int get layerY; - /// The **`MouseEvent.ctrlKey`** read-only property is a boolean value that /// indicates whether the ctrl key was pressed or not when a given /// mouse event occurs. @@ -505,6 +521,7 @@ extension type MouseEventInit._(JSObject _) bool composed, Window? view, int detail, + JSObject? sourceCapabilities, int which, bool ctrlKey, bool shiftKey, @@ -527,6 +544,8 @@ extension type MouseEventInit._(JSObject _) int button, int buttons, EventTarget? relatedTarget, + num movementX, + num movementY, }); external int get screenX; @@ -543,6 +562,10 @@ extension type MouseEventInit._(JSObject _) external set buttons(int value); external EventTarget? get relatedTarget; external set relatedTarget(EventTarget? value); + external num get movementX; + external set movementX(num value); + external num get movementY; + external set movementY(num value); } extension type EventModifierInit._(JSObject _) implements UIEventInit, JSObject { @@ -552,6 +575,7 @@ extension type EventModifierInit._(JSObject _) bool composed, Window? view, int detail, + JSObject? sourceCapabilities, int which, bool ctrlKey, bool shiftKey, @@ -665,6 +689,7 @@ extension type WheelEventInit._(JSObject _) bool composed, Window? view, int detail, + JSObject? sourceCapabilities, int which, bool ctrlKey, bool shiftKey, @@ -687,6 +712,8 @@ extension type WheelEventInit._(JSObject _) int button, int buttons, EventTarget? relatedTarget, + num movementX, + num movementY, num deltaX, num deltaY, num deltaZ, @@ -716,6 +743,62 @@ extension type InputEvent._(JSObject _) implements UIEvent, JSObject { InputEventInit eventInitDict, ]); + /// The **`getTargetRanges()`** method of the [InputEvent] interface returns + /// an array of static ranges that will be affected by a change to the DOM if + /// the input event is not canceled. + /// + /// This allows web apps to override text edit behavior before the browser + /// modifies the DOM tree, and provides more control over input events to + /// improve performance. + /// + /// Depending on the value of `inputType` and the current editing host, the + /// expected return value of this method varies: + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + ///
inputTypeEditing hostResponse of getTargetRanges()
"historyUndo" or "historyRedo"Anyempty Array
All remainingcontenteditable + /// an Array of + /// [StaticRange] + /// objects associated with event + ///
All remaining + /// input + /// or textarea + /// + /// an empty Array + ///
+ external JSArray getTargetRanges(); + + /// The **`dataTransfer`** read-only property of the + /// [InputEvent] interface returns a [DataTransfer] object + /// containing information about richtext or plaintext data being added to or + /// removed from + /// editable content. + external DataTransfer? get dataTransfer; + /// The **`data`** read-only property of the /// [InputEvent] interface returns a string with inserted /// characters. This may be an empty string if the change doesn't insert text, @@ -743,10 +826,13 @@ extension type InputEventInit._(JSObject _) implements UIEventInit, JSObject { bool composed, Window? view, int detail, + JSObject? sourceCapabilities, int which, String? data, bool isComposing, String inputType, + DataTransfer? dataTransfer, + JSArray targetRanges, }); external String? get data; @@ -755,6 +841,10 @@ extension type InputEventInit._(JSObject _) implements UIEventInit, JSObject { external set isComposing(bool value); external String get inputType; external set inputType(String value); + external DataTransfer? get dataTransfer; + external set dataTransfer(DataTransfer? value); + external JSArray get targetRanges; + external set targetRanges(JSArray value); } /// **`KeyboardEvent`** objects describe a user interaction with the keyboard; @@ -1034,6 +1124,7 @@ extension type KeyboardEventInit._(JSObject _) bool composed, Window? view, int detail, + JSObject? sourceCapabilities, int which, bool ctrlKey, bool shiftKey, @@ -1116,6 +1207,7 @@ extension type CompositionEventInit._(JSObject _) bool composed, Window? view, int detail, + JSObject? sourceCapabilities, int which, String data, }); diff --git a/lib/src/dom/video_rvfc.dart b/lib/src/dom/video_rvfc.dart new file mode 100644 index 00000000..53738358 --- /dev/null +++ b/lib/src/dom/video_rvfc.dart @@ -0,0 +1,16 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. +// +// API docs from [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web). +// Attributions and copyright licensing by Mozilla Contributors is licensed +// under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/. + +// Generated from Web IDL definitions. + +@JS() +library; + +import 'dart:js_interop'; + +typedef VideoFrameRequestCallback = JSFunction; diff --git a/lib/src/dom/wasm_js_api.dart b/lib/src/dom/wasm_js_api.dart new file mode 100644 index 00000000..ebe0cfd6 --- /dev/null +++ b/lib/src/dom/wasm_js_api.dart @@ -0,0 +1,160 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. +// +// API docs from [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web). +// Attributions and copyright licensing by Mozilla Contributors is licensed +// under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/. + +// Generated from Web IDL definitions. + +@JS() +library; + +import 'dart:js_interop'; + +import 'fetch.dart'; +import 'webidl.dart'; + +typedef ImportExportKind = String; +typedef TableKind = String; +typedef ValueType = String; +extension type WebAssemblyInstantiatedSource._(JSObject _) implements JSObject { + external factory WebAssemblyInstantiatedSource({ + required Module module, + required Instance instance, + }); + + external Module get module; + external set module(Module value); + external Instance get instance; + external set instance(Instance value); +} +@JS() +external $WebAssembly get WebAssembly; +@JS('WebAssembly') +extension type $WebAssembly._(JSObject _) implements JSObject { + external bool validate(BufferSource bytes); + external JSPromise compile(BufferSource bytes); + external JSPromise instantiate( + JSObject bytesOrModuleObject, [ + JSObject importObject, + ]); + external JSPromise compileStreaming(JSPromise source); + external JSPromise instantiateStreaming( + JSPromise source, [ + JSObject importObject, + ]); +} +extension type ModuleExportDescriptor._(JSObject _) implements JSObject { + external factory ModuleExportDescriptor({ + required String name, + required ImportExportKind kind, + }); + + external String get name; + external set name(String value); + external ImportExportKind get kind; + external set kind(ImportExportKind value); +} +extension type ModuleImportDescriptor._(JSObject _) implements JSObject { + external factory ModuleImportDescriptor({ + required String module, + required String name, + required ImportExportKind kind, + }); + + external String get module; + external set module(String value); + external String get name; + external set name(String value); + external ImportExportKind get kind; + external set kind(ImportExportKind value); +} +extension type Module._(JSObject _) implements JSObject { + external factory Module(BufferSource bytes); + + external static JSArray exports(Module moduleObject); + external static JSArray imports(Module moduleObject); + external static JSArray customSections( + Module moduleObject, + String sectionName, + ); +} +extension type Instance._(JSObject _) implements JSObject { + external factory Instance( + Module module, [ + JSObject importObject, + ]); + + external JSObject get exports; +} +extension type MemoryDescriptor._(JSObject _) implements JSObject { + external factory MemoryDescriptor({ + required int initial, + int maximum, + }); + + external int get initial; + external set initial(int value); + external int get maximum; + external set maximum(int value); +} +extension type Memory._(JSObject _) implements JSObject { + external factory Memory(MemoryDescriptor descriptor); + + external int grow(int delta); + external JSArrayBuffer get buffer; +} +extension type TableDescriptor._(JSObject _) implements JSObject { + external factory TableDescriptor({ + required TableKind element, + required int initial, + int maximum, + }); + + external TableKind get element; + external set element(TableKind value); + external int get initial; + external set initial(int value); + external int get maximum; + external set maximum(int value); +} +extension type Table._(JSObject _) implements JSObject { + external factory Table( + TableDescriptor descriptor, [ + JSAny? value, + ]); + + external int grow( + int delta, [ + JSAny? value, + ]); + external JSAny? get(int index); + external void set( + int index, [ + JSAny? value, + ]); + external int get length; +} +extension type GlobalDescriptor._(JSObject _) implements JSObject { + external factory GlobalDescriptor({ + required ValueType value, + bool mutable, + }); + + external ValueType get value; + external set value(ValueType value); + external bool get mutable; + external set mutable(bool value); +} +extension type Global._(JSObject _) implements JSObject { + external factory Global( + GlobalDescriptor descriptor, [ + JSAny? v, + ]); + + external JSAny? valueOf(); + external JSAny? get value; + external set value(JSAny? value); +} diff --git a/lib/src/dom/web_animations.dart b/lib/src/dom/web_animations.dart index 79de859a..ce82d017 100644 --- a/lib/src/dom/web_animations.dart +++ b/lib/src/dom/web_animations.dart @@ -24,7 +24,6 @@ typedef AnimationReplaceState = String; typedef FillMode = String; typedef PlaybackDirection = String; typedef CompositeOperation = String; -typedef CompositeOperationOrAuto = String; /// The `AnimationTimeline` interface of the /// [Web Animations API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Animations_API) @@ -40,14 +39,11 @@ typedef CompositeOperationOrAuto = String; /// API documentation sourced from /// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/AnimationTimeline). extension type AnimationTimeline._(JSObject _) implements JSObject { - external Animation play([AnimationEffect? effect]); - /// The **`currentTime`** read-only property of the /// [Web Animations API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Animations_API)'s /// [AnimationTimeline] interface returns the timeline's current time in /// milliseconds, or `null` if the timeline is inactive. external CSSNumberish? get currentTime; - external CSSNumberish? get duration; } extension type DocumentTimelineOptions._(JSObject _) implements JSObject { external factory DocumentTimelineOptions({DOMHighResTimeStamp originTime}); @@ -298,11 +294,6 @@ extension type Animation._(JSObject _) implements EventTarget, JSObject { /// API documentation sourced from /// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/AnimationEffect). extension type AnimationEffect._(JSObject _) implements JSObject { - external void before(AnimationEffect effects); - external void after(AnimationEffect effects); - external void replace(AnimationEffect effects); - external void remove(); - /// The `AnimationEffect.getTiming()` method of the [AnimationEffect] /// interface returns an object containing the timing properties for the /// Animation Effect. @@ -327,31 +318,20 @@ extension type AnimationEffect._(JSObject _) implements JSObject { /// The `updateTiming()` method of the [AnimationEffect] interface updates the /// specified timing properties for an animation effect. external void updateTiming([OptionalEffectTiming timing]); - external GroupEffect? get parent; - external AnimationEffect? get previousSibling; - external AnimationEffect? get nextSibling; } extension type EffectTiming._(JSObject _) implements JSObject { external factory EffectTiming({ - num delay, - num endDelay, - num playbackRate, - JSAny duration, FillMode fill, num iterationStart, num iterations, PlaybackDirection direction, String easing, + num delay, + num endDelay, + num playbackRate, + JSAny duration, }); - external num get delay; - external set delay(num value); - external num get endDelay; - external set endDelay(num value); - external num get playbackRate; - external set playbackRate(num value); - external JSAny get duration; - external set duration(JSAny value); external FillMode get fill; external set fill(FillMode value); external num get iterationStart; @@ -362,10 +342,17 @@ extension type EffectTiming._(JSObject _) implements JSObject { external set direction(PlaybackDirection value); external String get easing; external set easing(String value); + external num get delay; + external set delay(num value); + external num get endDelay; + external set endDelay(num value); + external num get playbackRate; + external set playbackRate(num value); + external JSAny get duration; + external set duration(JSAny value); } extension type OptionalEffectTiming._(JSObject _) implements JSObject { external factory OptionalEffectTiming({ - num playbackRate, num delay, num endDelay, FillMode fill, @@ -374,10 +361,9 @@ extension type OptionalEffectTiming._(JSObject _) implements JSObject { JSAny duration, PlaybackDirection direction, String easing, + num playbackRate, }); - external num get playbackRate; - external set playbackRate(num value); external num get delay; external set delay(num value); external num get endDelay; @@ -394,27 +380,33 @@ extension type OptionalEffectTiming._(JSObject _) implements JSObject { external set direction(PlaybackDirection value); external String get easing; external set easing(String value); + external num get playbackRate; + external set playbackRate(num value); } extension type ComputedEffectTiming._(JSObject _) implements EffectTiming, JSObject { external factory ComputedEffectTiming({ - num delay, - num endDelay, - num playbackRate, - JSAny duration, FillMode fill, num iterationStart, num iterations, PlaybackDirection direction, String easing, + num delay, + num endDelay, + num playbackRate, + JSAny duration, + num? progress, + num? currentIteration, CSSNumberish startTime, CSSNumberish endTime, CSSNumberish activeDuration, CSSNumberish? localTime, - num? progress, - num? currentIteration, }); + external num? get progress; + external set progress(num? value); + external num? get currentIteration; + external set currentIteration(num? value); external CSSNumberish get startTime; external set startTime(CSSNumberish value); external CSSNumberish get endTime; @@ -423,10 +415,6 @@ extension type ComputedEffectTiming._(JSObject _) external set activeDuration(CSSNumberish value); external CSSNumberish? get localTime; external set localTime(CSSNumberish? value); - external num? get progress; - external set progress(num? value); - external num? get currentIteration; - external set currentIteration(num? value); } /// The **`KeyframeEffect`** interface of the @@ -487,104 +475,59 @@ extension type KeyframeEffect._(JSObject _) external CompositeOperation get composite; external set composite(CompositeOperation value); } -extension type BaseComputedKeyframe._(JSObject _) implements JSObject { - external factory BaseComputedKeyframe({ - num? offset, - num computedOffset, - String easing, - CompositeOperationOrAuto composite, - }); - - external num? get offset; - external set offset(num? value); - external num get computedOffset; - external set computedOffset(num value); - external String get easing; - external set easing(String value); - external CompositeOperationOrAuto get composite; - external set composite(CompositeOperationOrAuto value); -} -extension type BasePropertyIndexedKeyframe._(JSObject _) implements JSObject { - external factory BasePropertyIndexedKeyframe({ - JSAny? offset, - JSAny easing, - JSAny composite, - }); - - external JSAny? get offset; - external set offset(JSAny? value); - external JSAny get easing; - external set easing(JSAny value); - external JSAny get composite; - external set composite(JSAny value); -} -extension type BaseKeyframe._(JSObject _) implements JSObject { - external factory BaseKeyframe({ - num? offset, - String easing, - CompositeOperationOrAuto composite, - }); - - external num? get offset; - external set offset(num? value); - external String get easing; - external set easing(String value); - external CompositeOperationOrAuto get composite; - external set composite(CompositeOperationOrAuto value); -} extension type KeyframeEffectOptions._(JSObject _) implements EffectTiming, JSObject { external factory KeyframeEffectOptions({ - num delay, - num endDelay, - num playbackRate, - JSAny duration, FillMode fill, num iterationStart, num iterations, PlaybackDirection direction, String easing, - IterationCompositeOperation iterationComposite, + num delay, + num endDelay, + num playbackRate, + JSAny duration, CompositeOperation composite, String? pseudoElement, + IterationCompositeOperation iterationComposite, }); - external IterationCompositeOperation get iterationComposite; - external set iterationComposite(IterationCompositeOperation value); external CompositeOperation get composite; external set composite(CompositeOperation value); external String? get pseudoElement; external set pseudoElement(String? value); + external IterationCompositeOperation get iterationComposite; + external set iterationComposite(IterationCompositeOperation value); } extension type KeyframeAnimationOptions._(JSObject _) implements KeyframeEffectOptions, JSObject { external factory KeyframeAnimationOptions({ - num delay, - num endDelay, - num playbackRate, - JSAny duration, FillMode fill, num iterationStart, num iterations, PlaybackDirection direction, String easing, - IterationCompositeOperation iterationComposite, + num delay, + num endDelay, + num playbackRate, + JSAny duration, CompositeOperation composite, String? pseudoElement, - JSAny rangeStart, - JSAny rangeEnd, + IterationCompositeOperation iterationComposite, String id, AnimationTimeline? timeline, + JSAny rangeStart, + JSAny rangeEnd, }); - external JSAny get rangeStart; - external set rangeStart(JSAny value); - external JSAny get rangeEnd; - external set rangeEnd(JSAny value); external String get id; external set id(String value); external AnimationTimeline? get timeline; external set timeline(AnimationTimeline? value); + external JSAny get rangeStart; + external set rangeStart(JSAny value); + external JSAny get rangeEnd; + external set rangeEnd(JSAny value); } extension type GetAnimationsOptions._(JSObject _) implements JSObject { external factory GetAnimationsOptions({bool subtree}); diff --git a/lib/src/dom/web_animations_2.dart b/lib/src/dom/web_animations_2.dart index 317ab355..41ab9d5e 100644 --- a/lib/src/dom/web_animations_2.dart +++ b/lib/src/dom/web_animations_2.dart @@ -15,35 +15,8 @@ import 'dart:js_interop'; import 'css_typed_om.dart'; import 'dom.dart'; -import 'web_animations.dart'; -typedef EffectCallback = JSFunction; typedef IterationCompositeOperation = String; -extension type GroupEffect._(JSObject _) implements JSObject { - external factory GroupEffect( - JSArray? children, [ - JSAny timing, - ]); - - external GroupEffect clone(); - external void prepend(AnimationEffect effects); - external void append(AnimationEffect effects); - external AnimationNodeList get children; - external AnimationEffect? get firstChild; - external AnimationEffect? get lastChild; -} -extension type AnimationNodeList._(JSObject _) implements JSObject { - external AnimationEffect? item(int index); - external int get length; -} -extension type SequenceEffect._(JSObject _) implements GroupEffect, JSObject { - external factory SequenceEffect( - JSArray? children, [ - JSAny timing, - ]); - - external SequenceEffect clone(); -} extension type TimelineRangeOffset._(JSObject _) implements JSObject { external factory TimelineRangeOffset({ String? rangeName, diff --git a/lib/src/dom/web_bluetooth.dart b/lib/src/dom/web_bluetooth.dart new file mode 100644 index 00000000..9ef4df5a --- /dev/null +++ b/lib/src/dom/web_bluetooth.dart @@ -0,0 +1,25 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. +// +// API docs from [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web). +// Attributions and copyright licensing by Mozilla Contributors is licensed +// under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/. + +// Generated from Web IDL definitions. + +@JS() +library; + +import 'dart:js_interop'; + +/// The **`BluetoothUUID`** interface of the [Web Bluetooth API] provides a way +/// to look up Universally Unique Identifier (UUID) values by name in the +/// [registry](https://www.bluetooth.com/specifications/assigned-numbers/) +/// maintained by the Bluetooth SIG. +/// +/// --- +/// +/// API documentation sourced from +/// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/BluetoothUUID). +extension type BluetoothUUID._(JSObject _) implements JSObject {} diff --git a/lib/src/dom/web_otp.dart b/lib/src/dom/web_otp.dart new file mode 100644 index 00000000..eaa56f48 --- /dev/null +++ b/lib/src/dom/web_otp.dart @@ -0,0 +1,22 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. +// +// API docs from [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web). +// Attributions and copyright licensing by Mozilla Contributors is licensed +// under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/. + +// Generated from Web IDL definitions. + +@JS() +library; + +import 'dart:js_interop'; + +typedef OTPCredentialTransportType = String; +extension type OTPCredentialRequestOptions._(JSObject _) implements JSObject { + external factory OTPCredentialRequestOptions({JSArray transport}); + + external JSArray get transport; + external set transport(JSArray value); +} diff --git a/lib/src/dom/web_share.dart b/lib/src/dom/web_share.dart new file mode 100644 index 00000000..f61e7172 --- /dev/null +++ b/lib/src/dom/web_share.dart @@ -0,0 +1,34 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. +// +// API docs from [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web). +// Attributions and copyright licensing by Mozilla Contributors is licensed +// under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/. + +// Generated from Web IDL definitions. + +@JS() +library; + +import 'dart:js_interop'; + +import 'fileapi.dart'; + +extension type ShareData._(JSObject _) implements JSObject { + external factory ShareData({ + JSArray files, + String title, + String text, + String url, + }); + + external JSArray get files; + external set files(JSArray value); + external String get title; + external set title(String value); + external String get text; + external set text(String value); + external String get url; + external set url(String value); +} diff --git a/lib/src/dom/webaudio.dart b/lib/src/dom/webaudio.dart index 93e1496b..ec481616 100644 --- a/lib/src/dom/webaudio.dart +++ b/lib/src/dom/webaudio.dart @@ -21,7 +21,6 @@ import 'mediacapture_streams.dart'; typedef DecodeErrorCallback = JSFunction; typedef DecodeSuccessCallback = JSFunction; typedef AudioWorkletProcessorConstructor = JSFunction; -typedef AudioWorkletProcessCallback = JSFunction; typedef AudioContextState = String; typedef AudioContextRenderSizeCategory = String; typedef AudioContextLatencyCategory = String; @@ -324,7 +323,6 @@ extension type BaseAudioContext._(JSObject _) implements EventTarget, JSObject { /// The `state` read-only property of the [BaseAudioContext] /// interface returns the current state of the `AudioContext`. external AudioContextState get state; - external int get renderQuantumSize; /// The `audioWorklet` read-only property of the /// [BaseAudioContext] interface returns an instance of @@ -407,20 +405,6 @@ extension type AudioContext._(JSObject _) /// [OfflineAudioContext]. external JSPromise close(); - /// The **`setSinkId()`** method of the [AudioContext] interface sets the - /// output audio device for the `AudioContext`. If a sink ID is not explicitly - /// set, the default system audio output device will be used. - /// - /// To set the audio device to a device different than the default one, the - /// developer needs permission to access to audio devices. If required, the - /// user can be prompted to grant the required permission via a - /// [MediaDevices.getUserMedia] call. - /// - /// In addition, this feature may be blocked by a - /// [`speaker-selection`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Permissions-Policy/speaker-selection) - /// [Permissions Policy](https://developer.mozilla.org/en-US/docs/Web/HTTP/Permissions_Policy). - external JSPromise setSinkId(JSAny sinkId); - /// The `createMediaElementSource()` method of the [AudioContext] Interface is /// used to create a new [MediaElementAudioSourceNode] object, given an /// existing HTML `audio` or `video` element, the audio from which can then be @@ -495,14 +479,6 @@ extension type AudioContext._(JSObject _) /// /// It varies depending on the platform and the available hardware. external num get outputLatency; - - /// The **`sinkId`** read-only property of the - /// [AudioContext] interface returns the sink ID of the current output audio - /// device. - external JSAny get sinkId; - external AudioRenderCapacity get renderCapacity; - external EventHandler get onsinkchange; - external set onsinkchange(EventHandler value); } extension type AudioContextOptions._(JSObject _) implements JSObject { external factory AudioContextOptions({ @@ -527,20 +503,6 @@ extension type AudioSinkOptions._(JSObject _) implements JSObject { external AudioSinkType get type; external set type(AudioSinkType value); } - -/// The **`AudioSinkInfo`** interface of the [Web Audio API] represents -/// information describing an [AudioContext]'s sink ID, retrieved via -/// [AudioContext.sinkId]. -/// -/// --- -/// -/// API documentation sourced from -/// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/AudioSinkInfo). -extension type AudioSinkInfo._(JSObject _) implements JSObject { - /// The **`type`** read-only property of the [AudioSinkInfo] interface returns - /// the type of the audio output device. - external AudioSinkType get type; -} extension type AudioTimestamp._(JSObject _) implements JSObject { external factory AudioTimestamp({ num contextTime, @@ -552,52 +514,6 @@ extension type AudioTimestamp._(JSObject _) implements JSObject { external DOMHighResTimeStamp get performanceTime; external set performanceTime(DOMHighResTimeStamp value); } -extension type AudioRenderCapacity._(JSObject _) - implements EventTarget, JSObject { - external void start([AudioRenderCapacityOptions options]); - external void stop(); - external EventHandler get onupdate; - external set onupdate(EventHandler value); -} -extension type AudioRenderCapacityOptions._(JSObject _) implements JSObject { - external factory AudioRenderCapacityOptions({num updateInterval}); - - external num get updateInterval; - external set updateInterval(num value); -} -extension type AudioRenderCapacityEvent._(JSObject _) - implements Event, JSObject { - external factory AudioRenderCapacityEvent( - String type, [ - AudioRenderCapacityEventInit eventInitDict, - ]); - - external num get timestamp; - external num get averageLoad; - external num get peakLoad; - external num get underrunRatio; -} -extension type AudioRenderCapacityEventInit._(JSObject _) - implements EventInit, JSObject { - external factory AudioRenderCapacityEventInit({ - bool bubbles, - bool cancelable, - bool composed, - num timestamp, - num averageLoad, - num peakLoad, - num underrunRatio, - }); - - external num get timestamp; - external set timestamp(num value); - external num get averageLoad; - external set averageLoad(num value); - external num get peakLoad; - external set peakLoad(num value); - external num get underrunRatio; - external set underrunRatio(num value); -} /// The `OfflineAudioContext` interface is an [AudioContext] interface /// representing an audio-processing graph built from linked together @@ -3496,9 +3412,7 @@ extension type WaveShaperOptions._(JSObject _) /// /// API documentation sourced from /// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/AudioWorklet). -extension type AudioWorklet._(JSObject _) implements Worklet, JSObject { - external MessagePort get port; -} +extension type AudioWorklet._(JSObject _) implements Worklet, JSObject {} /// The **`AudioWorkletGlobalScope`** interface of the /// [Web Audio API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Audio_API) @@ -3545,8 +3459,6 @@ extension type AudioWorkletGlobalScope._(JSObject _) /// interface returns a float that represents the sample rate of the /// associated [BaseAudioContext] the worklet belongs to. external num get sampleRate; - external int get renderQuantumSize; - external MessagePort get port; } /// The **`AudioParamMap`** interface of the @@ -3655,39 +3567,3 @@ extension type AudioWorkletProcessor._(JSObject _) implements JSObject { /// > available under the [AudioWorkletNode.port] property of the node. external MessagePort get port; } - -/// The **`AudioParamDescriptor`** dictionary of the -/// [Web Audio API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Audio_API) -/// specifies properties for [AudioParam] objects. -/// -/// It is used to create custom `AudioParam`s on an [AudioWorkletNode]. If the -/// underlying [AudioWorkletProcessor] has a -/// [AudioWorkletProcessor.parameterDescriptors] static getter, then the -/// returned array of objects based on this dictionary is used internally by -/// `AudioWorkletNode` constructor to populate its [AudioWorkletNode.parameters] -/// property accordingly. -/// -/// --- -/// -/// API documentation sourced from -/// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/AudioParamDescriptor). -extension type AudioParamDescriptor._(JSObject _) implements JSObject { - external factory AudioParamDescriptor({ - required String name, - num defaultValue, - num minValue, - num maxValue, - AutomationRate automationRate, - }); - - external String get name; - external set name(String value); - external num get defaultValue; - external set defaultValue(num value); - external num get minValue; - external set minValue(num value); - external num get maxValue; - external set maxValue(num value); - external AutomationRate get automationRate; - external set automationRate(AutomationRate value); -} diff --git a/lib/src/dom/webauthn.dart b/lib/src/dom/webauthn.dart index 05a74fb1..1bbee1d8 100644 --- a/lib/src/dom/webauthn.dart +++ b/lib/src/dom/webauthn.dart @@ -14,24 +14,13 @@ library; import 'dart:js_interop'; import 'credential_management.dart'; +import 'fido.dart'; +import 'secure_payment_confirmation.dart'; import 'webidl.dart'; -typedef Base64URLString = String; -typedef PublicKeyCredentialJSON = JSObject; -typedef PublicKeyCredentialClientCapabilities = JSObject; typedef COSEAlgorithmIdentifier = int; typedef UvmEntry = JSArray; typedef UvmEntries = JSArray; -typedef AuthenticatorAttachment = String; -typedef ResidentKeyRequirement = String; -typedef AttestationConveyancePreference = String; -typedef TokenBindingStatus = String; -typedef PublicKeyCredentialType = String; -typedef AuthenticatorTransport = String; -typedef UserVerificationRequirement = String; -typedef ClientCapability = String; -typedef PublicKeyCredentialHints = String; -typedef LargeBlobSupport = String; /// The **`PublicKeyCredential`** interface provides information about a public /// key / private key pair, which is a credential for logging in to a service @@ -84,13 +73,6 @@ extension type PublicKeyCredential._(JSObject _) external static JSPromise isConditionalMediationAvailable(); external static JSPromise isUserVerifyingPlatformAuthenticatorAvailable(); - external static JSPromise - getClientCapabilities(); - external static PublicKeyCredentialCreationOptions - parseCreationOptionsFromJSON( - PublicKeyCredentialCreationOptionsJSON options); - external static PublicKeyCredentialRequestOptions parseRequestOptionsFromJSON( - PublicKeyCredentialRequestOptionsJSON options); /// The **`getClientExtensionResults()`** method of the /// [PublicKeyCredential] interface returns a map between the identifiers of @@ -112,26 +94,6 @@ extension type PublicKeyCredential._(JSObject _) /// > available in [AuthenticatorAssertionResponse.authenticatorData]. external AuthenticationExtensionsClientOutputs getClientExtensionResults(); - /// The **`toJSON()`** method of the [PublicKeyCredential] interface returns a - /// of a [PublicKeyCredential]. - /// - /// The properties of the returned object depend on whether the credential is - /// returned by - /// [`navigator.credentials.create()`](https://developer.mozilla.org/en-US/docs/Web/API/CredentialsContainer/create) - /// when - /// [creating a key pair and registering a user](https://developer.mozilla.org/en-US/docs/Web/API/Web_Authentication_API#creating_a_key_pair_and_registering_a_user), - /// or - /// [`navigator.credentials.get()`](https://developer.mozilla.org/en-US/docs/Web/API/CredentialsContainer/get) - /// when - /// [authenticating a user](https://developer.mozilla.org/en-US/docs/Web/API/Web_Authentication_API#authenticating_a_user). - /// - /// This method is automatically invoked when web app code calls - /// [`JSON.stringify()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify) - /// to serialize a [PublicKeyCredential] so that it can be sent to relying - /// party server when registering or authenticating a user. - /// It not intended to be called directly in web app code. - external PublicKeyCredentialJSON toJSON(); - /// The **`rawId`** read-only property of the /// [PublicKeyCredential] interface is an `ArrayBuffer` object /// containing the identifier of the credentials. @@ -185,202 +147,6 @@ extension type PublicKeyCredential._(JSObject _) /// [CredentialsContainer.create] or [CredentialsContainer.get] call. external String? get authenticatorAttachment; } -extension type RegistrationResponseJSON._(JSObject _) implements JSObject { - external factory RegistrationResponseJSON({ - required Base64URLString id, - required Base64URLString rawId, - required AuthenticatorAttestationResponseJSON response, - String authenticatorAttachment, - required AuthenticationExtensionsClientOutputsJSON clientExtensionResults, - required String type, - }); - - external Base64URLString get id; - external set id(Base64URLString value); - external Base64URLString get rawId; - external set rawId(Base64URLString value); - external AuthenticatorAttestationResponseJSON get response; - external set response(AuthenticatorAttestationResponseJSON value); - external String get authenticatorAttachment; - external set authenticatorAttachment(String value); - external AuthenticationExtensionsClientOutputsJSON get clientExtensionResults; - external set clientExtensionResults( - AuthenticationExtensionsClientOutputsJSON value); - external String get type; - external set type(String value); -} -extension type AuthenticatorAttestationResponseJSON._(JSObject _) - implements JSObject { - external factory AuthenticatorAttestationResponseJSON({ - required Base64URLString clientDataJSON, - required Base64URLString authenticatorData, - required JSArray transports, - Base64URLString publicKey, - required int publicKeyAlgorithm, - required Base64URLString attestationObject, - }); - - external Base64URLString get clientDataJSON; - external set clientDataJSON(Base64URLString value); - external Base64URLString get authenticatorData; - external set authenticatorData(Base64URLString value); - external JSArray get transports; - external set transports(JSArray value); - external Base64URLString get publicKey; - external set publicKey(Base64URLString value); - external int get publicKeyAlgorithm; - external set publicKeyAlgorithm(int value); - external Base64URLString get attestationObject; - external set attestationObject(Base64URLString value); -} -extension type AuthenticationResponseJSON._(JSObject _) implements JSObject { - external factory AuthenticationResponseJSON({ - required Base64URLString id, - required Base64URLString rawId, - required AuthenticatorAssertionResponseJSON response, - String authenticatorAttachment, - required AuthenticationExtensionsClientOutputsJSON clientExtensionResults, - required String type, - }); - - external Base64URLString get id; - external set id(Base64URLString value); - external Base64URLString get rawId; - external set rawId(Base64URLString value); - external AuthenticatorAssertionResponseJSON get response; - external set response(AuthenticatorAssertionResponseJSON value); - external String get authenticatorAttachment; - external set authenticatorAttachment(String value); - external AuthenticationExtensionsClientOutputsJSON get clientExtensionResults; - external set clientExtensionResults( - AuthenticationExtensionsClientOutputsJSON value); - external String get type; - external set type(String value); -} -extension type AuthenticatorAssertionResponseJSON._(JSObject _) - implements JSObject { - external factory AuthenticatorAssertionResponseJSON({ - required Base64URLString clientDataJSON, - required Base64URLString authenticatorData, - required Base64URLString signature, - Base64URLString userHandle, - }); - - external Base64URLString get clientDataJSON; - external set clientDataJSON(Base64URLString value); - external Base64URLString get authenticatorData; - external set authenticatorData(Base64URLString value); - external Base64URLString get signature; - external set signature(Base64URLString value); - external Base64URLString get userHandle; - external set userHandle(Base64URLString value); -} -extension type AuthenticationExtensionsClientOutputsJSON._(JSObject _) - implements JSObject { - AuthenticationExtensionsClientOutputsJSON() : _ = JSObject(); -} -extension type PublicKeyCredentialCreationOptionsJSON._(JSObject _) - implements JSObject { - external factory PublicKeyCredentialCreationOptionsJSON({ - required PublicKeyCredentialRpEntity rp, - required PublicKeyCredentialUserEntityJSON user, - required Base64URLString challenge, - required JSArray pubKeyCredParams, - int timeout, - JSArray excludeCredentials, - AuthenticatorSelectionCriteria authenticatorSelection, - JSArray hints, - String attestation, - JSArray attestationFormats, - AuthenticationExtensionsClientInputsJSON extensions, - }); - - external PublicKeyCredentialRpEntity get rp; - external set rp(PublicKeyCredentialRpEntity value); - external PublicKeyCredentialUserEntityJSON get user; - external set user(PublicKeyCredentialUserEntityJSON value); - external Base64URLString get challenge; - external set challenge(Base64URLString value); - external JSArray get pubKeyCredParams; - external set pubKeyCredParams(JSArray value); - external int get timeout; - external set timeout(int value); - external JSArray get excludeCredentials; - external set excludeCredentials( - JSArray value); - external AuthenticatorSelectionCriteria get authenticatorSelection; - external set authenticatorSelection(AuthenticatorSelectionCriteria value); - external JSArray get hints; - external set hints(JSArray value); - external String get attestation; - external set attestation(String value); - external JSArray get attestationFormats; - external set attestationFormats(JSArray value); - external AuthenticationExtensionsClientInputsJSON get extensions; - external set extensions(AuthenticationExtensionsClientInputsJSON value); -} -extension type PublicKeyCredentialUserEntityJSON._(JSObject _) - implements JSObject { - external factory PublicKeyCredentialUserEntityJSON({ - required Base64URLString id, - required String name, - required String displayName, - }); - - external Base64URLString get id; - external set id(Base64URLString value); - external String get name; - external set name(String value); - external String get displayName; - external set displayName(String value); -} -extension type PublicKeyCredentialDescriptorJSON._(JSObject _) - implements JSObject { - external factory PublicKeyCredentialDescriptorJSON({ - required Base64URLString id, - required String type, - JSArray transports, - }); - - external Base64URLString get id; - external set id(Base64URLString value); - external String get type; - external set type(String value); - external JSArray get transports; - external set transports(JSArray value); -} -extension type AuthenticationExtensionsClientInputsJSON._(JSObject _) - implements JSObject { - AuthenticationExtensionsClientInputsJSON() : _ = JSObject(); -} -extension type PublicKeyCredentialRequestOptionsJSON._(JSObject _) - implements JSObject { - external factory PublicKeyCredentialRequestOptionsJSON({ - required Base64URLString challenge, - int timeout, - String rpId, - JSArray allowCredentials, - String userVerification, - JSArray hints, - AuthenticationExtensionsClientInputsJSON extensions, - }); - - external Base64URLString get challenge; - external set challenge(Base64URLString value); - external int get timeout; - external set timeout(int value); - external String get rpId; - external set rpId(String value); - external JSArray get allowCredentials; - external set allowCredentials( - JSArray value); - external String get userVerification; - external set userVerification(String value); - external JSArray get hints; - external set hints(JSArray value); - external AuthenticationExtensionsClientInputsJSON get extensions; - external set extensions(AuthenticationExtensionsClientInputsJSON value); -} /// The **`AuthenticatorResponse`** interface of the /// [Web Authentication API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Authentication_API) @@ -671,6 +437,14 @@ extension type PublicKeyCredentialRequestOptions._(JSObject _) extension type AuthenticationExtensionsClientInputs._(JSObject _) implements JSObject { external factory AuthenticationExtensionsClientInputs({ + String credentialProtectionPolicy, + bool enforceCredentialProtectionPolicy, + JSArrayBuffer credBlob, + bool getCredBlob, + bool minPinLength, + bool hmacCreateSecret, + HMACGetSecretInput hmacGetSecret, + AuthenticationExtensionsPaymentInputs payment, String appid, String appidExclude, bool credProps, @@ -680,6 +454,22 @@ extension type AuthenticationExtensionsClientInputs._(JSObject _) AuthenticationExtensionsSupplementalPubKeysInputs supplementalPubKeys, }); + external String get credentialProtectionPolicy; + external set credentialProtectionPolicy(String value); + external bool get enforceCredentialProtectionPolicy; + external set enforceCredentialProtectionPolicy(bool value); + external JSArrayBuffer get credBlob; + external set credBlob(JSArrayBuffer value); + external bool get getCredBlob; + external set getCredBlob(bool value); + external bool get minPinLength; + external set minPinLength(bool value); + external bool get hmacCreateSecret; + external set hmacCreateSecret(bool value); + external HMACGetSecretInput get hmacGetSecret; + external set hmacGetSecret(HMACGetSecretInput value); + external AuthenticationExtensionsPaymentInputs get payment; + external set payment(AuthenticationExtensionsPaymentInputs value); external String get appid; external set appid(String value); external String get appidExclude; @@ -700,6 +490,8 @@ extension type AuthenticationExtensionsClientInputs._(JSObject _) extension type AuthenticationExtensionsClientOutputs._(JSObject _) implements JSObject { external factory AuthenticationExtensionsClientOutputs({ + bool hmacCreateSecret, + HMACGetSecretOutput hmacGetSecret, bool appid, bool appidExclude, CredentialPropertiesOutput credProps, @@ -709,6 +501,10 @@ extension type AuthenticationExtensionsClientOutputs._(JSObject _) AuthenticationExtensionsSupplementalPubKeysOutputs supplementalPubKeys, }); + external bool get hmacCreateSecret; + external set hmacCreateSecret(bool value); + external HMACGetSecretOutput get hmacGetSecret; + external set hmacGetSecret(HMACGetSecretOutput value); external bool get appid; external set appid(bool value); external bool get appidExclude; @@ -726,37 +522,6 @@ extension type AuthenticationExtensionsClientOutputs._(JSObject _) external set supplementalPubKeys( AuthenticationExtensionsSupplementalPubKeysOutputs value); } -extension type CollectedClientData._(JSObject _) implements JSObject { - external factory CollectedClientData({ - required String type, - required String challenge, - required String origin, - String topOrigin, - bool crossOrigin, - }); - - external String get type; - external set type(String value); - external String get challenge; - external set challenge(String value); - external String get origin; - external set origin(String value); - external String get topOrigin; - external set topOrigin(String value); - external bool get crossOrigin; - external set crossOrigin(bool value); -} -extension type TokenBinding._(JSObject _) implements JSObject { - external factory TokenBinding({ - required String status, - String id, - }); - - external String get status; - external set status(String value); - external String get id; - external set id(String value); -} extension type PublicKeyCredentialDescriptor._(JSObject _) implements JSObject { external factory PublicKeyCredentialDescriptor({ required String type, diff --git a/lib/src/dom/webcodecs.dart b/lib/src/dom/webcodecs.dart new file mode 100644 index 00000000..dc222a04 --- /dev/null +++ b/lib/src/dom/webcodecs.dart @@ -0,0 +1,569 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. +// +// API docs from [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web). +// Attributions and copyright licensing by Mozilla Contributors is licensed +// under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/. + +// Generated from Web IDL definitions. + +@JS() +library; + +import 'dart:js_interop'; + +import 'dom.dart'; +import 'geometry.dart'; +import 'html.dart'; +import 'webcodecs_av1_codec_registration.dart'; +import 'webcodecs_avc_codec_registration.dart'; +import 'webcodecs_hevc_codec_registration.dart'; +import 'webcodecs_vp9_codec_registration.dart'; +import 'webidl.dart'; + +typedef VideoFrameOutputCallback = JSFunction; +typedef EncodedVideoChunkOutputCallback = JSFunction; +typedef WebCodecsErrorCallback = JSFunction; +typedef HardwareAcceleration = String; +typedef AlphaOption = String; +typedef LatencyMode = String; +typedef VideoEncoderBitrateMode = String; +typedef CodecState = String; +typedef EncodedVideoChunkType = String; +typedef VideoPixelFormat = String; +typedef VideoColorPrimaries = String; +typedef VideoTransferCharacteristics = String; +typedef VideoMatrixCoefficients = String; + +/// The **`VideoDecoder`** interface of the [WebCodecs API] decodes chunks of +/// video. +/// +/// --- +/// +/// API documentation sourced from +/// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/VideoDecoder). +extension type VideoDecoder._(JSObject _) implements EventTarget, JSObject { + external factory VideoDecoder(VideoDecoderInit init); + + external static JSPromise isConfigSupported( + VideoDecoderConfig config); + + /// The **`configure()`** method of the [VideoDecoder] interface enqueues a + /// control message to configure the video decoder for decoding chunks. + external void configure(VideoDecoderConfig config); + + /// The **`decode()`** method of the [VideoDecoder] interface enqueues a + /// control message to decode a given chunk of video. + external void decode(EncodedVideoChunk chunk); + + /// The **`flush()`** method of the [VideoDecoder] interface returns a Promise + /// that resolves once all pending messages in the queue have been completed. + external JSPromise flush(); + + /// The **`reset()`** method of the [VideoDecoder] interface resets all states + /// including configuration, control messages in the control message queue, + /// and all pending callbacks. + external void reset(); + + /// The **`close()`** method of the [VideoDecoder] interface ends all pending + /// work and releases system resources. + external void close(); + + /// The **`state`** property of the [VideoDecoder] interface returns the + /// current state of the underlying codec. + external CodecState get state; + + /// The **`decodeQueueSize`** read-only property of the [VideoDecoder] + /// interface returns the number of pending decode requests in the queue. + external int get decodeQueueSize; + external EventHandler get ondequeue; + external set ondequeue(EventHandler value); +} +extension type VideoDecoderInit._(JSObject _) implements JSObject { + external factory VideoDecoderInit({ + required VideoFrameOutputCallback output, + required WebCodecsErrorCallback error, + }); + + external VideoFrameOutputCallback get output; + external set output(VideoFrameOutputCallback value); + external WebCodecsErrorCallback get error; + external set error(WebCodecsErrorCallback value); +} + +/// The **`VideoEncoder`** interface of the [WebCodecs API] encodes [VideoFrame] +/// objects into [EncodedVideoChunk]s. +/// +/// --- +/// +/// API documentation sourced from +/// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/VideoEncoder). +extension type VideoEncoder._(JSObject _) implements EventTarget, JSObject { + external factory VideoEncoder(VideoEncoderInit init); + + external static JSPromise isConfigSupported( + VideoEncoderConfig config); + + /// The **`configure()`** method of the [VideoEncoder] interface changes the + /// [VideoEncoder.state] of the encoder to "configured" and asynchronously + /// prepares the encoder to accept [VideoEncoder]s for encoding with the + /// specified parameters. If the encoder doesn't support the specified + /// parameters or can't be initialized for other reasons an error will be + /// reported via the error callback provided to the [VideoEncoder] + /// constructor. + /// + /// If the [VideoEncoder] has been previously configured, the new + /// configuration will not be applied until all previous tasks have completed. + external void configure(VideoEncoderConfig config); + + /// The **`encode()`** method of the [VideoEncoder] interface asynchronously + /// encodes a [VideoFrame]. + /// Encoded data ([EncodedVideoChunk]) or an error will eventually be returned + /// via the callbacks provided to the [VideoEncoder] constructor. + external void encode( + VideoFrame frame, [ + VideoEncoderEncodeOptions options, + ]); + + /// The **`flush()`** method of the [VideoEncoder] interface forces all + /// pending encodes to complete. + external JSPromise flush(); + + /// The **`reset()`** method of the [VideoEncoder] interface synchronously + /// cancels all pending encodes and callbacks, frees all underlying resources + /// and sets the [VideoEncoder.state] to "unconfigured". + /// After calling [VideoEncoder.reset], [VideoEncoder.configure] must be + /// called before resuming [VideoEncoder.encode] calls. + /// + /// > **Note:** To avoid discarding frames queued via [VideoEncoder.encode], + /// > [VideoEncoder.flush] should be called and completed before calling + /// > [VideoEncoder.reset]. + external void reset(); + + /// The **`close()`** method of the [VideoEncoder] interface ends all pending + /// work and releases system resources. + external void close(); + + /// The **`state`** read-only property of the [VideoEncoder] interface returns + /// the current state of the underlying codec. + external CodecState get state; + + /// The **`encodeQueueSize`** read-only property of the [VideoEncoder] + /// interface returns the number of pending encode requests in the queue. + external int get encodeQueueSize; + external EventHandler get ondequeue; + external set ondequeue(EventHandler value); +} +extension type VideoEncoderInit._(JSObject _) implements JSObject { + external factory VideoEncoderInit({ + required EncodedVideoChunkOutputCallback output, + required WebCodecsErrorCallback error, + }); + + external EncodedVideoChunkOutputCallback get output; + external set output(EncodedVideoChunkOutputCallback value); + external WebCodecsErrorCallback get error; + external set error(WebCodecsErrorCallback value); +} +extension type VideoDecoderSupport._(JSObject _) implements JSObject { + external factory VideoDecoderSupport({ + bool supported, + VideoDecoderConfig config, + }); + + external bool get supported; + external set supported(bool value); + external VideoDecoderConfig get config; + external set config(VideoDecoderConfig value); +} +extension type VideoEncoderSupport._(JSObject _) implements JSObject { + external factory VideoEncoderSupport({ + bool supported, + VideoEncoderConfig config, + }); + + external bool get supported; + external set supported(bool value); + external VideoEncoderConfig get config; + external set config(VideoEncoderConfig value); +} +extension type VideoDecoderConfig._(JSObject _) implements JSObject { + external factory VideoDecoderConfig({ + required String codec, + AllowSharedBufferSource description, + int codedWidth, + int codedHeight, + int displayAspectWidth, + int displayAspectHeight, + VideoColorSpaceInit colorSpace, + HardwareAcceleration hardwareAcceleration, + bool optimizeForLatency, + }); + + external String get codec; + external set codec(String value); + external AllowSharedBufferSource get description; + external set description(AllowSharedBufferSource value); + external int get codedWidth; + external set codedWidth(int value); + external int get codedHeight; + external set codedHeight(int value); + external int get displayAspectWidth; + external set displayAspectWidth(int value); + external int get displayAspectHeight; + external set displayAspectHeight(int value); + external VideoColorSpaceInit get colorSpace; + external set colorSpace(VideoColorSpaceInit value); + external HardwareAcceleration get hardwareAcceleration; + external set hardwareAcceleration(HardwareAcceleration value); + external bool get optimizeForLatency; + external set optimizeForLatency(bool value); +} +extension type VideoEncoderConfig._(JSObject _) implements JSObject { + external factory VideoEncoderConfig({ + required String codec, + required int width, + required int height, + int displayWidth, + int displayHeight, + int bitrate, + num framerate, + HardwareAcceleration hardwareAcceleration, + AlphaOption alpha, + String scalabilityMode, + VideoEncoderBitrateMode bitrateMode, + LatencyMode latencyMode, + String contentHint, + AV1EncoderConfig av1, + AvcEncoderConfig avc, + HevcEncoderConfig hevc, + }); + + external String get codec; + external set codec(String value); + external int get width; + external set width(int value); + external int get height; + external set height(int value); + external int get displayWidth; + external set displayWidth(int value); + external int get displayHeight; + external set displayHeight(int value); + external int get bitrate; + external set bitrate(int value); + external num get framerate; + external set framerate(num value); + external HardwareAcceleration get hardwareAcceleration; + external set hardwareAcceleration(HardwareAcceleration value); + external AlphaOption get alpha; + external set alpha(AlphaOption value); + external String get scalabilityMode; + external set scalabilityMode(String value); + external VideoEncoderBitrateMode get bitrateMode; + external set bitrateMode(VideoEncoderBitrateMode value); + external LatencyMode get latencyMode; + external set latencyMode(LatencyMode value); + external String get contentHint; + external set contentHint(String value); + external AV1EncoderConfig get av1; + external set av1(AV1EncoderConfig value); + external AvcEncoderConfig get avc; + external set avc(AvcEncoderConfig value); + external HevcEncoderConfig get hevc; + external set hevc(HevcEncoderConfig value); +} +extension type VideoEncoderEncodeOptions._(JSObject _) implements JSObject { + external factory VideoEncoderEncodeOptions({ + bool keyFrame, + VideoEncoderEncodeOptionsForAv1 av1, + VideoEncoderEncodeOptionsForAvc avc, + VideoEncoderEncodeOptionsForHevc hevc, + VideoEncoderEncodeOptionsForVp9 vp9, + }); + + external bool get keyFrame; + external set keyFrame(bool value); + external VideoEncoderEncodeOptionsForAv1 get av1; + external set av1(VideoEncoderEncodeOptionsForAv1 value); + external VideoEncoderEncodeOptionsForAvc get avc; + external set avc(VideoEncoderEncodeOptionsForAvc value); + external VideoEncoderEncodeOptionsForHevc get hevc; + external set hevc(VideoEncoderEncodeOptionsForHevc value); + external VideoEncoderEncodeOptionsForVp9 get vp9; + external set vp9(VideoEncoderEncodeOptionsForVp9 value); +} + +/// The **`EncodedVideoChunk`** interface of the [WebCodecs API] represents a +/// chunk of encoded video data. +/// +/// --- +/// +/// API documentation sourced from +/// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/EncodedVideoChunk). +extension type EncodedVideoChunk._(JSObject _) implements JSObject { + external factory EncodedVideoChunk(EncodedVideoChunkInit init); + + /// The **`copyTo()`** method of the [EncodedVideoChunk] interface copies the + /// encoded chunk of video data. + external void copyTo(AllowSharedBufferSource destination); + + /// The **`type`** read-only property of the [EncodedVideoChunk] interface + /// returns a value indicating whether the video chunk is a key chunk, which + /// does not rely on other frames for decoding. + external EncodedVideoChunkType get type; + + /// The **`timestamp`** read-only property of the [EncodedVideoChunk] + /// interface returns an integer indicating the timestamp of the video in + /// microseconds. + external int get timestamp; + + /// The **`duration`** read-only property of the [EncodedVideoChunk] interface + /// returns an integer indicating the duration of the video in microseconds. + external int? get duration; + + /// The **`byteLength`** read-only property of the [EncodedVideoChunk] + /// interface returns the length in bytes of the encoded video data. + external int get byteLength; +} +extension type EncodedVideoChunkInit._(JSObject _) implements JSObject { + external factory EncodedVideoChunkInit({ + required EncodedVideoChunkType type, + required int timestamp, + int duration, + required AllowSharedBufferSource data, + JSArray transfer, + }); + + external EncodedVideoChunkType get type; + external set type(EncodedVideoChunkType value); + external int get timestamp; + external set timestamp(int value); + external int get duration; + external set duration(int value); + external AllowSharedBufferSource get data; + external set data(AllowSharedBufferSource value); + external JSArray get transfer; + external set transfer(JSArray value); +} + +/// The **`VideoFrame`** interface of the +/// [Web Codecs API](https://developer.mozilla.org/en-US/docs/Web/API/WebCodecs_API) +/// represents a frame of a video. +/// +/// `VideoFrame` is a +/// [transferable object](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Transferable_objects). +/// +/// --- +/// +/// API documentation sourced from +/// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/VideoFrame). +extension type VideoFrame._(JSObject _) implements JSObject { + external factory VideoFrame( + JSObject dataOrImage, [ + JSObject init, + ]); + + /// The **`allocationSize()`** method of the [VideoFrame] interface returns + /// the number of bytes required to hold the video as filtered by options + /// passed into the method. + external int allocationSize([VideoFrameCopyToOptions options]); + + /// The **`copyTo()`** method of the [VideoFrame] interface copies the + /// contents of the `VideoFrame` to an `ArrayBuffer`. + external JSPromise> copyTo( + AllowSharedBufferSource destination, [ + VideoFrameCopyToOptions options, + ]); + + /// The **`clone()`** method of the [VideoFrame] interface creates a new + /// `VideoFrame` object referencing the same media resource as the original. + external VideoFrame clone(); + + /// The **`close()`** method of the [VideoFrame] interface clears all states + /// and releases the reference to the media resource. + external void close(); + + /// The **`format`** property of the [VideoFrame] interface returns the pixel + /// format of the `VideoFrame`. + external VideoPixelFormat? get format; + + /// The **`codedWidth`** property of the [VideoFrame] interface returns the + /// width of the `VideoFrame` in pixels, potentially including non-visible + /// padding, and prior to considering potential ratio adjustments. + external int get codedWidth; + + /// The **`codedHeight`** property of the [VideoFrame] interface returns the + /// height of the VideoFrame in pixels, potentially including non-visible + /// padding, and prior to considering potential ratio adjustments. + external int get codedHeight; + + /// The **`codedRect`** property of the [VideoFrame] interface returns a + /// [DOMRectReadOnly] with the width and height matching + /// [VideoFrame.codedWidth] and [VideoFrame.codedHeight]. + external DOMRectReadOnly? get codedRect; + + /// The **`visibleRect`** property of the [VideoFrame] interface returns a + /// [DOMRectReadOnly] describing the visible rectangle of pixels for this + /// `VideoFrame`. + external DOMRectReadOnly? get visibleRect; + + /// The **`displayWidth`** property of the [VideoFrame] interface returns the + /// width of the `VideoFrame` after applying aspect ratio adjustments. + external int get displayWidth; + + /// The **`displayHeight`** property of the [VideoFrame] interface returns the + /// height of the `VideoFrame` after applying aspect ratio adjustments. + external int get displayHeight; + + /// The **`duration`** property of the [VideoFrame] interface returns an + /// integer indicating the duration of the video in microseconds. + external int? get duration; + + /// The **`timestamp`** property of the [VideoFrame] interface returns an + /// integer indicating the timestamp of the video in microseconds. + external int get timestamp; + + /// The **`colorSpace`** property of the [VideoFrame] interface returns a + /// [VideoColorSpace] object representing the color space of the video. + external VideoColorSpace get colorSpace; +} +extension type VideoFrameInit._(JSObject _) implements JSObject { + external factory VideoFrameInit({ + int duration, + int timestamp, + AlphaOption alpha, + DOMRectInit visibleRect, + int displayWidth, + int displayHeight, + VideoFrameMetadata metadata, + }); + + external int get duration; + external set duration(int value); + external int get timestamp; + external set timestamp(int value); + external AlphaOption get alpha; + external set alpha(AlphaOption value); + external DOMRectInit get visibleRect; + external set visibleRect(DOMRectInit value); + external int get displayWidth; + external set displayWidth(int value); + external int get displayHeight; + external set displayHeight(int value); + external VideoFrameMetadata get metadata; + external set metadata(VideoFrameMetadata value); +} +extension type VideoFrameBufferInit._(JSObject _) implements JSObject { + external factory VideoFrameBufferInit({ + required VideoPixelFormat format, + required int codedWidth, + required int codedHeight, + required int timestamp, + int duration, + JSArray layout, + DOMRectInit visibleRect, + int displayWidth, + int displayHeight, + VideoColorSpaceInit colorSpace, + JSArray transfer, + }); + + external VideoPixelFormat get format; + external set format(VideoPixelFormat value); + external int get codedWidth; + external set codedWidth(int value); + external int get codedHeight; + external set codedHeight(int value); + external int get timestamp; + external set timestamp(int value); + external int get duration; + external set duration(int value); + external JSArray get layout; + external set layout(JSArray value); + external DOMRectInit get visibleRect; + external set visibleRect(DOMRectInit value); + external int get displayWidth; + external set displayWidth(int value); + external int get displayHeight; + external set displayHeight(int value); + external VideoColorSpaceInit get colorSpace; + external set colorSpace(VideoColorSpaceInit value); + external JSArray get transfer; + external set transfer(JSArray value); +} +extension type VideoFrameMetadata._(JSObject _) implements JSObject { + VideoFrameMetadata() : _ = JSObject(); +} +extension type VideoFrameCopyToOptions._(JSObject _) implements JSObject { + external factory VideoFrameCopyToOptions({ + DOMRectInit rect, + JSArray layout, + }); + + external DOMRectInit get rect; + external set rect(DOMRectInit value); + external JSArray get layout; + external set layout(JSArray value); +} +extension type PlaneLayout._(JSObject _) implements JSObject { + external factory PlaneLayout({ + required int offset, + required int stride, + }); + + external int get offset; + external set offset(int value); + external int get stride; + external set stride(int value); +} + +/// The **`VideoColorSpace`** interface of the [WebCodecs API] represents the +/// color space of a video. +/// +/// --- +/// +/// API documentation sourced from +/// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/VideoColorSpace). +extension type VideoColorSpace._(JSObject _) implements JSObject { + external factory VideoColorSpace([VideoColorSpaceInit init]); + + /// The **`toJSON()`** method of the [VideoColorSpace] interface is a + /// _serializer_ that returns a JSON representation of the `VideoColorSpace` + /// object. + external VideoColorSpaceInit toJSON(); + + /// The **`primaries`** read-only property of the [VideoColorSpace] interface + /// returns the color of the video. + external VideoColorPrimaries? get primaries; + + /// The **`transfer`** read-only property of the [VideoColorSpace] interface + /// returns the opto-electronic transfer characteristics of the video. + external VideoTransferCharacteristics? get transfer; + + /// The **`matrix`** read-only property of the [VideoColorSpace] interface + /// returns the matrix coefficient of the video. Matrix coefficients describe + /// the relationship between sample component values and color coordinates. + external VideoMatrixCoefficients? get matrix; + + /// The **`fullRange`** read-only property of the [VideoColorSpace] interface + /// returns `true` if full-range color values are used. + external bool? get fullRange; +} +extension type VideoColorSpaceInit._(JSObject _) implements JSObject { + external factory VideoColorSpaceInit({ + VideoColorPrimaries? primaries, + VideoTransferCharacteristics? transfer, + VideoMatrixCoefficients? matrix, + bool? fullRange, + }); + + external VideoColorPrimaries? get primaries; + external set primaries(VideoColorPrimaries? value); + external VideoTransferCharacteristics? get transfer; + external set transfer(VideoTransferCharacteristics? value); + external VideoMatrixCoefficients? get matrix; + external set matrix(VideoMatrixCoefficients? value); + external bool? get fullRange; + external set fullRange(bool? value); +} diff --git a/lib/src/dom/webcodecs_av1_codec_registration.dart b/lib/src/dom/webcodecs_av1_codec_registration.dart new file mode 100644 index 00000000..5726e49d --- /dev/null +++ b/lib/src/dom/webcodecs_av1_codec_registration.dart @@ -0,0 +1,28 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. +// +// API docs from [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web). +// Attributions and copyright licensing by Mozilla Contributors is licensed +// under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/. + +// Generated from Web IDL definitions. + +@JS() +library; + +import 'dart:js_interop'; + +extension type AV1EncoderConfig._(JSObject _) implements JSObject { + external factory AV1EncoderConfig({bool forceScreenContentTools}); + + external bool get forceScreenContentTools; + external set forceScreenContentTools(bool value); +} +extension type VideoEncoderEncodeOptionsForAv1._(JSObject _) + implements JSObject { + external factory VideoEncoderEncodeOptionsForAv1({int? quantizer}); + + external int? get quantizer; + external set quantizer(int? value); +} diff --git a/lib/src/dom/webcodecs_avc_codec_registration.dart b/lib/src/dom/webcodecs_avc_codec_registration.dart new file mode 100644 index 00000000..40332f3c --- /dev/null +++ b/lib/src/dom/webcodecs_avc_codec_registration.dart @@ -0,0 +1,29 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. +// +// API docs from [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web). +// Attributions and copyright licensing by Mozilla Contributors is licensed +// under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/. + +// Generated from Web IDL definitions. + +@JS() +library; + +import 'dart:js_interop'; + +typedef AvcBitstreamFormat = String; +extension type AvcEncoderConfig._(JSObject _) implements JSObject { + external factory AvcEncoderConfig({AvcBitstreamFormat format}); + + external AvcBitstreamFormat get format; + external set format(AvcBitstreamFormat value); +} +extension type VideoEncoderEncodeOptionsForAvc._(JSObject _) + implements JSObject { + external factory VideoEncoderEncodeOptionsForAvc({int? quantizer}); + + external int? get quantizer; + external set quantizer(int? value); +} diff --git a/lib/src/dom/webcodecs_hevc_codec_registration.dart b/lib/src/dom/webcodecs_hevc_codec_registration.dart new file mode 100644 index 00000000..839ca891 --- /dev/null +++ b/lib/src/dom/webcodecs_hevc_codec_registration.dart @@ -0,0 +1,29 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. +// +// API docs from [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web). +// Attributions and copyright licensing by Mozilla Contributors is licensed +// under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/. + +// Generated from Web IDL definitions. + +@JS() +library; + +import 'dart:js_interop'; + +typedef HevcBitstreamFormat = String; +extension type HevcEncoderConfig._(JSObject _) implements JSObject { + external factory HevcEncoderConfig({HevcBitstreamFormat format}); + + external HevcBitstreamFormat get format; + external set format(HevcBitstreamFormat value); +} +extension type VideoEncoderEncodeOptionsForHevc._(JSObject _) + implements JSObject { + external factory VideoEncoderEncodeOptionsForHevc({int? quantizer}); + + external int? get quantizer; + external set quantizer(int? value); +} diff --git a/lib/src/dom/webcodecs_vp9_codec_registration.dart b/lib/src/dom/webcodecs_vp9_codec_registration.dart new file mode 100644 index 00000000..3c4f18a3 --- /dev/null +++ b/lib/src/dom/webcodecs_vp9_codec_registration.dart @@ -0,0 +1,22 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. +// +// API docs from [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web). +// Attributions and copyright licensing by Mozilla Contributors is licensed +// under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/. + +// Generated from Web IDL definitions. + +@JS() +library; + +import 'dart:js_interop'; + +extension type VideoEncoderEncodeOptionsForVp9._(JSObject _) + implements JSObject { + external factory VideoEncoderEncodeOptionsForVp9({int? quantizer}); + + external int? get quantizer; + external set quantizer(int? value); +} diff --git a/lib/src/dom/webcryptoapi.dart b/lib/src/dom/webcryptoapi.dart index 00055818..16fe22ed 100644 --- a/lib/src/dom/webcryptoapi.dart +++ b/lib/src/dom/webcryptoapi.dart @@ -16,9 +16,6 @@ import 'dart:js_interop'; import 'webidl.dart'; typedef AlgorithmIdentifier = JSAny; -typedef HashAlgorithmIdentifier = AlgorithmIdentifier; -typedef BigInteger = JSUint8Array; -typedef NamedCurve = String; typedef KeyType = String; typedef KeyUsage = String; typedef KeyFormat = String; @@ -62,18 +59,6 @@ extension type Crypto._(JSObject _) implements JSObject { /// cryptographic operations. external SubtleCrypto get subtle; } -extension type Algorithm._(JSObject _) implements JSObject { - external factory Algorithm({required String name}); - - external String get name; - external set name(String value); -} -extension type KeyAlgorithm._(JSObject _) implements JSObject { - external factory KeyAlgorithm({required String name}); - - external String get name; - external set name(String value); -} /// The **`CryptoKey`** interface of the /// [Web Crypto API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Crypto_API) @@ -459,544 +444,3 @@ extension type JsonWebKey._(JSObject _) implements JSObject { external String get k; external set k(String value); } - -/// The **`CryptoKeyPair`** dictionary of the -/// [Web Crypto API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Crypto_API) -/// represents a key pair for an asymmetric cryptography algorithm, also known -/// as a public-key algorithm. -/// -/// A `CryptoKeyPair` object can be obtained using [SubtleCrypto.generateKey], -/// when the selected algorithm is one of the asymmetric algorithms: -/// RSASSA-PKCS1-v1_5, RSA-PSS, RSA-OAEP, ECDSA, or ECDH. -/// -/// It contains two properties, which are both -/// [`CryptoKey`](https://developer.mozilla.org/en-US/docs/Web/API/CryptoKey) -/// objects: a `privateKey` property containing the private key and a -/// `publicKey` property containing the public key. -/// -/// --- -/// -/// API documentation sourced from -/// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/CryptoKeyPair). -extension type CryptoKeyPair._(JSObject _) implements JSObject { - external factory CryptoKeyPair({ - CryptoKey publicKey, - CryptoKey privateKey, - }); - - external CryptoKey get publicKey; - external set publicKey(CryptoKey value); - external CryptoKey get privateKey; - external set privateKey(CryptoKey value); -} -extension type RsaKeyGenParams._(JSObject _) implements Algorithm, JSObject { - external factory RsaKeyGenParams({ - required String name, - required int modulusLength, - required BigInteger publicExponent, - }); - - external int get modulusLength; - external set modulusLength(int value); - external BigInteger get publicExponent; - external set publicExponent(BigInteger value); -} - -/// The **`RsaHashedKeyGenParams`** dictionary of the -/// [Web Crypto API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Crypto_API) -/// represents the object that should be passed as the `algorithm` parameter -/// into [SubtleCrypto.generateKey], when generating any RSA-based key pair: -/// that is, when the algorithm is identified as any of -/// [RSASSA-PKCS1-v1_5](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/sign#rsassa-pkcs1-v1_5), -/// [RSA-PSS](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/sign#rsa-pss), -/// or -/// [RSA-OAEP](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/encrypt#rsa-oaep). -/// -/// --- -/// -/// API documentation sourced from -/// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/RsaHashedKeyGenParams). -extension type RsaHashedKeyGenParams._(JSObject _) - implements RsaKeyGenParams, JSObject { - external factory RsaHashedKeyGenParams({ - required String name, - required int modulusLength, - required BigInteger publicExponent, - required HashAlgorithmIdentifier hash, - }); - - external HashAlgorithmIdentifier get hash; - external set hash(HashAlgorithmIdentifier value); -} -extension type RsaKeyAlgorithm._(JSObject _) implements KeyAlgorithm, JSObject { - external factory RsaKeyAlgorithm({ - required String name, - required int modulusLength, - required BigInteger publicExponent, - }); - - external int get modulusLength; - external set modulusLength(int value); - external BigInteger get publicExponent; - external set publicExponent(BigInteger value); -} -extension type RsaHashedKeyAlgorithm._(JSObject _) - implements RsaKeyAlgorithm, JSObject { - external factory RsaHashedKeyAlgorithm({ - required String name, - required int modulusLength, - required BigInteger publicExponent, - required KeyAlgorithm hash, - }); - - external KeyAlgorithm get hash; - external set hash(KeyAlgorithm value); -} - -/// The **`RsaHashedImportParams`** dictionary of the -/// [Web Crypto API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Crypto_API) -/// represents the object that should be passed as the `algorithm` parameter -/// into [SubtleCrypto.importKey] or [SubtleCrypto.unwrapKey], when importing -/// any RSA-based key pair: that is, when the algorithm is identified as any of -/// [RSASSA-PKCS1-v1_5](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/sign#rsassa-pkcs1-v1_5), -/// [RSA-PSS](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/sign#rsa-pss), -/// or -/// [RSA-OAEP](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/encrypt#rsa-oaep). -/// -/// --- -/// -/// API documentation sourced from -/// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/RsaHashedImportParams). -extension type RsaHashedImportParams._(JSObject _) - implements Algorithm, JSObject { - external factory RsaHashedImportParams({ - required String name, - required HashAlgorithmIdentifier hash, - }); - - external HashAlgorithmIdentifier get hash; - external set hash(HashAlgorithmIdentifier value); -} - -/// The **`RsaPssParams`** dictionary of the -/// [Web Crypto API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Crypto_API) -/// represents the object that should be passed as the `algorithm` parameter -/// into [SubtleCrypto.sign] or [SubtleCrypto.verify], when using the -/// [RSA-PSS](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/sign#rsa-pss) -/// algorithm. -/// -/// --- -/// -/// API documentation sourced from -/// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/RsaPssParams). -extension type RsaPssParams._(JSObject _) implements Algorithm, JSObject { - external factory RsaPssParams({ - required String name, - required int saltLength, - }); - - external int get saltLength; - external set saltLength(int value); -} - -/// The **`RsaOaepParams`** dictionary of the -/// [Web Crypto API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Crypto_API) -/// represents the object that should be passed as the `algorithm` parameter -/// into [SubtleCrypto.encrypt], [SubtleCrypto.decrypt], [SubtleCrypto.wrapKey], -/// or [SubtleCrypto.unwrapKey], when using the -/// [RSA_OAEP](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/encrypt#rsa-oaep) -/// algorithm. -/// -/// --- -/// -/// API documentation sourced from -/// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/RsaOaepParams). -extension type RsaOaepParams._(JSObject _) implements Algorithm, JSObject { - external factory RsaOaepParams({ - required String name, - BufferSource label, - }); - - external BufferSource get label; - external set label(BufferSource value); -} - -/// The **`EcdsaParams`** dictionary of the -/// [Web Crypto API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Crypto_API) -/// represents the object that should be passed as the `algorithm` parameter -/// into [SubtleCrypto.sign] or [SubtleCrypto.verify] when using the -/// [ECDSA](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/sign#ecdsa) -/// algorithm. -/// -/// --- -/// -/// API documentation sourced from -/// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/EcdsaParams). -extension type EcdsaParams._(JSObject _) implements Algorithm, JSObject { - external factory EcdsaParams({ - required String name, - required HashAlgorithmIdentifier hash, - }); - - external HashAlgorithmIdentifier get hash; - external set hash(HashAlgorithmIdentifier value); -} - -/// The **`EcKeyGenParams`** dictionary of the -/// [Web Crypto API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Crypto_API) -/// represents the object that should be passed as the `algorithm` parameter -/// into [SubtleCrypto.generateKey], when generating any elliptic-curve-based -/// key pair: that is, when the algorithm is identified as either of -/// [ECDSA](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/sign#ecdsa) -/// or -/// [ECDH](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/deriveKey#ecdh). -/// -/// --- -/// -/// API documentation sourced from -/// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/EcKeyGenParams). -extension type EcKeyGenParams._(JSObject _) implements Algorithm, JSObject { - external factory EcKeyGenParams({ - required String name, - required NamedCurve namedCurve, - }); - - external NamedCurve get namedCurve; - external set namedCurve(NamedCurve value); -} -extension type EcKeyAlgorithm._(JSObject _) implements KeyAlgorithm, JSObject { - external factory EcKeyAlgorithm({ - required String name, - required NamedCurve namedCurve, - }); - - external NamedCurve get namedCurve; - external set namedCurve(NamedCurve value); -} - -/// The **`EcKeyImportParams`** dictionary of the -/// [Web Crypto API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Crypto_API) -/// represents the object that should be passed as the `algorithm` parameter -/// into [SubtleCrypto.importKey] or [SubtleCrypto.unwrapKey], when generating -/// any elliptic-curve-based key pair: that is, when the algorithm is identified -/// as either of -/// [ECDSA](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/sign#ecdsa) -/// or -/// [ECDH](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/deriveKey#ecdh). -/// -/// --- -/// -/// API documentation sourced from -/// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/EcKeyImportParams). -extension type EcKeyImportParams._(JSObject _) implements Algorithm, JSObject { - external factory EcKeyImportParams({ - required String name, - required NamedCurve namedCurve, - }); - - external NamedCurve get namedCurve; - external set namedCurve(NamedCurve value); -} - -/// The **`EcdhKeyDeriveParams`** dictionary of the -/// [Web Crypto API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Crypto_API) -/// represents the object that should be passed as the `algorithm` parameter -/// into [SubtleCrypto.deriveKey], when using the -/// [ECDH](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/deriveKey#ecdh) -/// algorithm. -/// -/// ECDH enables two people who each have a key pair consisting of a public and -/// a private key to derive a shared secret. They exchange public keys and use -/// the combination of their private key and the other entity's public key to -/// derive a secret key that they — and no one else — share. -/// -/// The parameters for ECDH `deriveKey()` therefore include the other entity's -/// public key, which is combined with this entity's private key to derive the -/// shared secret. -/// -/// --- -/// -/// API documentation sourced from -/// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/EcdhKeyDeriveParams). -extension type EcdhKeyDeriveParams._(JSObject _) - implements Algorithm, JSObject { - external factory EcdhKeyDeriveParams({ - required String name, - required CryptoKey public, - }); - - external CryptoKey get public; - external set public(CryptoKey value); -} - -/// The **`AesCtrParams`** dictionary of the -/// [Web Crypto API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Crypto_API) -/// represents the object that should be passed as the `algorithm` parameter -/// into [SubtleCrypto.encrypt], [SubtleCrypto.decrypt], [SubtleCrypto.wrapKey], -/// or [SubtleCrypto.unwrapKey], when using the -/// [AES-CTR](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/encrypt#aes-ctr) -/// algorithm. -/// -/// AES is a block cipher, meaning that it splits the message into blocks and -/// encrypts it a block at a time. In CTR mode, every time a block of the -/// message is encrypted, an extra block of data is mixed in. This extra block -/// is called the "counter block". -/// -/// A given counter block value must never be used more than once with the same -/// key: -/// -/// - Given a message _n_ blocks long, a different counter block must be used -/// for every block. -/// - If the same key is used to encrypt more than one message, a different -/// counter block must be used for all blocks across all messages. -/// -/// Typically this is achieved by splitting the initial counter block value into -/// two concatenated parts: -/// -/// - A [nonce](https://en.wikipedia.org/wiki/Cryptographic_nonce) (that is, a -/// number that may only be used once). The nonce part of the block stays the -/// same for every block in the message. Each time a new message is to be -/// encrypted, a new nonce is chosen. Nonces don't have to be secret, but they -/// must not be reused with the same key. -/// - A counter. This part of the block gets incremented each time a block is -/// encrypted. -/// -/// Essentially: the nonce should ensure that counter blocks are not reused from -/// one message to the next, while the counter should ensure that counter blocks -/// are not reused within a single message. -/// -/// > **Note:** See -/// > [Appendix B of the NIST SP800-38A standard](https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-38a.pdf#%5B%7B%22num%22%3A70%2C%22gen%22%3A0%7D%2C%7B%22name%22%3A%22Fit%22%7D%5D) -/// > for more information. -/// -/// --- -/// -/// API documentation sourced from -/// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/AesCtrParams). -extension type AesCtrParams._(JSObject _) implements Algorithm, JSObject { - external factory AesCtrParams({ - required String name, - required BufferSource counter, - required int length, - }); - - external BufferSource get counter; - external set counter(BufferSource value); - external int get length; - external set length(int value); -} -extension type AesKeyAlgorithm._(JSObject _) implements KeyAlgorithm, JSObject { - external factory AesKeyAlgorithm({ - required String name, - required int length, - }); - - external int get length; - external set length(int value); -} - -/// The **`AesKeyGenParams`** dictionary of the -/// [Web Crypto API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Crypto_API) -/// represents the object that should be passed as the `algorithm` parameter -/// into [SubtleCrypto.generateKey], when generating an AES key: that is, when -/// the algorithm is identified as any of -/// [AES-CBC](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/encrypt#aes-cbc), -/// [AES-CTR](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/encrypt#aes-ctr), -/// [AES-GCM](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/encrypt#aes-gcm), -/// or -/// [AES-KW](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/wrapKey#aes-kw). -/// -/// --- -/// -/// API documentation sourced from -/// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/AesKeyGenParams). -extension type AesKeyGenParams._(JSObject _) implements Algorithm, JSObject { - external factory AesKeyGenParams({ - required String name, - required int length, - }); - - external int get length; - external set length(int value); -} -extension type AesDerivedKeyParams._(JSObject _) - implements Algorithm, JSObject { - external factory AesDerivedKeyParams({ - required String name, - required int length, - }); - - external int get length; - external set length(int value); -} - -/// The **`AesCbcParams`** dictionary of the -/// [Web Crypto API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Crypto_API) -/// represents the object that should be passed as the `algorithm` parameter -/// into [SubtleCrypto.encrypt], [SubtleCrypto.decrypt], [SubtleCrypto.wrapKey], -/// or [SubtleCrypto.unwrapKey], when using the -/// [AES-CBC](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/encrypt#aes-cbc) -/// algorithm. -/// -/// --- -/// -/// API documentation sourced from -/// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/AesCbcParams). -extension type AesCbcParams._(JSObject _) implements Algorithm, JSObject { - external factory AesCbcParams({ - required String name, - required BufferSource iv, - }); - - external BufferSource get iv; - external set iv(BufferSource value); -} - -/// The **`AesGcmParams`** dictionary of the -/// [Web Crypto API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Crypto_API) -/// represents the object that should be passed as the `algorithm` parameter -/// into [SubtleCrypto.encrypt], [SubtleCrypto.decrypt], [SubtleCrypto.wrapKey], -/// or [SubtleCrypto.unwrapKey], when using the -/// [AES-GCM](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/encrypt#aes-gcm) -/// algorithm. -/// -/// For details of how to supply appropriate values for this parameter, see the -/// specification for AES-GCM: -/// [NIST SP800-38D](https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-38d.pdf), -/// in particular section 5.2.1.1 on Input Data. -/// -/// --- -/// -/// API documentation sourced from -/// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/AesGcmParams). -extension type AesGcmParams._(JSObject _) implements Algorithm, JSObject { - external factory AesGcmParams({ - required String name, - required BufferSource iv, - BufferSource additionalData, - int tagLength, - }); - - external BufferSource get iv; - external set iv(BufferSource value); - external BufferSource get additionalData; - external set additionalData(BufferSource value); - external int get tagLength; - external set tagLength(int value); -} - -/// The **`HmacImportParams`** dictionary of the -/// [Web Crypto API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Crypto_API) -/// represents the object that should be passed as the `algorithm` parameter -/// into [SubtleCrypto.importKey] or [SubtleCrypto.unwrapKey], when generating a -/// key for the -/// [HMAC](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/sign#hmac) -/// algorithm. -/// -/// --- -/// -/// API documentation sourced from -/// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/HmacImportParams). -extension type HmacImportParams._(JSObject _) implements Algorithm, JSObject { - external factory HmacImportParams({ - required String name, - required HashAlgorithmIdentifier hash, - int length, - }); - - external HashAlgorithmIdentifier get hash; - external set hash(HashAlgorithmIdentifier value); - external int get length; - external set length(int value); -} -extension type HmacKeyAlgorithm._(JSObject _) - implements KeyAlgorithm, JSObject { - external factory HmacKeyAlgorithm({ - required String name, - required KeyAlgorithm hash, - required int length, - }); - - external KeyAlgorithm get hash; - external set hash(KeyAlgorithm value); - external int get length; - external set length(int value); -} - -/// The **`HmacKeyGenParams`** dictionary of the -/// [Web Crypto API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Crypto_API) -/// represents the object that should be passed as the `algorithm` parameter -/// into [SubtleCrypto.generateKey], when generating a key for the -/// [HMAC](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/sign#hmac) -/// algorithm. -/// -/// --- -/// -/// API documentation sourced from -/// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/HmacKeyGenParams). -extension type HmacKeyGenParams._(JSObject _) implements Algorithm, JSObject { - external factory HmacKeyGenParams({ - required String name, - required HashAlgorithmIdentifier hash, - int length, - }); - - external HashAlgorithmIdentifier get hash; - external set hash(HashAlgorithmIdentifier value); - external int get length; - external set length(int value); -} - -/// The **`HkdfParams`** dictionary of the -/// [Web Crypto API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Crypto_API) -/// represents the object that should be passed as the `algorithm` parameter -/// into [SubtleCrypto.deriveKey], when using the -/// [HKDF](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/deriveKey#hkdf) -/// algorithm. -/// -/// --- -/// -/// API documentation sourced from -/// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/HkdfParams). -extension type HkdfParams._(JSObject _) implements Algorithm, JSObject { - external factory HkdfParams({ - required String name, - required HashAlgorithmIdentifier hash, - required BufferSource salt, - required BufferSource info, - }); - - external HashAlgorithmIdentifier get hash; - external set hash(HashAlgorithmIdentifier value); - external BufferSource get salt; - external set salt(BufferSource value); - external BufferSource get info; - external set info(BufferSource value); -} - -/// The **`Pbkdf2Params`** dictionary of the -/// [Web Crypto API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Crypto_API) -/// represents the object that should be passed as the `algorithm` parameter -/// into [SubtleCrypto.deriveKey], when using the -/// [PBKDF2](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/deriveKey#pbkdf2) -/// algorithm. -/// -/// --- -/// -/// API documentation sourced from -/// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/Pbkdf2Params). -extension type Pbkdf2Params._(JSObject _) implements Algorithm, JSObject { - external factory Pbkdf2Params({ - required String name, - required BufferSource salt, - required int iterations, - required HashAlgorithmIdentifier hash, - }); - - external BufferSource get salt; - external set salt(BufferSource value); - external int get iterations; - external set iterations(int value); - external HashAlgorithmIdentifier get hash; - external set hash(HashAlgorithmIdentifier value); -} diff --git a/lib/src/dom/webgl1.dart b/lib/src/dom/webgl1.dart index b0f6e194..bf506098 100644 --- a/lib/src/dom/webgl1.dart +++ b/lib/src/dom/webgl1.dart @@ -20,14 +20,10 @@ import 'webidl.dart'; typedef GLenum = int; typedef GLboolean = bool; typedef GLbitfield = int; -typedef GLbyte = int; -typedef GLshort = int; typedef GLint = int; typedef GLsizei = int; typedef GLintptr = int; typedef GLsizeiptr = int; -typedef GLubyte = int; -typedef GLushort = int; typedef GLuint = int; typedef GLfloat = num; typedef GLclampf = num; @@ -46,6 +42,7 @@ extension type WebGLContextAttributes._(JSObject _) implements JSObject { WebGLPowerPreference powerPreference, bool failIfMajorPerformanceCaveat, bool desynchronized, + bool xrCompatible, }); external bool get alpha; @@ -66,23 +63,10 @@ extension type WebGLContextAttributes._(JSObject _) implements JSObject { external set failIfMajorPerformanceCaveat(bool value); external bool get desynchronized; external set desynchronized(bool value); + external bool get xrCompatible; + external set xrCompatible(bool value); } -/// The **`WebGLObject`** is part of the -/// [WebGL API](https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API) and -/// is the parent interface for all WebGL objects. -/// -/// This object has no public properties or methods on its own. -/// -/// If the WebGL context is lost, the internal _invalidated_ flag of all -/// `WebGLObject` instances is set to `true`. -/// -/// --- -/// -/// API documentation sourced from -/// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/WebGLObject). -extension type WebGLObject._(JSObject _) implements JSObject {} - /// The **WebGLBuffer** interface is part of the /// [WebGL API](https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API) and /// represents an opaque buffer object storing data such as vertices or colors. @@ -91,7 +75,7 @@ extension type WebGLObject._(JSObject _) implements JSObject {} /// /// API documentation sourced from /// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/WebGLBuffer). -extension type WebGLBuffer._(JSObject _) implements WebGLObject, JSObject {} +extension type WebGLBuffer._(JSObject _) implements JSObject {} /// The **WebGLFramebuffer** interface is part of the /// [WebGL API](https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API) and @@ -101,8 +85,7 @@ extension type WebGLBuffer._(JSObject _) implements WebGLObject, JSObject {} /// /// API documentation sourced from /// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/WebGLFramebuffer). -extension type WebGLFramebuffer._(JSObject _) - implements WebGLObject, JSObject {} +extension type WebGLFramebuffer._(JSObject _) implements JSObject {} /// The **`WebGLProgram`** is part of the /// [WebGL API](https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API) and @@ -136,7 +119,7 @@ extension type WebGLFramebuffer._(JSObject _) /// /// API documentation sourced from /// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/WebGLProgram). -extension type WebGLProgram._(JSObject _) implements WebGLObject, JSObject {} +extension type WebGLProgram._(JSObject _) implements JSObject {} /// The **WebGLRenderbuffer** interface is part of the /// [WebGL API](https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API) and @@ -147,8 +130,7 @@ extension type WebGLProgram._(JSObject _) implements WebGLObject, JSObject {} /// /// API documentation sourced from /// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderbuffer). -extension type WebGLRenderbuffer._(JSObject _) - implements WebGLObject, JSObject {} +extension type WebGLRenderbuffer._(JSObject _) implements JSObject {} /// The **WebGLShader** is part of the /// [WebGL API](https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API) and @@ -159,7 +141,7 @@ extension type WebGLRenderbuffer._(JSObject _) /// /// API documentation sourced from /// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/WebGLShader). -extension type WebGLShader._(JSObject _) implements WebGLObject, JSObject {} +extension type WebGLShader._(JSObject _) implements JSObject {} /// The **WebGLTexture** interface is part of the /// [WebGL API](https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API) and @@ -170,7 +152,7 @@ extension type WebGLShader._(JSObject _) implements WebGLObject, JSObject {} /// /// API documentation sourced from /// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/WebGLTexture). -extension type WebGLTexture._(JSObject _) implements WebGLObject, JSObject {} +extension type WebGLTexture._(JSObject _) implements JSObject {} /// The **WebGLUniformLocation** interface is part of the /// [WebGL API](https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API) and @@ -588,11 +570,6 @@ extension type WebGLRenderingContext._(JSObject _) implements JSObject { /// [WebGL](https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API) /// extension. external JSObject? getExtension(String name); - external void drawingBufferStorage( - GLenum sizedFormat, - int width, - int height, - ); /// The **`WebGLRenderingContext.activeTexture()`** method of the /// [WebGL API](https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API) @@ -1629,6 +1606,24 @@ extension type WebGLRenderingContext._(JSObject _) implements JSObject { GLsizei height, ); + /// The [WebGLRenderingContext] method + /// **`makeXRCompatible()`** ensures that the rendering context + /// described by the `WebGLRenderingContext` is ready to render the scene for + /// the + /// immersive + /// [WebXR](https://developer.mozilla.org/en-US/docs/Web/API/WebXR_Device_API) + /// device on which it + /// will be displayed. If necessary, the + /// [WebGL](https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API) + /// layer may reconfigure the context to be ready to render to a different + /// device than it + /// originally was. + /// + /// This is useful if you have an application which can start out being + /// presented on a + /// standard 2D display but can then be transitioned to a 3D immersion system. + external JSPromise makeXRCompatible(); + /// The **`WebGLRenderingContext.bufferData()`** method of the /// [WebGL API](https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API) /// initializes and creates the @@ -1811,7 +1806,6 @@ extension type WebGLRenderingContext._(JSObject _) implements JSObject { /// provide the /// requested height. external GLsizei get drawingBufferHeight; - external GLenum get drawingBufferFormat; /// The **`WebGLRenderingContext.drawingBufferColorSpace`** property specifies /// the color space of the WebGL drawing buffer. Along with the default @@ -1822,34 +1816,6 @@ extension type WebGLRenderingContext._(JSObject _) implements JSObject { /// for specifying the color space for textures. external PredefinedColorSpace get drawingBufferColorSpace; external set drawingBufferColorSpace(PredefinedColorSpace value); - - /// The **`WebGLRenderingContext.unpackColorSpace`** property specifies the - /// color space to convert to when importing textures. Along with the default - /// (`srgb`), the `display-p3` color space can be used. - /// - /// Texture image sources can be the following: - /// - /// - [`ImageBitmap`](https://developer.mozilla.org/en-US/docs/Web/API/ImageBitmap) - /// - [`ImageData`](https://developer.mozilla.org/en-US/docs/Web/API/ImageData) - /// - [`HTMLImageElement`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement) - /// - [`HTMLCanvasElement`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement) - /// - [`HTMLVideoElement`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLVideoElement) - /// - [`OffscreenCanvas`](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvas) - /// - [`VideoFrame`](https://developer.mozilla.org/en-US/docs/Web/API/VideoFrame) - /// - /// Textures are imported using the - /// [`WebGLRenderingContext.texImage2D()`](https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/texImage2D) - /// and - /// [`WebGLRenderingContext.texSubImage2D()`](https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/texSubImage2D) - /// methods and conversion to the specified `unpackColorSpace` color space - /// happens during import. - /// - /// Note that this doesn't apply to - /// [`HTMLImageElement`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement) - /// when the `UNPACK_COLORSPACE_CONVERSION_WEBGL` pixel storage parameter is - /// set to `NONE`. - external PredefinedColorSpace get unpackColorSpace; - external set unpackColorSpace(PredefinedColorSpace value); } /// The **WebContextEvent** interface is part of the diff --git a/lib/src/dom/webgl2.dart b/lib/src/dom/webgl2.dart index fb0965f1..68b354a2 100644 --- a/lib/src/dom/webgl2.dart +++ b/lib/src/dom/webgl2.dart @@ -45,7 +45,7 @@ typedef Uint32List = JSObject; /// /// API documentation sourced from /// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/WebGLQuery). -extension type WebGLQuery._(JSObject _) implements WebGLObject, JSObject {} +extension type WebGLQuery._(JSObject _) implements JSObject {} /// The **`WebGLSampler`** interface is part of the /// [WebGL 2](https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API) API @@ -64,7 +64,7 @@ extension type WebGLQuery._(JSObject _) implements WebGLObject, JSObject {} /// /// API documentation sourced from /// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/WebGLSampler). -extension type WebGLSampler._(JSObject _) implements WebGLObject, JSObject {} +extension type WebGLSampler._(JSObject _) implements JSObject {} /// The **`WebGLSync`** interface is part of the /// [WebGL 2](https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API) API @@ -84,7 +84,7 @@ extension type WebGLSampler._(JSObject _) implements WebGLObject, JSObject {} /// /// API documentation sourced from /// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/WebGLSync). -extension type WebGLSync._(JSObject _) implements WebGLObject, JSObject {} +extension type WebGLSync._(JSObject _) implements JSObject {} /// The **`WebGLTransformFeedback`** interface is part of the /// [WebGL 2](https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API) API @@ -110,8 +110,7 @@ extension type WebGLSync._(JSObject _) implements WebGLObject, JSObject {} /// /// API documentation sourced from /// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/WebGLTransformFeedback). -extension type WebGLTransformFeedback._(JSObject _) - implements WebGLObject, JSObject {} +extension type WebGLTransformFeedback._(JSObject _) implements JSObject {} /// The **`WebGLVertexArrayObject`** interface is part of the /// [WebGL 2 API](https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API), @@ -133,8 +132,7 @@ extension type WebGLTransformFeedback._(JSObject _) /// /// API documentation sourced from /// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/WebGLVertexArrayObject). -extension type WebGLVertexArrayObject._(JSObject _) - implements WebGLObject, JSObject {} +extension type WebGLVertexArrayObject._(JSObject _) implements JSObject {} /// The **WebGL2RenderingContext** interface provides the OpenGL ES 3.0 /// rendering context for the drawing surface of an HTML `canvas` element. @@ -726,11 +724,6 @@ extension type WebGL2RenderingContext._(JSObject _) implements JSObject { external bool isContextLost(); external JSArray? getSupportedExtensions(); external JSObject? getExtension(String name); - external void drawingBufferStorage( - GLenum sizedFormat, - int width, - int height, - ); external void activeTexture(GLenum texture); external void attachShader( WebGLProgram program, @@ -1109,6 +1102,7 @@ extension type WebGL2RenderingContext._(JSObject _) implements JSObject { GLsizei width, GLsizei height, ); + external JSPromise makeXRCompatible(); /// The **`WebGL2RenderingContext.copyBufferSubData()`** method of /// the @@ -2098,9 +2092,6 @@ extension type WebGL2RenderingContext._(JSObject _) implements JSObject { external JSObject get canvas; external GLsizei get drawingBufferWidth; external GLsizei get drawingBufferHeight; - external GLenum get drawingBufferFormat; external PredefinedColorSpace get drawingBufferColorSpace; external set drawingBufferColorSpace(PredefinedColorSpace value); - external PredefinedColorSpace get unpackColorSpace; - external set unpackColorSpace(PredefinedColorSpace value); } diff --git a/lib/src/dom/webgl_compressed_texture_etc.dart b/lib/src/dom/webgl_compressed_texture_etc.dart new file mode 100644 index 00000000..029a4cb5 --- /dev/null +++ b/lib/src/dom/webgl_compressed_texture_etc.dart @@ -0,0 +1,29 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. +// +// API docs from [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web). +// Attributions and copyright licensing by Mozilla Contributors is licensed +// under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/. + +// Generated from Web IDL definitions. + +@JS() +library; + +import 'dart:js_interop'; + +import 'webgl1.dart'; + +extension type WEBGL_compressed_texture_etc._(JSObject _) implements JSObject { + external static GLenum get COMPRESSED_R11_EAC; + external static GLenum get COMPRESSED_SIGNED_R11_EAC; + external static GLenum get COMPRESSED_RG11_EAC; + external static GLenum get COMPRESSED_SIGNED_RG11_EAC; + external static GLenum get COMPRESSED_RGB8_ETC2; + external static GLenum get COMPRESSED_SRGB8_ETC2; + external static GLenum get COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2; + external static GLenum get COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2; + external static GLenum get COMPRESSED_RGBA8_ETC2_EAC; + external static GLenum get COMPRESSED_SRGB8_ALPHA8_ETC2_EAC; +} diff --git a/lib/src/dom/webgl_compressed_texture_etc1.dart b/lib/src/dom/webgl_compressed_texture_etc1.dart new file mode 100644 index 00000000..9700bd5f --- /dev/null +++ b/lib/src/dom/webgl_compressed_texture_etc1.dart @@ -0,0 +1,20 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. +// +// API docs from [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web). +// Attributions and copyright licensing by Mozilla Contributors is licensed +// under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/. + +// Generated from Web IDL definitions. + +@JS() +library; + +import 'dart:js_interop'; + +import 'webgl1.dart'; + +extension type WEBGL_compressed_texture_etc1._(JSObject _) implements JSObject { + external static GLenum get COMPRESSED_RGB_ETC1_WEBGL; +} diff --git a/lib/src/dom/webgl_compressed_texture_pvrtc.dart b/lib/src/dom/webgl_compressed_texture_pvrtc.dart new file mode 100644 index 00000000..56b6f509 --- /dev/null +++ b/lib/src/dom/webgl_compressed_texture_pvrtc.dart @@ -0,0 +1,24 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. +// +// API docs from [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web). +// Attributions and copyright licensing by Mozilla Contributors is licensed +// under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/. + +// Generated from Web IDL definitions. + +@JS() +library; + +import 'dart:js_interop'; + +import 'webgl1.dart'; + +extension type WEBGL_compressed_texture_pvrtc._(JSObject _) + implements JSObject { + external static GLenum get COMPRESSED_RGB_PVRTC_4BPPV1_IMG; + external static GLenum get COMPRESSED_RGB_PVRTC_2BPPV1_IMG; + external static GLenum get COMPRESSED_RGBA_PVRTC_4BPPV1_IMG; + external static GLenum get COMPRESSED_RGBA_PVRTC_2BPPV1_IMG; +} diff --git a/lib/src/dom/webgl_multi_draw.dart b/lib/src/dom/webgl_multi_draw.dart new file mode 100644 index 00000000..c5decbc9 --- /dev/null +++ b/lib/src/dom/webgl_multi_draw.dart @@ -0,0 +1,57 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. +// +// API docs from [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web). +// Attributions and copyright licensing by Mozilla Contributors is licensed +// under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/. + +// Generated from Web IDL definitions. + +@JS() +library; + +import 'dart:js_interop'; + +import 'webgl1.dart'; + +extension type WEBGL_multi_draw._(JSObject _) implements JSObject { + external void multiDrawArraysWEBGL( + GLenum mode, + JSObject firstsList, + int firstsOffset, + JSObject countsList, + int countsOffset, + GLsizei drawcount, + ); + external void multiDrawElementsWEBGL( + GLenum mode, + JSObject countsList, + int countsOffset, + GLenum type, + JSObject offsetsList, + int offsetsOffset, + GLsizei drawcount, + ); + external void multiDrawArraysInstancedWEBGL( + GLenum mode, + JSObject firstsList, + int firstsOffset, + JSObject countsList, + int countsOffset, + JSObject instanceCountsList, + int instanceCountsOffset, + GLsizei drawcount, + ); + external void multiDrawElementsInstancedWEBGL( + GLenum mode, + JSObject countsList, + int countsOffset, + GLenum type, + JSObject offsetsList, + int offsetsOffset, + JSObject instanceCountsList, + int instanceCountsOffset, + GLsizei drawcount, + ); +} diff --git a/lib/src/dom/webgpu.dart b/lib/src/dom/webgpu.dart new file mode 100644 index 00000000..7c020df9 --- /dev/null +++ b/lib/src/dom/webgpu.dart @@ -0,0 +1,66 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. +// +// API docs from [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web). +// Attributions and copyright licensing by Mozilla Contributors is licensed +// under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/. + +// Generated from Web IDL definitions. + +@JS() +library; + +import 'dart:js_interop'; + +typedef GPUFlagsConstant = int; +@JS() +external $GPUBufferUsage get GPUBufferUsage; +@JS('GPUBufferUsage') +extension type $GPUBufferUsage._(JSObject _) implements JSObject { + external static GPUFlagsConstant get MAP_READ; + external static GPUFlagsConstant get MAP_WRITE; + external static GPUFlagsConstant get COPY_SRC; + external static GPUFlagsConstant get COPY_DST; + external static GPUFlagsConstant get INDEX; + external static GPUFlagsConstant get VERTEX; + external static GPUFlagsConstant get UNIFORM; + external static GPUFlagsConstant get STORAGE; + external static GPUFlagsConstant get INDIRECT; + external static GPUFlagsConstant get QUERY_RESOLVE; +} +@JS() +external $GPUMapMode get GPUMapMode; +@JS('GPUMapMode') +extension type $GPUMapMode._(JSObject _) implements JSObject { + external static GPUFlagsConstant get READ; + external static GPUFlagsConstant get WRITE; +} +@JS() +external $GPUTextureUsage get GPUTextureUsage; +@JS('GPUTextureUsage') +extension type $GPUTextureUsage._(JSObject _) implements JSObject { + external static GPUFlagsConstant get COPY_SRC; + external static GPUFlagsConstant get COPY_DST; + external static GPUFlagsConstant get TEXTURE_BINDING; + external static GPUFlagsConstant get STORAGE_BINDING; + external static GPUFlagsConstant get RENDER_ATTACHMENT; +} +@JS() +external $GPUShaderStage get GPUShaderStage; +@JS('GPUShaderStage') +extension type $GPUShaderStage._(JSObject _) implements JSObject { + external static GPUFlagsConstant get VERTEX; + external static GPUFlagsConstant get FRAGMENT; + external static GPUFlagsConstant get COMPUTE; +} +@JS() +external $GPUColorWrite get GPUColorWrite; +@JS('GPUColorWrite') +extension type $GPUColorWrite._(JSObject _) implements JSObject { + external static GPUFlagsConstant get RED; + external static GPUFlagsConstant get GREEN; + external static GPUFlagsConstant get BLUE; + external static GPUFlagsConstant get ALPHA; + external static GPUFlagsConstant get ALL; +} diff --git a/lib/src/dom/webmidi.dart b/lib/src/dom/webmidi.dart new file mode 100644 index 00000000..77741493 --- /dev/null +++ b/lib/src/dom/webmidi.dart @@ -0,0 +1,255 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. +// +// API docs from [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web). +// Attributions and copyright licensing by Mozilla Contributors is licensed +// under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/. + +// Generated from Web IDL definitions. + +@JS() +library; + +import 'dart:js_interop'; + +import 'dom.dart'; +import 'hr_time.dart'; +import 'html.dart'; + +typedef MIDIPortType = String; +typedef MIDIPortDeviceState = String; +typedef MIDIPortConnectionState = String; +extension type MIDIOptions._(JSObject _) implements JSObject { + external factory MIDIOptions({ + bool sysex, + bool software, + }); + + external bool get sysex; + external set sysex(bool value); + external bool get software; + external set software(bool value); +} + +/// The **`MIDIInputMap`** read-only interface of the +/// [Web MIDI API](https://developer.mozilla.org/en-US/docs/Web/API/Web_MIDI_API) +/// provides the set of MIDI input ports that are currently available. +/// +/// A `MIDIInputMap` instance is a read-only +/// [`Map`-like object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map#map-like_browser_apis), +/// in which each key is the ID string for MIDI input, and the associated value +/// is the corresponding [MIDIInput] object. +/// +/// --- +/// +/// API documentation sourced from +/// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/MIDIInputMap). +extension type MIDIInputMap._(JSObject _) implements JSObject {} + +/// The **`MIDIOutputMap`** read-only interface of the +/// [Web MIDI API](https://developer.mozilla.org/en-US/docs/Web/API/Web_MIDI_API) +/// provides the set of MIDI output ports that are currently available. +/// +/// A `MIDIOutputMap` instance is a read-only +/// [`Map`-like object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map#map-like_browser_apis), +/// in which each key is the ID string for MIDI output, and the associated value +/// is the corresponding [MIDIOutput] object. +/// +/// --- +/// +/// API documentation sourced from +/// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/MIDIOutputMap). +extension type MIDIOutputMap._(JSObject _) implements JSObject {} + +/// The **`MIDIAccess`** interface of the +/// [Web MIDI API](https://developer.mozilla.org/en-US/docs/Web/API/Web_MIDI_API) +/// provides methods for listing MIDI input and output devices, and obtaining +/// access to those devices. +/// +/// --- +/// +/// API documentation sourced from +/// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/MIDIAccess). +extension type MIDIAccess._(JSObject _) implements EventTarget, JSObject { + /// The **`inputs`** read-only property of the [MIDIAccess] interface provides + /// access to any available MIDI input ports. + external MIDIInputMap get inputs; + + /// The **`outputs`** read-only property of the [MIDIAccess] interface + /// provides access to any available MIDI output ports. + external MIDIOutputMap get outputs; + external EventHandler get onstatechange; + external set onstatechange(EventHandler value); + + /// The **`sysexEnabled`** read-only property of the [MIDIAccess] interface + /// indicates whether system exclusive support is enabled on the current + /// MIDIAccess instance. + external bool get sysexEnabled; +} + +/// The **`MIDIPort`** interface of the [Web MIDI API] represents a MIDI input +/// or output port. +/// +/// A `MIDIPort` instance is created when a new MIDI device is connected. +/// Therefore it has no constructor. +/// +/// --- +/// +/// API documentation sourced from +/// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/MIDIPort). +extension type MIDIPort._(JSObject _) implements EventTarget, JSObject { + /// The **`open()`** method of the [MIDIPort] interface makes the MIDI device + /// connected to this `MIDIPort` explicitly available. + /// + /// If the port is successfully opened a new [MIDIConnectionEvent] is queued + /// to the [MIDIPort.statechange_event] and [MIDIAccess.statechange_event] + /// events, and the [MIDIPort.connection] property is changed to `"open"`. + /// + /// If the port is already open when this method is called, then the promise + /// will resolve successfully. + external JSPromise open(); + + /// The **`close()`** method of the [MIDIPort] interface makes the access to + /// the MIDI device connected to this `MIDIPort` unavailable. + /// + /// If the port is successfully closed a new [MIDIConnectionEvent] is queued + /// to the [MIDIPort.statechange_event] and [MIDIAccess.statechange_event] + /// events, and the [MIDIPort.connection] property is changed to `"closed"`. + external JSPromise close(); + + /// The **`id`** read-only property of the [MIDIPort] interface returns the + /// unique ID of the port. + external String get id; + + /// The **`manufacturer`** read-only property of the [MIDIPort] interface + /// returns the manufacturer of the port. + external String? get manufacturer; + + /// The **`name`** read-only property of the [MIDIPort] interface returns the + /// system name of the port. + external String? get name; + + /// The **`type`** read-only property of the [MIDIPort] interface returns the + /// type of the port, indicating whether this is an input or output MIDI port. + external MIDIPortType get type; + + /// The **`version`** read-only property of the [MIDIPort] interface returns + /// the version of the port. + external String? get version; + + /// The **`state`** read-only property of the [MIDIPort] interface returns the + /// state of the port. + external MIDIPortDeviceState get state; + + /// The **`connection`** read-only property of the [MIDIPort] interface + /// returns the connection state of the port. + external MIDIPortConnectionState get connection; + external EventHandler get onstatechange; + external set onstatechange(EventHandler value); +} + +/// The **`MIDIInput`** interface of the +/// [Web MIDI API](https://developer.mozilla.org/en-US/docs/Web/API/Web_MIDI_API) +/// receives messages from a MIDI input port. +/// +/// --- +/// +/// API documentation sourced from +/// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/MIDIInput). +extension type MIDIInput._(JSObject _) implements MIDIPort, JSObject { + external EventHandler get onmidimessage; + external set onmidimessage(EventHandler value); +} + +/// The **`MIDIOutput`** interface of the [Web MIDI API] provides methods to add +/// messages to the queue of an output device, and to clear the queue of +/// messages. +/// +/// --- +/// +/// API documentation sourced from +/// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/MIDIOutput). +extension type MIDIOutput._(JSObject _) implements MIDIPort, JSObject { + /// The **`send()`** method of the [MIDIOutput] interface queues messages for + /// the corresponding MIDI port. The message can be sent immediately, or with + /// an optional timestamp to delay sending. + external void send( + JSArray data, [ + DOMHighResTimeStamp timestamp, + ]); + + /// The **`clear()`** method of the [MIDIOutput] interface clears the queue of + /// messages being sent to the output device. + external void clear(); +} + +/// The **`MIDIMessageEvent`** interface of the +/// [Web MIDI API](https://developer.mozilla.org/en-US/docs/Web/API/Web_MIDI_API) +/// represents the event passed to the [MIDIInput.midimessage_event] event of +/// the [MIDIInput] interface. A `midimessage` event is fired every time a MIDI +/// message is sent from a device represented by a [MIDIInput], for example when +/// a MIDI keyboard key is pressed, a knob is tweaked, or a slider is moved. +/// +/// --- +/// +/// API documentation sourced from +/// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/MIDIMessageEvent). +extension type MIDIMessageEvent._(JSObject _) implements Event, JSObject { + external factory MIDIMessageEvent( + String type, [ + MIDIMessageEventInit eventInitDict, + ]); + + /// The **`data`** read-only property of the [MIDIMessageEvent] interface + /// returns the MIDI data bytes of a single MIDI message. + external JSUint8Array? get data; +} +extension type MIDIMessageEventInit._(JSObject _) + implements EventInit, JSObject { + external factory MIDIMessageEventInit({ + bool bubbles, + bool cancelable, + bool composed, + JSUint8Array data, + }); + + external JSUint8Array get data; + external set data(JSUint8Array value); +} + +/// The **`MIDIConnectionEvent`** interface of the +/// [Web MIDI API](https://developer.mozilla.org/en-US/docs/Web/API/Web_MIDI_API) +/// is the event passed to the [MIDIAccess.statechange_event] event of the +/// [MIDIAccess] interface and the [MIDIPort.statechange_event] event of the +/// [MIDIPort] interface. This occurs any time a new port becomes available, or +/// when a previously available port becomes unavailable. For example, this +/// event is fired whenever a MIDI device is either plugged in to or unplugged +/// from a computer. +/// +/// --- +/// +/// API documentation sourced from +/// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/MIDIConnectionEvent). +extension type MIDIConnectionEvent._(JSObject _) implements Event, JSObject { + external factory MIDIConnectionEvent( + String type, [ + MIDIConnectionEventInit eventInitDict, + ]); + + /// The **`port`** read-only property of the [MIDIConnectionEvent] interface + /// returns the port that has been disconnected or connected. + external MIDIPort? get port; +} +extension type MIDIConnectionEventInit._(JSObject _) + implements EventInit, JSObject { + external factory MIDIConnectionEventInit({ + bool bubbles, + bool cancelable, + bool composed, + MIDIPort port, + }); + + external MIDIPort get port; + external set port(MIDIPort value); +} diff --git a/lib/src/dom/webrtc.dart b/lib/src/dom/webrtc.dart index d1ed7639..eb7212dd 100644 --- a/lib/src/dom/webrtc.dart +++ b/lib/src/dom/webrtc.dart @@ -17,10 +17,12 @@ import 'dom.dart'; import 'hr_time.dart'; import 'html.dart'; import 'mediacapture_streams.dart'; +import 'mst_content_hint.dart'; import 'webcryptoapi.dart'; import 'webidl.dart'; import 'webrtc_encoded_transform.dart'; -import 'webrtc_stats.dart'; +import 'webrtc_identity.dart'; +import 'webrtc_priority.dart'; import 'websockets.dart'; typedef RTCPeerConnectionErrorCallback = JSFunction; @@ -36,7 +38,6 @@ typedef RTCSdpType = String; typedef RTCIceProtocol = String; typedef RTCIceTcpCandidateType = String; typedef RTCIceCandidateType = String; -typedef RTCIceServerTransportProtocol = String; typedef RTCRtpTransceiverDirection = String; typedef RTCDtlsTransportState = String; typedef RTCIceGathererState = String; @@ -54,6 +55,7 @@ extension type RTCConfiguration._(JSObject _) implements JSObject { RTCRtcpMuxPolicy rtcpMuxPolicy, JSArray certificates, int iceCandidatePoolSize, + String peerIdentity, }); external JSArray get iceServers; @@ -68,6 +70,8 @@ extension type RTCConfiguration._(JSObject _) implements JSObject { external set certificates(JSArray value); external int get iceCandidatePoolSize; external set iceCandidatePoolSize(int value); + external String get peerIdentity; + external set peerIdentity(String value); } extension type RTCIceServer._(JSObject _) implements JSObject { external factory RTCIceServer({ @@ -122,6 +126,35 @@ extension type RTCPeerConnection._(JSObject _) external static JSPromise generateCertificate( AlgorithmIdentifier keygenAlgorithm); + /// The **`RTCPeerConnection.setIdentityProvider()`** method sets + /// the Identity Provider (IdP) to the triplet given in parameter: its name, + /// the protocol + /// used to communicate with it (optional) and an optional username. The IdP + /// will be used + /// only when an assertion is needed. + /// + /// If the [RTCPeerConnection.signalingState] is set to + /// `"closed"`, an `InvalidStateError` is raised. + external void setIdentityProvider( + String provider, [ + RTCIdentityProviderOptions options, + ]); + + /// The **`RTCPeerConnection.getIdentityAssertion()`** method + /// initiates the gathering of an identity assertion. This has an effect only + /// if the + /// [RTCPeerConnection.signalingState] is not + /// `"closed"`. + /// + /// The method returns a JavaScript `Promise` which resolves to an + /// identity assertion encoded as a string. + /// + /// It is not expected for the application dealing with the + /// `RTCPeerConnection`: + /// this is automatically done; an explicit call only allows to anticipate the + /// need. + external JSPromise getIdentityAssertion(); + /// The **`createOffer()`** method /// of the [RTCPeerConnection] interface /// initiates the creation of an offer @@ -416,6 +449,15 @@ extension type RTCPeerConnection._(JSObject _) /// [MediaStreamTrack]. external JSPromise getStats([MediaStreamTrack? selector]); + /// The read-only [RTCPeerConnection] property + /// **`peerIdentity`** returns a JavaScript `Promise` + /// that resolves to an [RTCIdentityAssertion] which contains a + /// string identifying the remote peer. Once this promise + /// resolves successfully, the resulting identity is the **target peer + /// identity** and cannot change for the duration of the connection. + external JSPromise get peerIdentity; + external String? get idpLoginUrl; + /// The read-only property **`RTCPeerConnection.localDescription`** returns an /// [RTCSessionDescription] describing the session for the local end of the /// connection. @@ -914,8 +956,6 @@ extension type RTCIceCandidate._(JSObject _) implements JSObject { /// Note that 24 bits of the username fragment are required to be randomized /// by the browser. See [Randomization](#randomization) below for details. external String? get usernameFragment; - external RTCIceServerTransportProtocol? get relayProtocol; - external String? get url; } extension type RTCIceCandidateInit._(JSObject _) implements JSObject { external factory RTCIceCandidateInit({ @@ -1023,12 +1063,6 @@ extension type RTCPeerConnectionIceErrorEventInit._(JSObject _) external String get errorText; external set errorText(String value); } -extension type RTCCertificateExpiration._(JSObject _) implements JSObject { - external factory RTCCertificateExpiration({int expires}); - - external int get expires; - external set expires(int value); -} /// The **`RTCCertificate`** interface of the /// [WebRTC API](https://developer.mozilla.org/en-US/docs/Web/API/WebRTC_API) @@ -1095,7 +1129,6 @@ extension type RTCRtpTransceiverInit._(JSObject _) implements JSObject { /// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/RTCRtpSender). extension type RTCRtpSender._(JSObject _) implements JSObject { external static RTCRtpCapabilities? getCapabilities(String kind); - external JSPromise generateKeyFrame([JSArray rids]); /// The **`setParameters()`** method of the [RTCRtpSender] interface applies /// changes the configuration of sender's [RTCRtpSender.track], which is the @@ -1210,12 +1243,15 @@ extension type RTCRtpSendParameters._(JSObject _) required JSArray codecs, required String transactionId, required JSArray encodings, + RTCDegradationPreference degradationPreference, }); external String get transactionId; external set transactionId(String value); external JSArray get encodings; external set encodings(JSArray value); + external RTCDegradationPreference get degradationPreference; + external set degradationPreference(RTCDegradationPreference value); } extension type RTCRtpReceiveParameters._(JSObject _) implements RTCRtpParameters, JSObject { @@ -1239,6 +1275,9 @@ extension type RTCRtpEncodingParameters._(JSObject _) int maxBitrate, num maxFramerate, num scaleResolutionDownBy, + RTCPriorityType priority, + RTCPriorityType networkPriority, + String scalabilityMode, }); external bool get active; @@ -1249,6 +1288,12 @@ extension type RTCRtpEncodingParameters._(JSObject _) external set maxFramerate(num value); external num get scaleResolutionDownBy; external set scaleResolutionDownBy(num value); + external RTCPriorityType get priority; + external set priority(RTCPriorityType value); + external RTCPriorityType get networkPriority; + external set networkPriority(RTCPriorityType value); + external String get scalabilityMode; + external set scalabilityMode(String value); } extension type RTCRtcpParameters._(JSObject _) implements JSObject { external factory RTCRtcpParameters({ @@ -1652,6 +1697,10 @@ extension type RTCIceTransport._(JSObject _) implements EventTarget, JSObject { /// transport when the client calls /// [RTCPeerConnection.setRemoteDescription]. external RTCIceParameters? getRemoteParameters(); + external EventHandler get onerror; + external set onerror(EventHandler value); + external EventHandler get onicecandidate; + external set onicecandidate(EventHandler value); /// The read-only **[RTCIceTransport]** /// property **`role`** indicates which role @@ -1663,11 +1712,6 @@ extension type RTCIceTransport._(JSObject _) implements EventTarget, JSObject { /// [Choosing a candidate pair](https://developer.mozilla.org/en-US/docs/Web/API/WebRTC_API/Connectivity#choosing_a_candidate_pair). external RTCIceRole get role; - /// The read-only **[RTCIceTransport]** - /// property **`component`** specifies whether the object is - /// serving to transport or . - external RTCIceComponent get component; - /// The read-only **[RTCIceTransport]** /// property **`state`** returns the current state of the ICE /// transport, so you can determine the state of ICE gathering in which the @@ -1707,6 +1751,7 @@ extension type RTCIceParameters._(JSObject _) implements JSObject { external factory RTCIceParameters({ String usernameFragment, String password, + bool iceLite, }); /// The **[RTCIceParameters]** dictionary's @@ -1724,6 +1769,8 @@ extension type RTCIceParameters._(JSObject _) implements JSObject { /// duration. external String get password; external set password(String value); + external bool get iceLite; + external set iceLite(bool value); } /// The **`RTCIceCandidatePair`** dictionary describes a pair of ICE candidates @@ -2136,6 +2183,7 @@ extension type RTCDataChannelInit._(JSObject _) implements JSObject { String protocol, bool negotiated, int id, + RTCPriorityType priority, }); external bool get ordered; @@ -2150,6 +2198,8 @@ extension type RTCDataChannelInit._(JSObject _) implements JSObject { external set negotiated(bool value); external int get id; external set id(int value); + external RTCPriorityType get priority; + external set priority(RTCPriorityType value); } /// The **`RTCDataChannelEvent`** interface @@ -2293,20 +2343,6 @@ extension type RTCDTMFToneChangeEventInit._(JSObject _) /// API documentation sourced from /// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/RTCStatsReport). extension type RTCStatsReport._(JSObject _) implements JSObject {} -extension type RTCStats._(JSObject _) implements JSObject { - external factory RTCStats({ - required DOMHighResTimeStamp timestamp, - required RTCStatsType type, - required String id, - }); - - external DOMHighResTimeStamp get timestamp; - external set timestamp(DOMHighResTimeStamp value); - external RTCStatsType get type; - external set type(RTCStatsType value); - external String get id; - external set id(String value); -} /// The **`RTCError`** interface describes an error which has occurred while /// handling @@ -2324,6 +2360,8 @@ extension type RTCError._(JSObject _) implements DOMException, JSObject { String message, ]); + external int? get httpRequestStatusCode; + /// The [RTCError] interface's read-only /// **`errorDetail`** property is a string indicating the /// [WebRTC](https://developer.mozilla.org/en-US/docs/Web/API/WebRTC_API)-specific @@ -2359,6 +2397,7 @@ extension type RTCErrorInit._(JSObject _) implements JSObject { int sctpCauseCode, int receivedAlert, int sentAlert, + int httpRequestStatusCode, }); external RTCErrorDetailType get errorDetail; @@ -2371,6 +2410,8 @@ extension type RTCErrorInit._(JSObject _) implements JSObject { external set receivedAlert(int value); external int get sentAlert; external set sentAlert(int value); + external int get httpRequestStatusCode; + external set httpRequestStatusCode(int value); } /// The WebRTC API's **`RTCErrorEvent`** interface represents an error sent to a diff --git a/lib/src/dom/webrtc_encoded_transform.dart b/lib/src/dom/webrtc_encoded_transform.dart index dc8200f5..b7cf6aca 100644 --- a/lib/src/dom/webrtc_encoded_transform.dart +++ b/lib/src/dom/webrtc_encoded_transform.dart @@ -16,61 +16,9 @@ import 'dart:js_interop'; import 'dom.dart'; import 'html.dart'; import 'streams.dart'; -import 'webcryptoapi.dart'; typedef RTCRtpTransform = JSObject; -typedef SmallCryptoKeyID = int; -typedef CryptoKeyID = JSAny; -typedef SFrameTransformRole = String; -typedef SFrameTransformErrorEventType = String; typedef RTCEncodedVideoFrameType = String; -extension type SFrameTransformOptions._(JSObject _) implements JSObject { - external factory SFrameTransformOptions({SFrameTransformRole role}); - - external SFrameTransformRole get role; - external set role(SFrameTransformRole value); -} -extension type SFrameTransform._(JSObject _) implements EventTarget, JSObject { - external factory SFrameTransform([SFrameTransformOptions options]); - - external JSPromise setEncryptionKey( - CryptoKey key, [ - CryptoKeyID keyID, - ]); - external EventHandler get onerror; - external set onerror(EventHandler value); - external ReadableStream get readable; - external WritableStream get writable; -} -extension type SFrameTransformErrorEvent._(JSObject _) - implements Event, JSObject { - external factory SFrameTransformErrorEvent( - String type, - SFrameTransformErrorEventInit eventInitDict, - ); - - external SFrameTransformErrorEventType get errorType; - external CryptoKeyID? get keyID; - external JSAny? get frame; -} -extension type SFrameTransformErrorEventInit._(JSObject _) - implements EventInit, JSObject { - external factory SFrameTransformErrorEventInit({ - bool bubbles, - bool cancelable, - bool composed, - required SFrameTransformErrorEventType errorType, - required JSAny? frame, - CryptoKeyID? keyID, - }); - - external SFrameTransformErrorEventType get errorType; - external set errorType(SFrameTransformErrorEventType value); - external JSAny? get frame; - external set frame(JSAny? value); - external CryptoKeyID? get keyID; - external set keyID(CryptoKeyID? value); -} extension type RTCEncodedVideoFrameMetadata._(JSObject _) implements JSObject { external factory RTCEncodedVideoFrameMetadata({ int frameId, @@ -305,8 +253,6 @@ extension type RTCRtpScriptTransformer._(JSObject _) /// A common way to perform this operation is to pipe the frames through a /// [TransformStream]. external WritableStream get writable; - external EventHandler get onkeyframerequest; - external set onkeyframerequest(EventHandler value); /// The **`options`** read-only property of the [RTCRtpScriptTransformer] /// interface returns the object that was (optionally) passed as the second @@ -334,11 +280,3 @@ extension type RTCRtpScriptTransform._(JSObject _) implements JSObject { JSArray transfer, ]); } -extension type KeyFrameRequestEvent._(JSObject _) implements Event, JSObject { - external factory KeyFrameRequestEvent( - String type, [ - String rid, - ]); - - external String? get rid; -} diff --git a/lib/src/dom/webrtc_identity.dart b/lib/src/dom/webrtc_identity.dart new file mode 100644 index 00000000..f08787ff --- /dev/null +++ b/lib/src/dom/webrtc_identity.dart @@ -0,0 +1,29 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. +// +// API docs from [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web). +// Attributions and copyright licensing by Mozilla Contributors is licensed +// under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/. + +// Generated from Web IDL definitions. + +@JS() +library; + +import 'dart:js_interop'; + +extension type RTCIdentityProviderOptions._(JSObject _) implements JSObject { + external factory RTCIdentityProviderOptions({ + String protocol, + String usernameHint, + String peerIdentity, + }); + + external String get protocol; + external set protocol(String value); + external String get usernameHint; + external set usernameHint(String value); + external String get peerIdentity; + external set peerIdentity(String value); +} diff --git a/lib/src/dom/webrtc_priority.dart b/lib/src/dom/webrtc_priority.dart new file mode 100644 index 00000000..e7793bc6 --- /dev/null +++ b/lib/src/dom/webrtc_priority.dart @@ -0,0 +1,16 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. +// +// API docs from [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web). +// Attributions and copyright licensing by Mozilla Contributors is licensed +// under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/. + +// Generated from Web IDL definitions. + +@JS() +library; + +import 'dart:js_interop'; + +typedef RTCPriorityType = String; diff --git a/lib/src/dom/webrtc_stats.dart b/lib/src/dom/webrtc_stats.dart deleted file mode 100644 index 93fe68bc..00000000 --- a/lib/src/dom/webrtc_stats.dart +++ /dev/null @@ -1,1431 +0,0 @@ -// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. -// -// API docs from [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web). -// Attributions and copyright licensing by Mozilla Contributors is licensed -// under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/. - -// Generated from Web IDL definitions. - -@JS() -library; - -import 'dart:js_interop'; - -import 'hr_time.dart'; -import 'webrtc.dart'; - -typedef RTCStatsType = String; -typedef RTCQualityLimitationReason = String; -typedef RTCDtlsRole = String; -typedef RTCStatsIceCandidatePairState = String; - -/// The [RTCRtpStreamStats] dictionary is returned by the -/// [RTCPeerConnection.getStats], [RTCRtpSender.getStats], and -/// [RTCRtpReceiver.getStats] methods to provide detailed statistics about -/// WebRTC connectivity. -/// -/// While the dictionary has a base set of properties that are present in each -/// of these cases, there are also additional properties added depending on -/// which interface the method is called on. -/// -/// `RTCRtpStreamStats` is the base class for all RTP-related statistics -/// reports. -/// -/// > **Note:** This interface was called `RTCRTPStreamStats` until a -/// > specification update in the spring of 2017. -/// > Check the [Browser compatibility](#browser_compatibility) table to know if -/// > and when the name change was implemented in specific browsers. -/// -/// --- -/// -/// API documentation sourced from -/// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/RTCRtpStreamStats). -extension type RTCRtpStreamStats._(JSObject _) implements RTCStats, JSObject { - external factory RTCRtpStreamStats({ - required DOMHighResTimeStamp timestamp, - required RTCStatsType type, - required String id, - required int ssrc, - required String kind, - String transportId, - String codecId, - }); - - /// The [RTCRtpStreamStats] dictionary's - /// **`ssrc`** property provides the Synchronization Source - /// (SSRC), an integer which uniquely identifies the source of the - /// packets whose statistics are covered by the [RTCStatsReport] that - /// includes this `RTCRtpStreamStats` dictionary. - external int get ssrc; - external set ssrc(int value); - - /// The **`kind`** property of the - /// [RTCRtpStreamStats] dictionary is a string indicating whether the - /// described stream contains audio or video media. - /// - /// Its value - /// is always either `"audio"` or `"video"`. - /// - /// This property was previously called `mediaType`. The name was changed in - /// the - /// specification in February, 2018. See - /// [Browser compatibility](#browser_compatibility) below to - /// determine how this affects the browsers you're targeting. - external String get kind; - external set kind(String value); - - /// The [RTCRtpStreamStats] dictionary's - /// **`transportId`** property is a string which uniquely - /// identifies the object from which the statistics contained in the - /// [RTCTransportStats] properties in the - /// [RTCStatsReport]. - external String get transportId; - external set transportId(String value); - - /// The [RTCRtpStreamStats] dictionary's - /// **`codecId`** property is a string which uniquely identifies - /// the object that was inspected to produce the data in the [RTCCodecStats] - /// for the stream. - external String get codecId; - external set codecId(String value); -} - -/// The **`RTCCodecStats`** dictionary of the -/// [WebRTC API](https://developer.mozilla.org/en-US/docs/Web/API/WebRTC_API) -/// provides statistics about a codec used by streams that are being sent or -/// received by the associated [RTCPeerConnection] object. -/// -/// These statistics can be obtained by iterating the [RTCStatsReport] object -/// returned by [RTCPeerConnection.getStats] until you find an entry with the -/// [`type`](#type) of `codec`. -/// -/// The codec statistics can be correlated with the inbound or outbound stream -/// statistics (both local and remote) by matching their `codecId` property to -/// the codec's `id`. -/// For example, if -/// [`RTCInboundRtpStreamStats.codecId`](/en-US/docs/Web/API/RTCInboundRtpStreamStats#codecid) -/// matches an [`RTCCodecStats.id`](#id) in the same report, then we know that -/// the codec is being used on this peer connection's inbound stream. -/// If no stream `codecId` references a codec statistic, then that codec -/// statistic object is deleted — if the codec is used again, the statistics -/// object will be recreated with the same `id`. -/// -/// Codec objects may be referenced by multiple RTP streams in media sections -/// using the same transport. -/// In fact, user agents are expected to consolidate information into a single -/// "codec" entry per payload type per transport (unless -/// [sdpFmtpLine](#sdpfmtpline) is different when sending or receiving, in which -/// case, different codecs will be needed for encoding and decoding). -/// Note that other transports will use their own distinct `RTCCodecStats` -/// objects. -/// -/// --- -/// -/// API documentation sourced from -/// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/RTCCodecStats). -extension type RTCCodecStats._(JSObject _) implements RTCStats, JSObject { - external factory RTCCodecStats({ - required DOMHighResTimeStamp timestamp, - required RTCStatsType type, - required String id, - required int payloadType, - required String transportId, - required String mimeType, - int clockRate, - int channels, - String sdpFmtpLine, - }); - - /// The **`payloadType`** property of the [RTCCodecStats] dictionary is a - /// positive integer in the range from 0 to 127 that describes the format of - /// the payload used in RTP encoding or decoding. - external int get payloadType; - external set payloadType(int value); - - /// The **`transportId`** property of the [RTCCodecStats] dictionary is a - /// string that contains the unique identifier of the corresponding transport - /// on which this codec is being used. - /// - /// You can correlate the codec and associated transport statistics by - /// matching the `RTCCodecStats.transportId` with an [RTCTransportStats.id] - /// value. - external String get transportId; - external set transportId(String value); - - /// The **`mimeType`** property of the [RTCCodecStats] dictionary is a string - /// containing the codec's and subtype. - /// - /// This is of the form `"type/subtype"`, such as "video/VP8" or "audio/opus", - /// as defined in the - /// [IANA registry of valid MIME types](https://www.iana.org/assignments/rtp-parameters/rtp-parameters.xhtml#rtp-parameters-2). - external String get mimeType; - external set mimeType(String value); - - /// The **`clockRate`** property of the [RTCCodecStats] dictionary is a - /// positive number containing the media sampling rate in hertz (Hz). - external int get clockRate; - external set clockRate(int value); - - /// The **`channels`** property of the [RTCCodecStats] dictionary is a - /// positive number containing the number of channels supported by the codec. - /// - /// For audio codecs, a value of 1 specifies monaural sound while 2 indicates - /// stereo. - external int get channels; - external set channels(int value); - - /// The **`sdpFmtpLine`** property of the [RTCCodecStats] dictionary is a - /// string containing the format-specific parameters of the codec. - /// - /// These are the values in the `"a=fmtp"` line in the codec's (if present) - /// after the payload type number (see [section 5.8 of the IETF specification - /// for - /// JSEP](https://datatracker.ietf.org/doc/html/draft-ietf-rtcweb-jsep-24#section-5.8)). - external String get sdpFmtpLine; - external set sdpFmtpLine(String value); -} -extension type RTCReceivedRtpStreamStats._(JSObject _) - implements RTCRtpStreamStats, JSObject { - external factory RTCReceivedRtpStreamStats({ - required DOMHighResTimeStamp timestamp, - required RTCStatsType type, - required String id, - required int ssrc, - required String kind, - String transportId, - String codecId, - int packetsReceived, - int packetsLost, - num jitter, - }); - - external int get packetsReceived; - external set packetsReceived(int value); - external int get packetsLost; - external set packetsLost(int value); - external num get jitter; - external set jitter(num value); -} - -/// The **`RTCInboundRtpStreamStats`** dictionary of the -/// [WebRTC API](https://developer.mozilla.org/en-US/docs/Web/API/WebRTC_API) is -/// used to report statistics related to the receiving end of an RTP stream on -/// the local end of the [RTCPeerConnection]. -/// -/// The statistics can be obtained by iterating the [RTCStatsReport] returned by -/// [RTCPeerConnection.getStats] or [RTCRtpReceiver.getStats] until you find a -/// report with the [`type`](#type) of `inbound-rtp`. -/// -/// --- -/// -/// API documentation sourced from -/// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/RTCInboundRtpStreamStats). -extension type RTCInboundRtpStreamStats._(JSObject _) - implements RTCReceivedRtpStreamStats, JSObject { - external factory RTCInboundRtpStreamStats({ - required DOMHighResTimeStamp timestamp, - required RTCStatsType type, - required String id, - required int ssrc, - required String kind, - String transportId, - String codecId, - int packetsReceived, - int packetsLost, - num jitter, - required String trackIdentifier, - String mid, - String remoteId, - int framesDecoded, - int keyFramesDecoded, - int framesRendered, - int framesDropped, - int frameWidth, - int frameHeight, - num framesPerSecond, - int qpSum, - num totalDecodeTime, - num totalInterFrameDelay, - num totalSquaredInterFrameDelay, - int pauseCount, - num totalPausesDuration, - int freezeCount, - num totalFreezesDuration, - DOMHighResTimeStamp lastPacketReceivedTimestamp, - int headerBytesReceived, - int packetsDiscarded, - int fecBytesReceived, - int fecPacketsReceived, - int fecPacketsDiscarded, - int bytesReceived, - int nackCount, - int firCount, - int pliCount, - num totalProcessingDelay, - DOMHighResTimeStamp estimatedPlayoutTimestamp, - num jitterBufferDelay, - num jitterBufferTargetDelay, - int jitterBufferEmittedCount, - num jitterBufferMinimumDelay, - int totalSamplesReceived, - int concealedSamples, - int silentConcealedSamples, - int concealmentEvents, - int insertedSamplesForDeceleration, - int removedSamplesForAcceleration, - num audioLevel, - num totalAudioEnergy, - num totalSamplesDuration, - int framesReceived, - String decoderImplementation, - String playoutId, - bool powerEfficientDecoder, - int framesAssembledFromMultiplePackets, - num totalAssemblyTime, - int retransmittedPacketsReceived, - int retransmittedBytesReceived, - int rtxSsrc, - int fecSsrc, - }); - - external String get trackIdentifier; - external set trackIdentifier(String value); - external String get mid; - external set mid(String value); - - /// The **`remoteId`** property of the - /// [RTCInboundRtpStreamStats] dictionary specifies the - /// [RTCInboundRtpStreamStats.id] of the [RTCRemoteOutboundRtpStreamStats] - /// object representing the remote peer's [RTCRtpSender] which is sending the - /// media to the local peer. - external String get remoteId; - external set remoteId(String value); - - /// The **`framesDecoded`** property of - /// the [RTCInboundRtpStreamStats] dictionary indicates the total number of - /// frames which have been decoded successfully for this media source. - external int get framesDecoded; - external set framesDecoded(int value); - external int get keyFramesDecoded; - external set keyFramesDecoded(int value); - external int get framesRendered; - external set framesRendered(int value); - external int get framesDropped; - external set framesDropped(int value); - external int get frameWidth; - external set frameWidth(int value); - external int get frameHeight; - external set frameHeight(int value); - external num get framesPerSecond; - external set framesPerSecond(num value); - - /// The **`qpSum`** property of the - /// [RTCInboundRtpStreamStats] dictionary is a value generated by adding the - /// **Quantization Parameter** (**QP**) values for every frame - /// sent or received to date on the video track corresponding to this - /// `RTCInboundRtpStreamStats` object. - /// - /// In general, the higher this - /// number is, the more heavily compressed the video data is. - external int get qpSum; - external set qpSum(int value); - external num get totalDecodeTime; - external set totalDecodeTime(num value); - external num get totalInterFrameDelay; - external set totalInterFrameDelay(num value); - external num get totalSquaredInterFrameDelay; - external set totalSquaredInterFrameDelay(num value); - external int get pauseCount; - external set pauseCount(int value); - external num get totalPausesDuration; - external set totalPausesDuration(num value); - external int get freezeCount; - external set freezeCount(int value); - external num get totalFreezesDuration; - external set totalFreezesDuration(num value); - - /// The **`lastPacketReceivedTimestamp`** property of the - /// [RTCInboundRtpStreamStats] dictionary indicates the time at which the most - /// recently received packet arrived from this source. - external DOMHighResTimeStamp get lastPacketReceivedTimestamp; - external set lastPacketReceivedTimestamp(DOMHighResTimeStamp value); - external int get headerBytesReceived; - external set headerBytesReceived(int value); - external int get packetsDiscarded; - external set packetsDiscarded(int value); - external int get fecBytesReceived; - external set fecBytesReceived(int value); - - /// The **`fecPacketsReceived`** property - /// of the [RTCInboundRtpStreamStats] dictionary indicates how many - /// Forward Error Correction (FEC) packets have been received by this RTP - /// receiver - /// from the remote peer. - /// - /// An FEC packet provides parity information which can - /// be used to attempt to reconstruct RTP data packets which have been - /// corrupted in - /// transit. - external int get fecPacketsReceived; - external set fecPacketsReceived(int value); - - /// The **`fecPacketsDiscarded`** property - /// of the [RTCInboundRtpStreamStats] dictionary is a numeric value - /// indicating the number of Forward Error Correction (FEC) packets - /// that have been discarded. - external int get fecPacketsDiscarded; - external set fecPacketsDiscarded(int value); - - /// The [RTCInboundRtpStreamStats] dictionary's - /// **`bytesReceived`** property is an integer value which - /// indicates the total number of bytes received so far from this - /// synchronization source - /// (SSRC). - external int get bytesReceived; - external set bytesReceived(int value); - - /// The **`nackCount`** property of the - /// [RTCInboundRtpStreamStats] dictionary is a numeric value indicating the - /// number of times the receiver sent a **NACK** packet to the sender. - /// - /// A NACK (Negative ACKnowledgement, also called "Generic NACK") packet tells - /// the sender - /// that one or more of the packets it sent were lost in transport. - external int get nackCount; - external set nackCount(int value); - - /// The **`firCount`** property of the - /// [RTCInboundRtpStreamStats] dictionary indicates the number of - /// **Full Intra Request** (**FIR**) packets have been sent by - /// the receiver to the sender. - /// - /// The receiver sends a FIR packet when the stream - /// falls behind and needs to skip frames in order to catch up. - external int get firCount; - external set firCount(int value); - - /// The **`pliCount`** property of the - /// [RTCInboundRtpStreamStats] dictionary states the number of times the - /// [RTCRtpReceiver] described by these statistics sent a **Picture - /// Loss Indication** (**PLI**) packet to the sender. - /// - /// A PLI - /// packet indicates that some amount of encoded video data has been lost for - /// one or more - /// frames. - external int get pliCount; - external set pliCount(int value); - external num get totalProcessingDelay; - external set totalProcessingDelay(num value); - external DOMHighResTimeStamp get estimatedPlayoutTimestamp; - external set estimatedPlayoutTimestamp(DOMHighResTimeStamp value); - external num get jitterBufferDelay; - external set jitterBufferDelay(num value); - external num get jitterBufferTargetDelay; - external set jitterBufferTargetDelay(num value); - external int get jitterBufferEmittedCount; - external set jitterBufferEmittedCount(int value); - external num get jitterBufferMinimumDelay; - external set jitterBufferMinimumDelay(num value); - external int get totalSamplesReceived; - external set totalSamplesReceived(int value); - external int get concealedSamples; - external set concealedSamples(int value); - external int get silentConcealedSamples; - external set silentConcealedSamples(int value); - external int get concealmentEvents; - external set concealmentEvents(int value); - external int get insertedSamplesForDeceleration; - external set insertedSamplesForDeceleration(int value); - external int get removedSamplesForAcceleration; - external set removedSamplesForAcceleration(int value); - external num get audioLevel; - external set audioLevel(num value); - external num get totalAudioEnergy; - external set totalAudioEnergy(num value); - external num get totalSamplesDuration; - external set totalSamplesDuration(num value); - external int get framesReceived; - external set framesReceived(int value); - external String get decoderImplementation; - external set decoderImplementation(String value); - external String get playoutId; - external set playoutId(String value); - external bool get powerEfficientDecoder; - external set powerEfficientDecoder(bool value); - external int get framesAssembledFromMultiplePackets; - external set framesAssembledFromMultiplePackets(int value); - external num get totalAssemblyTime; - external set totalAssemblyTime(num value); - external int get retransmittedPacketsReceived; - external set retransmittedPacketsReceived(int value); - external int get retransmittedBytesReceived; - external set retransmittedBytesReceived(int value); - external int get rtxSsrc; - external set rtxSsrc(int value); - external int get fecSsrc; - external set fecSsrc(int value); -} -extension type RTCRemoteInboundRtpStreamStats._(JSObject _) - implements RTCReceivedRtpStreamStats, JSObject { - external factory RTCRemoteInboundRtpStreamStats({ - required DOMHighResTimeStamp timestamp, - required RTCStatsType type, - required String id, - required int ssrc, - required String kind, - String transportId, - String codecId, - int packetsReceived, - int packetsLost, - num jitter, - String localId, - num roundTripTime, - num totalRoundTripTime, - num fractionLost, - int roundTripTimeMeasurements, - }); - - external String get localId; - external set localId(String value); - external num get roundTripTime; - external set roundTripTime(num value); - external num get totalRoundTripTime; - external set totalRoundTripTime(num value); - external num get fractionLost; - external set fractionLost(num value); - external int get roundTripTimeMeasurements; - external set roundTripTimeMeasurements(int value); -} -extension type RTCSentRtpStreamStats._(JSObject _) - implements RTCRtpStreamStats, JSObject { - external factory RTCSentRtpStreamStats({ - required DOMHighResTimeStamp timestamp, - required RTCStatsType type, - required String id, - required int ssrc, - required String kind, - String transportId, - String codecId, - int packetsSent, - int bytesSent, - }); - - external int get packetsSent; - external set packetsSent(int value); - external int get bytesSent; - external set bytesSent(int value); -} - -/// The **`RTCOutboundRtpStreamStats`** dictionary of the -/// [WebRTC API](https://developer.mozilla.org/en-US/docs/Web/API/WebRTC_API) is -/// used to report metrics and statistics related to an outbound stream being -/// sent by an [RTCRtpSender]. -/// -/// The statistics can be obtained by iterating the [RTCStatsReport] returned by -/// [RTCPeerConnection.getStats] or [RTCRtpSender.getStats] until you find a -/// report with the [`type`](#type) of `outbound-rtp`. -/// -/// --- -/// -/// API documentation sourced from -/// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/RTCOutboundRtpStreamStats). -extension type RTCOutboundRtpStreamStats._(JSObject _) - implements RTCSentRtpStreamStats, JSObject { - external factory RTCOutboundRtpStreamStats({ - required DOMHighResTimeStamp timestamp, - required RTCStatsType type, - required String id, - required int ssrc, - required String kind, - String transportId, - String codecId, - int packetsSent, - int bytesSent, - String mid, - String mediaSourceId, - String remoteId, - String rid, - int headerBytesSent, - int retransmittedPacketsSent, - int retransmittedBytesSent, - int rtxSsrc, - num targetBitrate, - int totalEncodedBytesTarget, - int frameWidth, - int frameHeight, - num framesPerSecond, - int framesSent, - int hugeFramesSent, - int framesEncoded, - int keyFramesEncoded, - int qpSum, - num totalEncodeTime, - num totalPacketSendDelay, - RTCQualityLimitationReason qualityLimitationReason, - JSObject qualityLimitationDurations, - int qualityLimitationResolutionChanges, - int nackCount, - int firCount, - int pliCount, - String encoderImplementation, - bool powerEfficientEncoder, - bool active, - String scalabilityMode, - }); - - external String get mid; - external set mid(String value); - external String get mediaSourceId; - external set mediaSourceId(String value); - - /// The **`remoteId`** property of the - /// [RTCOutboundRtpStreamStats] dictionary specifies the - /// [RTCOutboundRtpStreamStats.id] of the [RTCRemoteInboundRtpStreamStats] - /// object representing the remote peer's [RTCRtpReceiver] which is sending - /// the media to the local peer for this SSRC. - external String get remoteId; - external set remoteId(String value); - external String get rid; - external set rid(String value); - external int get headerBytesSent; - external set headerBytesSent(int value); - external int get retransmittedPacketsSent; - external set retransmittedPacketsSent(int value); - external int get retransmittedBytesSent; - external set retransmittedBytesSent(int value); - external int get rtxSsrc; - external set rtxSsrc(int value); - external num get targetBitrate; - external set targetBitrate(num value); - external int get totalEncodedBytesTarget; - external set totalEncodedBytesTarget(int value); - external int get frameWidth; - external set frameWidth(int value); - external int get frameHeight; - external set frameHeight(int value); - external num get framesPerSecond; - external set framesPerSecond(num value); - external int get framesSent; - external set framesSent(int value); - external int get hugeFramesSent; - external set hugeFramesSent(int value); - - /// The **`framesEncoded`** property of - /// the [RTCOutboundRtpStreamStats] dictionary indicates the total number of - /// frames that have been encoded by this [RTCRtpSender] for this media - /// source. - external int get framesEncoded; - external set framesEncoded(int value); - external int get keyFramesEncoded; - external set keyFramesEncoded(int value); - - /// The **`qpSum`** property of the [RTCOutboundRtpStreamStats] dictionary is - /// a value generated by adding the **Quantization Parameter** (**QP**) values - /// for every frame this sender has produced to date on the video track - /// corresponding to this `RTCOutboundRtpStreamStats` object. - /// - /// In general, the higher this number is, the more heavily compressed the - /// video data is. - external int get qpSum; - external set qpSum(int value); - external num get totalEncodeTime; - external set totalEncodeTime(num value); - external num get totalPacketSendDelay; - external set totalPacketSendDelay(num value); - - /// The **`qualityLimitationReason`** - /// property of the [RTCOutboundRtpStreamStats] dictionary is a string - /// indicating the reason why the media quality in the stream is currently - /// being reduced - /// by the codec during encoding, or `none` if no quality reduction is being - /// performed. - /// - /// This quality reduction may include changes such as reduced frame - /// rate or resolution, or an increase in compression factor. - /// - /// The amount of time the encoded media has had its quality reduced in each - /// of the - /// potential ways that can be done can be found in - /// [RTCOutboundRtpStreamStats.qualityLimitationDurations]. - external RTCQualityLimitationReason get qualityLimitationReason; - external set qualityLimitationReason(RTCQualityLimitationReason value); - external JSObject get qualityLimitationDurations; - external set qualityLimitationDurations(JSObject value); - external int get qualityLimitationResolutionChanges; - external set qualityLimitationResolutionChanges(int value); - - /// The **`nackCount`** property of the - /// [RTCOutboundRtpStreamStats] dictionary is a numeric value indicating the - /// number of times the [RTCRtpSender] described by this object received a - /// **NACK** packet from the remote receiver. - /// - /// A NACK (Negative - /// ACKnowledgement, also called "Generic NACK") packet is used by the - /// [RTCRtpReceiver] to inform the sender that one or more - /// packets it sent were lost in transport. - external int get nackCount; - external set nackCount(int value); - - /// The **`firCount`** property of the - /// [RTCOutboundRtpStreamStats] dictionary indicates the number of - /// **Full Intra Request** (**FIR**) that the remote - /// [RTCRtpReceiver] has sent to this [RTCRtpSender]. - /// - /// A FIR packet is sent when the receiver finds that it has fallen behind and - /// needs to skip - /// frames in order to catch up; the sender should respond by sending a full - /// frame instead - /// of a delta frame. - /// - /// Available only on video media. - external int get firCount; - external set firCount(int value); - - /// The **`pliCount`** property of the - /// [RTCOutboundRtpStreamStats] dictionary states the number of times the - /// remote peer's [RTCRtpReceiver] sent a **Picture Loss - /// Indication** (**PLI**) packet to the [RTCRtpSender] - /// for which this object provides statistics. - /// - /// A PLI packet indicates that some - /// amount of encoded video data has been lost for one or more frames. - external int get pliCount; - external set pliCount(int value); - external String get encoderImplementation; - external set encoderImplementation(String value); - external bool get powerEfficientEncoder; - external set powerEfficientEncoder(bool value); - external bool get active; - external set active(bool value); - external String get scalabilityMode; - external set scalabilityMode(String value); -} - -/// The **`RTCRemoteOutboundRtpStreamStats`** dictionary of the -/// [WebRTC API](https://developer.mozilla.org/en-US/docs/Web/API/WebRTC_API) is -/// used to report statistics from remote endpoint of its outbound RTP stream, -/// which corresponds to an inbound stream that is currently received by an -/// [RTCPeerConnection] object. -/// -/// The statistics can be obtained by iterating the [RTCStatsReport] returned by -/// [RTCPeerConnection.getStats] until you find a report with the -/// [`type`](#type) of `remote-outbound-rtp`. -/// -/// --- -/// -/// API documentation sourced from -/// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/RTCRemoteOutboundRtpStreamStats). -extension type RTCRemoteOutboundRtpStreamStats._(JSObject _) - implements RTCSentRtpStreamStats, JSObject { - external factory RTCRemoteOutboundRtpStreamStats({ - required DOMHighResTimeStamp timestamp, - required RTCStatsType type, - required String id, - required int ssrc, - required String kind, - String transportId, - String codecId, - int packetsSent, - int bytesSent, - String localId, - DOMHighResTimeStamp remoteTimestamp, - int reportsSent, - num roundTripTime, - num totalRoundTripTime, - int roundTripTimeMeasurements, - }); - - /// The [RTCRemoteOutboundRtpStreamStats] dictionary's **`localId`** property - /// is a string which can be used to identify the [RTCInboundRtpStreamStats] - /// object whose [RTCInboundRtpStreamStats.remoteId] matches this value. - /// - /// Together, these two objects provide statistics about the inbound and - /// outbound sides of the same synchronization source (SSRC). - external String get localId; - external set localId(String value); - - /// The [RTCRemoteOutboundRtpStreamStats] property **`remoteTimestamp`** - /// indicates the timestamp on the remote peer at which these statistics were - /// sent. - /// This differs from `timestamp`, which indicates the time at which the - /// statistics were generated or received locally. - external DOMHighResTimeStamp get remoteTimestamp; - external set remoteTimestamp(DOMHighResTimeStamp value); - external int get reportsSent; - external set reportsSent(int value); - external num get roundTripTime; - external set roundTripTime(num value); - external num get totalRoundTripTime; - external set totalRoundTripTime(num value); - external int get roundTripTimeMeasurements; - external set roundTripTimeMeasurements(int value); -} -extension type RTCMediaSourceStats._(JSObject _) implements RTCStats, JSObject { - external factory RTCMediaSourceStats({ - required DOMHighResTimeStamp timestamp, - required RTCStatsType type, - required String id, - required String trackIdentifier, - required String kind, - }); - - external String get trackIdentifier; - external set trackIdentifier(String value); - external String get kind; - external set kind(String value); -} - -/// The -/// [WebRTC API](https://developer.mozilla.org/en-US/docs/Web/API/WebRTC_API)'s -/// **`RTCAudioSourceStats`** dictionary provides information about an audio -/// track that is attached to one or more senders. -/// -/// These statistics can be obtained by iterating the [RTCStatsReport] returned -/// by [RTCRtpSender.getStats] or [RTCPeerConnection.getStats] until you find a -/// report with the [`type`](#type) of `media-source` and a [`kind`](#kind) of -/// `audio`. -/// -/// > **Note:** For audio information about remotely sourced tracks (that are -/// > being received), see [RTCInboundRtpStreamStats]. -/// -/// --- -/// -/// API documentation sourced from -/// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/RTCAudioSourceStats). -extension type RTCAudioSourceStats._(JSObject _) - implements RTCMediaSourceStats, JSObject { - external factory RTCAudioSourceStats({ - required DOMHighResTimeStamp timestamp, - required RTCStatsType type, - required String id, - required String trackIdentifier, - required String kind, - num audioLevel, - num totalAudioEnergy, - num totalSamplesDuration, - num echoReturnLoss, - num echoReturnLossEnhancement, - }); - - /// The [RTCAudioSourceStats] dictionary's **`audioLevel`** property - /// represents the audio level of the media source. - /// - /// The level is averaged over some small implementation-dependent interval. - /// Users can alternatively calculate the average audio level over some - /// arbitrary duration using the algorithm described in the - /// [`RTCAudioSourceStats` description](https://developer.mozilla.org/en-US/docs/Web/API/RTCAudioSourceStats#description). - /// - /// > **Note:** For audio levels of remotely sourced tracks, see - /// > [RTCInboundRtpStreamStats.audioLevel]. - external num get audioLevel; - external set audioLevel(num value); - - /// The [RTCAudioSourceStats] dictionary's **`totalAudioEnergy`** property - /// represents the total audio energy of the media source over the lifetime of - /// this stats object. - /// - /// The total energy across a particular duration can be determined by - /// subtracting the value of this property returned by two different - /// `getStats()` calls. - /// - /// > **Note:** For audio energy of remotely sourced tracks, see - /// > [RTCInboundRtpStreamStats.totalAudioEnergy]. - external num get totalAudioEnergy; - external set totalAudioEnergy(num value); - - /// The [RTCAudioSourceStats] dictionary's **`totalSamplesDuration`** property - /// represents the combined duration of all samples produced by the media - /// source over the lifetime of this stats object, in seconds. - /// It does not include samples dropped before reaching this media source. - /// - /// - /// This can be used with [RTCAudioSourceStats.totalAudioEnergy] to compute an - /// [average audio level over different intervals](https://developer.mozilla.org/en-US/docs/Web/API/RTCAudioSourceStats#description). - /// - /// > **Note:** For audio duration of remotely sourced tracks, see - /// > [RTCInboundRtpStreamStats.totalSamplesDuration]. - external num get totalSamplesDuration; - external set totalSamplesDuration(num value); - external num get echoReturnLoss; - external set echoReturnLoss(num value); - external num get echoReturnLossEnhancement; - external set echoReturnLossEnhancement(num value); -} -extension type RTCVideoSourceStats._(JSObject _) - implements RTCMediaSourceStats, JSObject { - external factory RTCVideoSourceStats({ - required DOMHighResTimeStamp timestamp, - required RTCStatsType type, - required String id, - required String trackIdentifier, - required String kind, - int width, - int height, - int frames, - num framesPerSecond, - }); - - external int get width; - external set width(int value); - external int get height; - external set height(int value); - external int get frames; - external set frames(int value); - external num get framesPerSecond; - external set framesPerSecond(num value); -} -extension type RTCAudioPlayoutStats._(JSObject _) - implements RTCStats, JSObject { - external factory RTCAudioPlayoutStats({ - required DOMHighResTimeStamp timestamp, - required RTCStatsType type, - required String id, - required String kind, - num synthesizedSamplesDuration, - int synthesizedSamplesEvents, - num totalSamplesDuration, - num totalPlayoutDelay, - int totalSamplesCount, - }); - - external String get kind; - external set kind(String value); - external num get synthesizedSamplesDuration; - external set synthesizedSamplesDuration(num value); - external int get synthesizedSamplesEvents; - external set synthesizedSamplesEvents(int value); - external num get totalSamplesDuration; - external set totalSamplesDuration(num value); - external num get totalPlayoutDelay; - external set totalPlayoutDelay(num value); - external int get totalSamplesCount; - external set totalSamplesCount(int value); -} - -/// The **`RTCPeerConnectionStats`** dictionary of the -/// [WebRTC API](https://developer.mozilla.org/en-US/docs/Web/API/WebRTC_API) -/// provides information about the high level peer connection -/// ([RTCPeerConnection]). -/// -/// In particular, it provides the number of unique data channels that have been -/// opened, and the number of opened channels that have been closed. -/// This allows the current number of open channels to be calculated. -/// -/// These statistics can be obtained by iterating the [RTCStatsReport] returned -/// by [RTCPeerConnection.getStats] until you find a report with the -/// [`type`](#type) of `peer-connection`. -/// -/// --- -/// -/// API documentation sourced from -/// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnectionStats). -extension type RTCPeerConnectionStats._(JSObject _) - implements RTCStats, JSObject { - external factory RTCPeerConnectionStats({ - required DOMHighResTimeStamp timestamp, - required RTCStatsType type, - required String id, - int dataChannelsOpened, - int dataChannelsClosed, - }); - - /// The **`dataChannelsOpened`** property of the [RTCPeerConnectionStats] - /// dictionary indicates the number of unique [RTCDataChannel] objects that - /// have entered the - /// [`open`](https://developer.mozilla.org/en-US/docs/Web/API/RTCDataChannel/readyState#open) - /// state during their lifetime. - external int get dataChannelsOpened; - external set dataChannelsOpened(int value); - - /// The **`dataChannelsClosed`** property of the [RTCPeerConnectionStats] - /// dictionary indicates the number of unique [RTCDataChannel] objects that - /// have left the - /// [`open`](https://developer.mozilla.org/en-US/docs/Web/API/RTCDataChannel/readyState#open) - /// state during their lifetime. - /// - /// A channel will leave the `open` state if either end of the connection or - /// the underlying transport is closed. - /// Note that channels that transition to - /// [`closing`](https://developer.mozilla.org/en-US/docs/Web/API/RTCDataChannel/readyState#closing) - /// or - /// [`closed`](https://developer.mozilla.org/en-US/docs/Web/API/RTCDataChannel/readyState#closed) - /// without ever being `open` are not counted in this number. - external int get dataChannelsClosed; - external set dataChannelsClosed(int value); -} -extension type RTCDataChannelStats._(JSObject _) implements RTCStats, JSObject { - external factory RTCDataChannelStats({ - required DOMHighResTimeStamp timestamp, - required RTCStatsType type, - required String id, - String label, - String protocol, - int dataChannelIdentifier, - required RTCDataChannelState state, - int messagesSent, - int bytesSent, - int messagesReceived, - int bytesReceived, - }); - - external String get label; - external set label(String value); - external String get protocol; - external set protocol(String value); - external int get dataChannelIdentifier; - external set dataChannelIdentifier(int value); - external RTCDataChannelState get state; - external set state(RTCDataChannelState value); - external int get messagesSent; - external set messagesSent(int value); - external int get bytesSent; - external set bytesSent(int value); - external int get messagesReceived; - external set messagesReceived(int value); - external int get bytesReceived; - external set bytesReceived(int value); -} - -/// The **`RTCTransportStats`** dictionary of the -/// [WebRTC API](https://developer.mozilla.org/en-US/docs/Web/API/WebRTC_API) -/// provides information about the transport ([RTCDtlsTransport] and its -/// underlying [RTCIceTransport]) used by a particular candidate pair. -/// -/// The _BUNDLE_ feature is an SDP extension that allows negotiation to use a -/// single transport for sending and receiving media described by multiple SDP -/// media descriptions. -/// If the remote endpoint is aware of this feature, all [MediaStreamTrack] and -/// data channels are bundled onto a single transport at the completion of -/// negotiation. -/// This is true for current browsers, but if connecting to an older endpoint -/// that is not BUNDLE-aware, then separate transports might be used for -/// different media. -/// The policy to use in the negotiation is configured in the -/// [`RTCPeerConnection` constructor](https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection/RTCPeerConnection). -/// -/// These statistics can be obtained by iterating the [RTCStatsReport] returned -/// by [RTCPeerConnection.getStats] until you find a report with the -/// [`type`](#type) of `transport`. -/// -/// --- -/// -/// API documentation sourced from -/// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/RTCTransportStats). -extension type RTCTransportStats._(JSObject _) implements RTCStats, JSObject { - external factory RTCTransportStats({ - required DOMHighResTimeStamp timestamp, - required RTCStatsType type, - required String id, - int packetsSent, - int packetsReceived, - int bytesSent, - int bytesReceived, - RTCIceRole iceRole, - String iceLocalUsernameFragment, - required RTCDtlsTransportState dtlsState, - RTCIceTransportState iceState, - String selectedCandidatePairId, - String localCertificateId, - String remoteCertificateId, - String tlsVersion, - String dtlsCipher, - RTCDtlsRole dtlsRole, - String srtpCipher, - int selectedCandidatePairChanges, - }); - - external int get packetsSent; - external set packetsSent(int value); - external int get packetsReceived; - external set packetsReceived(int value); - external int get bytesSent; - external set bytesSent(int value); - external int get bytesReceived; - external set bytesReceived(int value); - external RTCIceRole get iceRole; - external set iceRole(RTCIceRole value); - external String get iceLocalUsernameFragment; - external set iceLocalUsernameFragment(String value); - external RTCDtlsTransportState get dtlsState; - external set dtlsState(RTCDtlsTransportState value); - external RTCIceTransportState get iceState; - external set iceState(RTCIceTransportState value); - external String get selectedCandidatePairId; - external set selectedCandidatePairId(String value); - external String get localCertificateId; - external set localCertificateId(String value); - external String get remoteCertificateId; - external set remoteCertificateId(String value); - external String get tlsVersion; - external set tlsVersion(String value); - external String get dtlsCipher; - external set dtlsCipher(String value); - external RTCDtlsRole get dtlsRole; - external set dtlsRole(RTCDtlsRole value); - external String get srtpCipher; - external set srtpCipher(String value); - external int get selectedCandidatePairChanges; - external set selectedCandidatePairChanges(int value); -} - -/// The **`RTCIceCandidateStats`** dictionary of the -/// [WebRTC API](https://developer.mozilla.org/en-US/docs/Web/API/WebRTC_API) is -/// used to report statistics related to an [RTCIceCandidate]. -/// -/// The statistics can be obtained by iterating the [RTCStatsReport] returned by -/// [RTCPeerConnection.getStats] until you find a report with the -/// [`type`](#type) of `local-candidate`. -/// -/// --- -/// -/// API documentation sourced from -/// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/RTCIceCandidateStats). -extension type RTCIceCandidateStats._(JSObject _) - implements RTCStats, JSObject { - external factory RTCIceCandidateStats({ - required DOMHighResTimeStamp timestamp, - required RTCStatsType type, - required String id, - required String transportId, - String? address, - int port, - String protocol, - required RTCIceCandidateType candidateType, - int priority, - String url, - RTCIceServerTransportProtocol relayProtocol, - String foundation, - String relatedAddress, - int relatedPort, - String usernameFragment, - RTCIceTcpCandidateType tcpType, - }); - - /// The [RTCIceCandidateStats] dictionary's - /// **`transportId`** property is a string that uniquely - /// identifies the transport that produced the [RTCTransportStats] from which - /// information about this candidate was taken. - external String get transportId; - external set transportId(String value); - - /// The **`address`** property of the - /// [RTCIceCandidateStats] dictionary indicates the address of the - /// candidate. While it's preferred that the address be specified as - /// an IPv4 or IPv6 numeric address, a fully-qualified domain name can be used - /// as - /// well. - /// - /// When a domain name is specified, the first IP address selected for that - /// address is used, even if the domain name maps to multiple IP addresses. - external String? get address; - external set address(String? value); - - /// The [RTCIceCandidateStats] dictionary's **`port`** - /// property specifies the network port used by the candidate. - external int get port; - external set port(int value); - - /// The [RTCIceCandidateStats] dictionary's - /// **`protocol`** property specifies the protocol the specified - /// candidate would use for communication with the remote peer. - external String get protocol; - external set protocol(String value); - - /// The [RTCIceCandidateStats] interface's - /// **`candidateType`** property is a string that indicates the - /// type of candidate the object represents. - external RTCIceCandidateType get candidateType; - external set candidateType(RTCIceCandidateType value); - - /// The [RTCIceCandidateStats] dictionary's - /// **`priority`** property is a positive integer value - /// indicating the priority (or desirability) of the described candidate. - /// - /// During negotiation while setting up a WebRTC peer connection, the - /// priority values reported to the remote peer by a are used - /// to determine which candidates are considered "more desirable". The higher - /// the value, - /// the more desirable the candidate is. - external int get priority; - external set priority(int value); - - /// The [RTCIceCandidateStats] dictionary's - /// **`url`** property specifies the URL of the - /// server from which the described candidate was obtained. This - /// property is _only_ available for local candidates. - external String get url; - external set url(String value); - - /// The [RTCIceCandidateStats] dictionary's - /// **`relayProtocol`** property specifies the protocol being used - /// by a local candidate to communicate with the - /// server. - /// - /// The ICE protocol being used by the candidate otherwise can be obtained - /// from the - /// [RTCIceCandidateStats.protocol] property. - external RTCIceServerTransportProtocol get relayProtocol; - external set relayProtocol(RTCIceServerTransportProtocol value); - external String get foundation; - external set foundation(String value); - external String get relatedAddress; - external set relatedAddress(String value); - external int get relatedPort; - external set relatedPort(int value); - external String get usernameFragment; - external set usernameFragment(String value); - external RTCIceTcpCandidateType get tcpType; - external set tcpType(RTCIceTcpCandidateType value); -} - -/// The **`RTCIceCandidatePairStats`** dictionary of the -/// [WebRTC API](https://developer.mozilla.org/en-US/docs/Web/API/WebRTC_API) is -/// used to report statistics that provide insight into the quality and -/// performance of an [RTCPeerConnection] while connected and configured as -/// described by the specified pair of candidates. -/// -/// The statistics can be obtained by iterating the [RTCStatsReport] returned by -/// [RTCPeerConnection.getStats] until you find an entry with the -/// [`type`](#type) of `"candidate-pair"`. -/// -/// --- -/// -/// API documentation sourced from -/// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/RTCIceCandidatePairStats). -extension type RTCIceCandidatePairStats._(JSObject _) - implements RTCStats, JSObject { - external factory RTCIceCandidatePairStats({ - required DOMHighResTimeStamp timestamp, - required RTCStatsType type, - required String id, - required String transportId, - required String localCandidateId, - required String remoteCandidateId, - required RTCStatsIceCandidatePairState state, - bool nominated, - int packetsSent, - int packetsReceived, - int bytesSent, - int bytesReceived, - DOMHighResTimeStamp lastPacketSentTimestamp, - DOMHighResTimeStamp lastPacketReceivedTimestamp, - num totalRoundTripTime, - num currentRoundTripTime, - num availableOutgoingBitrate, - num availableIncomingBitrate, - int requestsReceived, - int requestsSent, - int responsesReceived, - int responsesSent, - int consentRequestsSent, - int packetsDiscardedOnSend, - int bytesDiscardedOnSend, - }); - - /// The **`transportId`** property - /// uniquely identifies the [RTCIceTransport] that was inspected to obtain - /// the transport-related statistics contained in the - /// [RTCIceCandidatePairStats] object. - external String get transportId; - external set transportId(String value); - - /// The [RTCIceCandidatePairStats] property - /// **`localCandidateId`** is a string that uniquely identifies - /// the local candidate which was analyzed to generate the - /// [RTCIceCandidateStats] used to compute the statistics for this pair of - /// candidates. - external String get localCandidateId; - external set localCandidateId(String value); - - /// The [RTCIceCandidatePairStats] property - /// **`remoteCandidateId`** is a string that uniquely identifies - /// the remote candidate which was analyzed to generate the - /// [RTCIceCandidateStats] used to compute the statistics for this pair of - /// candidates. - external String get remoteCandidateId; - external set remoteCandidateId(String value); - - /// The **`state`** property is a string that indicates the state of the - /// checklist of which the candidate pair is a member. - external RTCStatsIceCandidatePairState get state; - external set state(RTCStatsIceCandidatePairState value); - - /// The [RTCIceCandidatePairStats] property - /// **`nominated`** specifies whether or not the candidate pair - /// described by the underlying `RTCIceCandidatePair` has been nominated to be - /// used as the configuration for the WebRTC connection. - external bool get nominated; - external set nominated(bool value); - external int get packetsSent; - external set packetsSent(int value); - external int get packetsReceived; - external set packetsReceived(int value); - - /// The [RTCIceCandidatePairStats] property - /// **`bytesSent`** indicates the total number of payload - /// bytes—that is, bytes which aren't overhead such as headers or padding—that - /// have been - /// sent so far on the connection described by the candidate pair. - /// - /// The [RTCIceCandidatePairStats.bytesReceived] property - /// reports the number of bytes received so far on the described connection. - external int get bytesSent; - external set bytesSent(int value); - - /// The [RTCIceCandidatePairStats] property - /// **`bytesReceived`** indicates the total number of payload - /// bytes—that is, bytes which aren't overhead such as headers or padding—that - /// have been - /// received to date on the connection described by the candidate pair. - /// - /// The [RTCIceCandidatePairStats.bytesSent] property reports the - /// number of bytes sent so far on the described connection. - external int get bytesReceived; - external set bytesReceived(int value); - - /// The [RTCIceCandidatePairStats] property - /// **`lastPacketSentTimestamp`** indicates the time at which the - /// connection described by the candidate pair last sent a packet, not - /// including - /// packets. - external DOMHighResTimeStamp get lastPacketSentTimestamp; - external set lastPacketSentTimestamp(DOMHighResTimeStamp value); - - /// The [RTCIceCandidatePairStats] property - /// **`lastPacketReceivedTimestamp`** indicates the time at which - /// the connection described by the candidate pair last received a packet. - /// packets are not included. - external DOMHighResTimeStamp get lastPacketReceivedTimestamp; - external set lastPacketReceivedTimestamp(DOMHighResTimeStamp value); - - /// The [RTCIceCandidatePairStats] dictionary's - /// **`totalRoundTripTime`** property is the total time that has - /// elapsed between sending requests and receiving the responses, for - /// all such requests that have been made so far on the pair of candidates - /// described by - /// this `RTCIceCandidatePairStats` object. This value includes both - /// connectivity check and consent check requests. - external num get totalRoundTripTime; - external set totalRoundTripTime(num value); - - /// The [RTCIceCandidatePairStats] property - /// **`currentRoundTripTime`** is a floating-point value - /// indicating the number of seconds it takes for data to be sent by this peer - /// to the - /// remote peer and back over the connection described by this pair of - /// candidates. - external num get currentRoundTripTime; - external set currentRoundTripTime(num value); - - /// The [RTCIceCandidatePairStats] property - /// **`availableOutgoingBitrate`** returns a value indicative of - /// the available outbound capacity of the network connection represented by - /// the candidate - /// pair. The higher the value, the more bandwidth you can assume is available - /// for - /// outgoing data. - /// - /// You can get the incoming available bitrate from - /// [RTCIceCandidatePairStats.availableIncomingBitrate]. - external num get availableOutgoingBitrate; - external set availableOutgoingBitrate(num value); - - /// The [RTCIceCandidatePairStats] property - /// **`availableIncomingBitrate`** returns a value indicative of - /// the available inbound capacity of the network connection represented by - /// the candidate - /// pair. The higher the value, the more bandwidth you can assume is available - /// for - /// incoming data. - /// - /// You can get the outgoing available bitrate from - /// [RTCIceCandidatePairStats.availableoutgoingBitrate]. - external num get availableIncomingBitrate; - external set availableIncomingBitrate(num value); - - /// The [RTCIceCandidatePairStats] dictionary's - /// **`requestsReceived`** property indicates the total number of - /// connectivity check requests that have been received so far on the - /// connection described by this pairing of candidates. - external int get requestsReceived; - external set requestsReceived(int value); - - /// The [RTCIceCandidatePairStats] dictionary's - /// **`requestsSent`** property indicates the total number of - /// connectivity check requests that have been sent so far on the - /// connection described by this pair of candidates. - external int get requestsSent; - external set requestsSent(int value); - - /// The **`responsesReceived`** property - /// in the [RTCIceCandidatePairStats] dictionary indicates the total number - /// of connectivity check responses that have been received on the - /// connection described by this pair of candidates. - external int get responsesReceived; - external set responsesReceived(int value); - - /// The [RTCIceCandidatePairStats] dictionary's - /// **`responsesSent`** property indicates the total number of - /// connectivity check responses that have been sent so far on the - /// connection described by this pair of candidates. - external int get responsesSent; - external set responsesSent(int value); - external int get consentRequestsSent; - external set consentRequestsSent(int value); - external int get packetsDiscardedOnSend; - external set packetsDiscardedOnSend(int value); - external int get bytesDiscardedOnSend; - external set bytesDiscardedOnSend(int value); -} - -/// The **`RTCCertificateStats`** dictionary of the -/// [WebRTC API](https://developer.mozilla.org/en-US/docs/Web/API/WebRTC_API) is -/// used to report information about a certificate used by an [RTCDtlsTransport] -/// and its underlying [RTCIceTransport]. -/// -/// The report can be obtained by iterating the [RTCStatsReport] returned by -/// [RTCPeerConnection.getStats] until you find an entry with the -/// [`type`](#type) of `certificate`. -/// -/// --- -/// -/// API documentation sourced from -/// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/RTCCertificateStats). -extension type RTCCertificateStats._(JSObject _) implements RTCStats, JSObject { - external factory RTCCertificateStats({ - required DOMHighResTimeStamp timestamp, - required RTCStatsType type, - required String id, - required String fingerprint, - required String fingerprintAlgorithm, - required String base64Certificate, - String issuerCertificateId, - }); - - /// The **`fingerprint`** property of the [RTCCertificateStats] dictionary is - /// a string containing the fingerprint value of the associated - /// [RTCCertificate]. - external String get fingerprint; - external set fingerprint(String value); - - /// The **`fingerprintAlgorithm`** property of the [RTCCertificateStats] - /// dictionary is a string containing the name of the hash function used to - /// generate the [RTCCertificateStats.fingerprint] value in the associated - /// [RTCCertificate]. - external String get fingerprintAlgorithm; - external set fingerprintAlgorithm(String value); - - /// The **`base64Certificate`** property of the [RTCCertificateStats] - /// dictionary is a string containing the base-64 representation of the - /// DER-encoded certificate. - /// - /// This is essentially an encoding of the original certificate as a string - /// that can safely serialized and deserialized when sent over an IP network. - external String get base64Certificate; - external set base64Certificate(String value); - external String get issuerCertificateId; - external set issuerCertificateId(String value); -} diff --git a/lib/src/dom/webtransport.dart b/lib/src/dom/webtransport.dart new file mode 100644 index 00000000..eaa6614a --- /dev/null +++ b/lib/src/dom/webtransport.dart @@ -0,0 +1,328 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. +// +// API docs from [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web). +// Attributions and copyright licensing by Mozilla Contributors is licensed +// under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/. + +// Generated from Web IDL definitions. + +@JS() +library; + +import 'dart:js_interop'; + +import 'streams.dart'; +import 'webidl.dart'; + +typedef WebTransportCongestionControl = String; +typedef WebTransportErrorSource = String; + +/// The **`WebTransportDatagramDuplexStream`** interface of the +/// [WebTransport API] represents a duplex stream that can be used for +/// unreliable transport of datagrams between client and server. Provides access +/// to a [ReadableStream] for reading incoming datagrams, a [WritableStream] for +/// writing outgoing datagrams, and various settings and statistics related to +/// the stream. +/// +/// This is accessed via the [WebTransport.datagrams] property. +/// +/// "Unreliable" means that transmission of data is not guaranteed, nor is +/// arrival in a specific order. This is fine in some situations and provides +/// very fast delivery. For example, you might want to transmit regular game +/// state updates where each message supersedes the last one that arrives, and +/// order is not important. +/// +/// --- +/// +/// API documentation sourced from +/// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/WebTransportDatagramDuplexStream). +extension type WebTransportDatagramDuplexStream._(JSObject _) + implements JSObject { + /// The **`readable`** read-only property of the + /// [WebTransportDatagramDuplexStream] interface returns a [ReadableStream] + /// instance that can be used to unreliably read incoming datagrams from the + /// stream. + /// + /// "Unreliably" means that transmission of data is not guaranteed, nor is + /// arrival in a specific order. This is fine in some situations and provides + /// very fast delivery. For example, you might want to transmit regular game + /// state updates where each message supersedes the last one that arrives, and + /// order is not important. + external ReadableStream get readable; + + /// The **`writable`** read-only property of the + /// [WebTransportDatagramDuplexStream] interface returns a [WritableStream] + /// instance that can be used to unreliably write outgoing datagrams to the + /// stream. + /// + /// "Unreliably" means that transmission of data is not guaranteed, nor is + /// arrival in a specific order. This is fine in some situations and provides + /// very fast delivery. For example, you might want to transmit regular game + /// state updates where each message supersedes the last one that arrives, and + /// order is not important. + external WritableStream get writable; + + /// The **`maxDatagramSize`** read-only property of the + /// [WebTransportDatagramDuplexStream] interface returns the maximum allowable + /// size of outgoing datagrams, in bytes, that can be written to + /// [WebTransportDatagramDuplexStream.writable]. + external int get maxDatagramSize; + + /// The **`incomingMaxAge`** property of the + /// [WebTransportDatagramDuplexStream] interface gets or sets the maximum age + /// for incoming datagrams, in milliseconds. + external num? get incomingMaxAge; + external set incomingMaxAge(num? value); + + /// The **`outgoingMaxAge`** property of the + /// [WebTransportDatagramDuplexStream] interface gets or sets the maximum age + /// for outgoing datagrams, in milliseconds. + external num? get outgoingMaxAge; + external set outgoingMaxAge(num? value); + + /// The **`incomingHighWaterMark`** property of the + /// [WebTransportDatagramDuplexStream] interface gets or sets the high water + /// mark for incoming chunks of data — this is the maximum size, in chunks, + /// that the incoming [ReadableStream]'s internal queue can reach before it is + /// considered full. See + /// [Internal queues and queuing strategies](https://developer.mozilla.org/en-US/docs/Web/API/Streams_API/Concepts#internal_queues_and_queuing_strategies) + /// for more information. + external num get incomingHighWaterMark; + external set incomingHighWaterMark(num value); + + /// The **`outgoingHighWaterMark`** property of the + /// [WebTransportDatagramDuplexStream] interface gets or sets the high water + /// mark for outgoing chunks of data — this is the maximum size, in chunks, + /// that the outgoing [WritableStream]'s internal queue can reach before it is + /// considered full. See + /// [Internal queues and queuing strategies](https://developer.mozilla.org/en-US/docs/Web/API/Streams_API/Concepts#internal_queues_and_queuing_strategies) + /// for more information. + external num get outgoingHighWaterMark; + external set outgoingHighWaterMark(num value); +} + +/// The **`WebTransport`** interface of the [WebTransport API] provides +/// functionality to enable a user agent to connect to an HTTP/3 server, +/// initiate reliable and unreliable transport in either or both directions, and +/// close the connection once it is no longer needed. +/// +/// --- +/// +/// API documentation sourced from +/// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/WebTransport). +extension type WebTransport._(JSObject _) implements JSObject { + external factory WebTransport( + String url, [ + WebTransportOptions options, + ]); + + /// The **`close()`** method of the [WebTransport] interface closes an ongoing + /// WebTransport session. + external void close([WebTransportCloseInfo closeInfo]); + + /// The **`createBidirectionalStream()`** method of the [WebTransport] + /// interface asynchronously opens and returns a bidirectional stream. + /// + /// The method returns a `Promise` that resolves to a + /// [WebTransportBidirectionalStream] object, which has `readable` and + /// `writable` properties that can be used to reliably read from and write to + /// the server. + /// "Reliable" means that transmission and order of data are guaranteed. + /// This provides slower delivery (albeit faster than with WebSockets) than + /// [WebTransport.datagrams], but is needed in situations where reliability + /// and ordering are important, like chat applications. + /// + /// The relative order in which queued bytes are emptied from created streams + /// can be specified using the `sendOrder` option. + /// If set, queued bytes in streams with a higher send order are guaranteed to + /// be sent before queued bytes for streams with a lower send order. + /// If the order number is not set then the order in which bytes are sent is + /// implementation dependent. + /// Note however that even though bytes from higher send-order streams are + /// sent first, they may not arrive first. + external JSPromise createBidirectionalStream( + [WebTransportSendStreamOptions options]); + + /// The **`createUnidirectionalStream()`** method of the [WebTransport] + /// interface asynchronously opens a unidirectional stream. + /// + /// The method returns a `Promise` that resolves to a [WritableStream] object, + /// which can be used to reliably write data to the server. + /// + /// + /// + /// "Reliable" means that transmission and order of data are guaranteed. This + /// provides slower delivery (albeit faster than with WebSockets) than + /// [WebTransport.datagrams], but is needed in situations where reliability + /// and ordering are important, like chat applications. + /// + /// The relative order in which queued bytes are emptied from created streams + /// can be specified using the `sendOrder` option. + /// If set, queued bytes in streams with a higher send order are guaranteed to + /// be sent before queued bytes for streams with a lower send order. + /// If the order number is not set then the order in which bytes are sent is + /// implementation dependent. + /// Note however that even though bytes from higher send-order streams are + /// sent first, they may not arrive first. + external JSPromise createUnidirectionalStream( + [WebTransportSendStreamOptions options]); + + /// The **`ready`** read-only property of the [WebTransport] interface returns + /// a promise that resolves when the transport is ready to use. + external JSPromise get ready; + + /// The **`closed`** read-only property of the [WebTransport] interface + /// returns a promise that resolves when the transport is closed. + external JSPromise get closed; + + /// The **`datagrams`** read-only property of the [WebTransport] interface + /// returns a [WebTransportDatagramDuplexStream] instance that can be used to + /// send and receive datagrams — unreliable data transmission. + /// + /// "Unreliable" means that transmission of data is not guaranteed, nor is + /// arrival in a specific order. This is fine in some situations and provides + /// very fast delivery. For example, you might want to transmit regular game + /// state updates where each message supersedes the last one that arrives, and + /// order is not important. + external WebTransportDatagramDuplexStream get datagrams; + + /// The **`incomingBidirectionalStreams`** read-only property of the + /// [WebTransport] interface represents one or more bidirectional streams + /// opened by the server. Returns a [ReadableStream] of + /// [WebTransportBidirectionalStream] objects. Each one can be used to + /// reliably read data from the server and write data back to it. + /// + /// "Reliable" means that transmission and order of data are guaranteed. This + /// provides slower delivery (albeit faster than with WebSockets) than + /// [WebTransport.datagrams], but is needed in situations where reliability + /// and ordering are important, like chat applications. + external ReadableStream get incomingBidirectionalStreams; + + /// The **`incomingUnidirectionalStreams`** read-only property of the + /// [WebTransport] interface represents one or more unidirectional streams + /// opened by the server. Returns a [ReadableStream] of + /// [WebTransportReceiveStream] objects. Each one can be used to reliably read + /// data from the server. + /// + /// "Reliable" means that transmission and order of data are guaranteed. This + /// provides slower delivery (albeit faster than with WebSockets) than + /// [WebTransport.datagrams], but is needed in situations where reliability + /// and ordering are important, like chat applications. + external ReadableStream get incomingUnidirectionalStreams; +} +extension type WebTransportHash._(JSObject _) implements JSObject { + external factory WebTransportHash({ + String algorithm, + BufferSource value, + }); + + external String get algorithm; + external set algorithm(String value); + external BufferSource get value; + external set value(BufferSource value); +} +extension type WebTransportOptions._(JSObject _) implements JSObject { + external factory WebTransportOptions({ + bool allowPooling, + bool requireUnreliable, + JSArray serverCertificateHashes, + WebTransportCongestionControl congestionControl, + }); + + external bool get allowPooling; + external set allowPooling(bool value); + external bool get requireUnreliable; + external set requireUnreliable(bool value); + external JSArray get serverCertificateHashes; + external set serverCertificateHashes(JSArray value); + external WebTransportCongestionControl get congestionControl; + external set congestionControl(WebTransportCongestionControl value); +} +extension type WebTransportCloseInfo._(JSObject _) implements JSObject { + external factory WebTransportCloseInfo({ + int closeCode, + String reason, + }); + + external int get closeCode; + external set closeCode(int value); + external String get reason; + external set reason(String value); +} +extension type WebTransportSendStreamOptions._(JSObject _) implements JSObject { + external factory WebTransportSendStreamOptions({ + JSObject? sendGroup, + int sendOrder, + bool waitUntilAvailable, + }); + + external JSObject? get sendGroup; + external set sendGroup(JSObject? value); + external int get sendOrder; + external set sendOrder(int value); + external bool get waitUntilAvailable; + external set waitUntilAvailable(bool value); +} + +/// The **`WebTransportBidirectionalStream`** interface of the +/// [WebTransport API] represents a bidirectional stream created by a server or +/// a client that can be used for reliable transport. Provides access to a +/// [WebTransportReceiveStream] for reading incoming data, and a +/// [WebTransportSendStream] for writing outgoing data. +/// +/// --- +/// +/// API documentation sourced from +/// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/WebTransportBidirectionalStream). +extension type WebTransportBidirectionalStream._(JSObject _) + implements JSObject { + /// The **`readable`** read-only property of the + /// [WebTransportBidirectionalStream] interface returns a + /// [WebTransportReceiveStream] instance that can be used to reliably read + /// incoming data. + external JSObject get readable; + + /// The **`writable`** read-only property of the + /// [WebTransportBidirectionalStream] interface returns a + /// [WebTransportSendStream] instance that can be used to write outgoing data. + external JSObject get writable; +} + +/// The **`WebTransportError`** interface of the [WebTransport API] represents +/// an error related to the API, which can arise from server errors, network +/// connection problems, or client-initiated abort operations (for example, +/// arising from a [WritableStream.abort] call). +/// +/// --- +/// +/// API documentation sourced from +/// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/WebTransportError). +extension type WebTransportError._(JSObject _) + implements DOMException, JSObject { + external factory WebTransportError([ + String message, + WebTransportErrorOptions options, + ]); + + /// The **`source`** read-only property of the [WebTransportError] interface + /// returns an enumerated value indicating the source of the error. + external WebTransportErrorSource get source; + + /// The **`streamErrorCode`** read-only property of the [WebTransportError] + /// interface returns a number in the range 0-255 indicating the application + /// protocol error code for this error, or `null` if one is not available. + external int? get streamErrorCode; +} +extension type WebTransportErrorOptions._(JSObject _) implements JSObject { + external factory WebTransportErrorOptions({ + WebTransportErrorSource source, + int? streamErrorCode, + }); + + external WebTransportErrorSource get source; + external set source(WebTransportErrorSource value); + external int? get streamErrorCode; + external set streamErrorCode(int? value); +} diff --git a/lib/src/dom/webxr.dart b/lib/src/dom/webxr.dart new file mode 100644 index 00000000..7cba7e4b --- /dev/null +++ b/lib/src/dom/webxr.dart @@ -0,0 +1,612 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. +// +// API docs from [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web). +// Attributions and copyright licensing by Mozilla Contributors is licensed +// under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/. + +// Generated from Web IDL definitions. + +@JS() +library; + +import 'dart:js_interop'; + +import 'dom.dart'; +import 'gamepad.dart'; +import 'geometry.dart'; +import 'html.dart'; +import 'webxr_hand_input.dart'; + +typedef XRHandedness = String; +typedef XRTargetRayMode = String; + +/// The **`XRSpace`** interface of the +/// [WebXR Device API](https://developer.mozilla.org/en-US/docs/Web/API/WebXR_Device_API) +/// is an abstract interface providing a common basis for every class which +/// represents a virtual coordinate system within the virtual world, in which +/// its origin corresponds to a physical location. Spatial data in WebXR is +/// always expressed relative to an object based upon one of the descendant +/// interfaces of `XRSpace`, at the time at which a given [XRFrame] takes place. +/// +/// Numeric values such as pose positions are thus coordinates in the +/// corresponding `XRSpace`, relative to that space's origin. +/// +/// > **Note:** The `XRSpace` interface is never used directly; instead, all +/// > spaces are created using one of the interfaces based on `XRSpace`. At this +/// > time, those are [XRReferenceSpace], [XRBoundedReferenceSpace], and +/// > [XRJointSpace]. +/// +/// --- +/// +/// API documentation sourced from +/// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/XRSpace). +extension type XRSpace._(JSObject _) implements EventTarget, JSObject {} + +/// The WebXR Device API's **`XRReferenceSpace`** interface describes the +/// coordinate system for a specific tracked entity or object within the virtual +/// world using a specified tracking behavior. The tracking behavior is defined +/// by the selected [reference space type](#reference_space_types). It expands +/// upon the base class, [XRSpace], by adding support for several different +/// tracking behaviors as well as to request a new reference space which +/// describes the offset transform between the tracked object and another +/// location in the world. +/// +/// All reference spaces—with the sole exception being bounded reference +/// spaces—are described using the `XRReferenceSpace` type. Bounded spaces are +/// implemented as [XRBoundedReferenceSpace] objects. These are special spaces +/// which let you establish a perimeter within which it's "safe" for the viewer +/// to move. For XR systems that allow the user to physically move around, such +/// as those that track movement with a real-world camera, this boundary +/// establishes the edges of the area the user is able to move around in, +/// whether due to physical obstacles or due to limitations of the XR hardware. +/// See the article +/// [Using bounded reference spaces to protect the viewer](https://developer.mozilla.org/en-US/docs/Web/API/WebXR_Device_API/Bounded_reference_spaces) +/// for more on using boundaries to keep the user from colliding with obstacles +/// both physical and virtual. +/// +/// --- +/// +/// API documentation sourced from +/// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/XRReferenceSpace). +extension type XRReferenceSpace._(JSObject _) implements XRSpace, JSObject { + /// The [XRReferenceSpace] + /// interface's **`getOffsetReferenceSpace()`** method returns a + /// new reference space object which describes the relative difference in + /// position between + /// the object on which the method is called and a given point in 3D space. + /// The + /// object returned by `getOffsetReferenceSpace()` is an + /// [XRReferenceSpace] if called on an `XRReferenceSpace`, or an + /// [XRBoundedReferenceSpace] if called on an object of that type. + /// + /// In other words, when you have an object in 3D space and need to position + /// another object + /// relative to that one, you can call `getOffsetReferenceSpace()`, passing + /// into + /// it the position and orientation you want the second object to have + /// _relative to the position and orientation of the object on which you call + /// `getOffsetReferenceSpace()`_. + /// + /// Then, when drawing the scene, you can use the offset reference space to + /// not only + /// position objects relative to one another, but to apply the needed + /// transforms to render + /// objects properly based upon the viewer's position. This is demonstrated in + /// the example + /// [Implementing rotation based on non-XR inputs](#implementing_rotation_based_on_non-xr_inputs), + /// which demonstrates a way to + /// use this method to let the user use their mouse to pitch and yaw their + /// viewing angle. + external XRReferenceSpace getOffsetReferenceSpace( + XRRigidTransform originOffset); + external EventHandler get onreset; + external set onreset(EventHandler value); +} + +/// The WebXR Device API's **`XRViewport`** interface provides properties used +/// to describe the size and position of the current viewport within the +/// [XRWebGLLayer] being used to render the 3D scene. +/// +/// --- +/// +/// API documentation sourced from +/// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/XRViewport). +extension type XRViewport._(JSObject _) implements JSObject { + /// The read-only [XRViewport] interface's + /// **`x`** property indicates the offset from the left edge of + /// the destination surface (typically a [XRWebGLLayer]) to the left edge of + /// the viewport within the surface into which WebXR content is to be + /// rendered. The + /// viewport's [XRViewport.y] property identifies the `y` + /// component of the origin, and its is given by the [XRViewPort.width] + /// and [XRViewport.height] properties. + external int get x; + + /// The read-only [XRViewport] interface's + /// **`y`** property indicates the offset from the bottom edge of + /// the destination surface (typically a [XRWebGLLayer]) to the bottom edge of + /// the viewport within the surface into which WebXR content is to be + /// rendered. The + /// viewport's [XRViewport.x] property identifies the `x` + /// component of the origin, and its is given by the [XRViewPort.width] + /// and [XRViewport.height] properties. + external int get y; + + /// The read-only [XRViewport] property + /// **`width`** specifies the width of the viewport, in pixels, + /// onto the drawing surface the 3D scene is to be rendered into. This is + /// defined + /// using this property along with the viewport's [XRViewport.height] + /// and its origin given by its properties [XRViewport.x] and + /// [XRViewport.y]. + external int get width; + + /// The read-only [XRViewport] property + /// **`height`** specifies the height, in pixels, of the viewport + /// onto the drawing surface within which the WebXR view is to be rendered. + /// Along + /// with [XRViewport.width] and the origin point given by + /// [XRViewport.x] and [XRViewport.y], this defines the + /// area within which rendered content will be drawn. + external int get height; +} + +/// The **`XRRigidTransform`** is a +/// [WebXR API](https://developer.mozilla.org/en-US/docs/Web/API/WebXR_Device_API) +/// interface that represents the 3D geometric transform described by a position +/// and orientation. +/// +/// `XRRigidTransform` is used to specify transforms throughout the WebXR APIs, +/// including: +/// +/// - The offset and orientation relative to the parent reference space to use +/// when creating a new reference space with +/// [XRReferenceSpace.getOffsetReferenceSpace]. +/// - The [XRView.transform] of an [XRView]. +/// - The [XRPose.transform] of an [XRPose]. +/// - The [XRReferenceSpaceEvent] event's [XRReferenceSpaceEvent.transform] +/// property, as found in the [XRReferenceSpace.reset_event] event received by +/// an [XRReferenceSpace]. +/// +/// Using `XRRigidTransform` in these places rather than bare arrays that +/// provide the matrix data has an advantage. It automatically computes the +/// inverse of the transform and even caches it making subsequent requests +/// significantly faster. +/// +/// --- +/// +/// API documentation sourced from +/// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/XRRigidTransform). +extension type XRRigidTransform._(JSObject _) implements JSObject { + external factory XRRigidTransform([ + DOMPointInit position, + DOMPointInit orientation, + ]); + + /// The read-only [XRRigidTransform] property + /// **`position`** is a [DOMPointReadOnly] object which + /// provides the 3D point, specified in meters, describing the translation + /// component of the + /// transform. + external DOMPointReadOnly get position; + + /// The read-only [XRRigidTransform] property + /// **`orientation`** is a [DOMPointReadOnly] + /// containing a normalized (also called a **unit + /// quaternion** or **[versor](https://en.wikipedia.org/wiki/Versor)**) + /// specifying the rotational component of the transform represented by the + /// object. + /// If you specify a quaternion whose length is not exactly 1.0 meters, it + /// will be + /// normalized for you. + external DOMPointReadOnly get orientation; + + /// The read-only [XRRigidTransform] property + /// **`matrix`** returns the transform + /// matrix represented by the object. The returned matrix can then be + /// premultiplied with a + /// column vector to rotate the + /// vector by the 3D rotation specified by the + /// [XRRigidTransform.orientation], then translate + /// it by the [XRRigidTransform.position]. + external JSFloat32Array get matrix; + + /// The read-only **`inverse`** property + /// of the [XRRigidTransform] interface returns another + /// [XRRigidTransform] object which is the inverse of its owning + /// transform. That is, you can always get the inverse of any + /// `XRRigidTransform` using its `inverse` property, instead of having + /// to explicitly generate it. + external XRRigidTransform get inverse; +} + +/// `XRPose` is a +/// [WebXR API](https://developer.mozilla.org/en-US/docs/Web/API/WebXR_Device_API) +/// interface representing a position and orientation in the 3D space, relative +/// to the [XRSpace] within which it resides. The `XRSpace`—which is either an +/// [XRReferenceSpace] or an [XRBoundedReferenceSpace]—defines the coordinate +/// system used for the pose and, in the case of an [XRViewerPose], its +/// underlying views. +/// +/// To obtain the `XRPose` for the `XRSpace` used as the local coordinate system +/// of an object, call [XRFrame.getPose], specifying that local `XRSpace` and +/// the space to which you wish to convert: +/// +/// ```js +/// thePose = xrFrame.getPose(localSpace, baseSpace); +/// ``` +/// +/// The pose for a viewer (or camera) is represented by the [XRViewerPose] +/// subclass of `XRPose`. This is obtained using [XRFrame.getViewerPose] instead +/// of `getPose()`, specifying a reference space which has been adjusted to +/// position and orient the node to provide the desired viewing position and +/// angle: +/// +/// ```js +/// viewerPose = xrFrame.getViewerPose(adjReferenceSpace); +/// ``` +/// +/// Here, `adjReferenceSpace` is a reference space which has been updated using +/// the base frame of reference for the frame and any adjustments needed to +/// position the viewer based on movement or rotation which is being supplied +/// from a source other than the XR device, such as keyboard or mouse inputs. +/// +/// See the article [Movement, orientation, and +/// motion](https://developer.mozilla.org/en-US/docs/Web/API/WebXR_Device_API/Movement_and_motion) +/// for further details and an example with thorough explanations of what's +/// going on. +/// +/// --- +/// +/// API documentation sourced from +/// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/XRPose). +extension type XRPose._(JSObject _) implements JSObject { + /// The `transform` read-only attribute of the + /// [XRPose] interface is a [XRRigidTransform] object providing + /// the position and orientation of the pose relative to the base [XRSpace] + /// as specified when the pose was obtained by calling + /// [XRFrame.getPose]. + external XRRigidTransform get transform; + + /// The `linearVelocity` read-only property of the + /// [XRPose] interface is a [DOMPointReadOnly] describing + /// the linear velocity in meters per second relative to the base + /// [XRSpace]. + external DOMPointReadOnly? get linearVelocity; + + /// The `angularVelocity` read-only property of the + /// [XRPose] interface is a [DOMPointReadOnly] describing + /// the angular velocity in radians per second relative to the base + /// [XRSpace]. + external DOMPointReadOnly? get angularVelocity; + + /// The `emulatedPosition` read-only attribute of the + /// [XRPose] interface is a Boolean value indicating whether or not both the + /// [XRRigidTransform.position] component of the pose's + /// [XRPose.transform] is directly taken from the XR device, or + /// it's simulated or computed based on other sources. + external bool get emulatedPosition; +} + +/// The WebXR Device API interface **`XRViewerPose`** represents the pose (the +/// position and orientation) of a viewer's point of view on the scene. Each +/// `XRViewerPose` can have multiple views to represent, for example, the slight +/// separation between the left and right eye. +/// +/// This view can represent anything from the point-of-view of a user's XR +/// headset to the viewpoint represented by a player's movement of an avatar +/// using mouse and keyboard, presented on the screen, to a virtual camera +/// capturing the scene for a spectator. +/// +/// --- +/// +/// API documentation sourced from +/// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/XRViewerPose). +extension type XRViewerPose._(JSObject _) implements XRPose, JSObject { + /// The read-only [XRViewerPose] property **`views`** + /// returns an array which contains every [XRView] which must be rendered in + /// order to fully represent the scene from the viewpoint defined by the + /// viewer pose. For + /// monoscopic devices, this array contains a single view. + /// + /// > **Warning:** There is no guarantee that the number of views will + /// > remain constant over the lifetime of an [XRSession]. For each frame, you + /// > should always use the current length of this array rather than caching + /// > the value. + /// + /// Stereo views require two views to render properly, with the left eye's + /// view having its + /// [XRView.eye] set to the string `left` and the right eye's + /// view a value of `right`. + external JSArray get views; +} + +/// The [WebXR Device +/// API's](https://developer.mozilla.org/en-US/docs/Web/API/WebXR_Device_API) +/// **`XRInputSource`** interface describes a single source of control input +/// which is part of the user's WebXR-compatible virtual or augmented reality +/// system. The device is specific to the platform being used, but provides the +/// direction in which it is being aimed and optionally may generate events if +/// the user triggers performs actions using the device. +/// +/// --- +/// +/// API documentation sourced from +/// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/XRInputSource). +extension type XRInputSource._(JSObject _) implements JSObject { + /// The read-only [XRInputSource] property **`gamepad`** returns a [Gamepad] + /// object describing the state of the buttons and axes on the XR input + /// source, if it is a gamepad or comparable device. If the device isn't a + /// gamepad-like device, this property's value is `null`. + /// + /// The [Gamepad] instance returned behaves as described by the + /// [Gamepad API](https://developer.mozilla.org/en-US/docs/Web/API/Gamepad_API). + /// However, there are a few things to note: + /// + /// - `Gamepad` instances belonging to `XRInputSource` are not included in the + /// array returned by [navigator.getGamepads]. Gamepads are strictly + /// associated with the WebXR hardware and are not general-purpose gaming + /// devices. + /// - [Gamepad.id] is an empty string (`""`) + /// - [Gamepad.index] is `-1` + /// - [Gamepad.connected] is `true` until the `XRInputSource` is removed from + /// the list of active XR input sources or the [XRSession] is ended. + /// - If an axis reported by [Gamepad.axes] represents an axis of a touchpad, + /// the value is 0 when the associated [GamepadButton.touched] property is + /// `false`. + /// - [Gamepad.mapping] returns "xr-standard". + external Gamepad? get gamepad; + + /// The read-only **`hand`** property of the [XRInputSource] interface is a + /// [XRHand] object providing access to a hand-tracking device. + external XRHand? get hand; + + /// The read-only [XRInputSource] property + /// **`handedness`** indicates which of the user's hands the WebXR + /// input source is associated with, or if it's not associated with a hand at + /// all. + external XRHandedness get handedness; + + /// The read-only [XRInputSource] + /// property **`targetRayMode`** indicates the method by which the + /// target ray for the input source should be generated and how it should be + /// presented to + /// the user. + /// + /// Typically a target ray is drawn from the source of the targeting system + /// along the target ray in the direction in which the user is looking or + /// pointing. The style of the ray is generally up to you, as is the method + /// for indicating the endpoint of the ray. The targeted point or object might + /// be indicated by drawing a shape or highlighting the targeted surface or + /// object. + /// + /// A target ray emitted by a hand controller: + /// + /// ![A screenshot showing a target ray being emitted by a hand controller](example-target-ray.gif) + /// + /// The target ray can be anything from a simple line (ideally fading over + /// distance) to an animated effect, such as the science-fiction "phaser" + /// style shown in the screenshot above. + external XRTargetRayMode get targetRayMode; + + /// The read-only [XRInputSource] property + /// **`targetRaySpace`** returns an [XRSpace] + /// (typically an [XRReferenceSpace]) representing the position and + /// orientation of the target ray in the virtual space. Its native origin + /// tracks + /// the position of the origin point of the target ray, and its orientation + /// indicates the + /// orientation of the controller device itself. These values, interpreted in + /// the context of + /// the input source's [XRInputSource.targetRayMode], can be + /// used both to fully interpret the device as an input source. + /// + /// To obtain an `XRSpace` representing the input controller's position and + /// orientation in virtual space, use the [XRInputSource.gripSpace] property. + external XRSpace get targetRaySpace; + + /// The read-only [XRInputSource] property **`gripSpace`** returns an + /// [XRSpace] whose native origin tracks the pose used to render virtual + /// objects so they appear to be held in (or part of) the user's hand. For + /// example, if a user were holding a virtual straight rod, the native origin + /// of this `XRSpace` would be located at the approximate center of mass of + /// the user's fist. + external XRSpace? get gripSpace; + + /// The read-only [XRInputSource] property **`profiles`** returns an array of + /// strings, each describing a configuration profile for the input source. The + /// profile strings are listed in order of specificity, with the most specific + /// profile listed first. + /// + /// > **Note:** The `profiles` list is always empty when the WebXR + /// > session is in inline mode. + external JSArray get profiles; +} + +/// The +/// [WebXR Device API](https://developer.mozilla.org/en-US/docs/Web/API/WebXR_Device_API)'s +/// **`XRSessionEvent`** interface describes an event which indicates the change +/// of the state of an [XRSession]. These events occur, for example, when the +/// session ends or the visibility of its context changes. +/// +/// --- +/// +/// API documentation sourced from +/// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/XRSessionEvent). +extension type XRSessionEvent._(JSObject _) implements Event, JSObject { + external factory XRSessionEvent( + String type, + XRSessionEventInit eventInitDict, + ); + + /// The read-only [XRSessionEvent] interface's + /// **`session`** property indicates which + /// [XRSession] the event is about. + external JSObject get session; +} +extension type XRSessionEventInit._(JSObject _) implements EventInit, JSObject { + external factory XRSessionEventInit({ + bool bubbles, + bool cancelable, + bool composed, + required JSObject session, + }); + + external JSObject get session; + external set session(JSObject value); +} + +/// The +/// [WebXR Device API](https://developer.mozilla.org/en-US/docs/Web/API/WebXR_Device_API)'s +/// **`XRInputSourceEvent`** interface describes an event which has occurred on +/// a WebXR user input device such as a hand controller, gaze tracking system, +/// or motion tracking system. More specifically, they represent a change in the +/// state of an [XRInputSource]. +/// +/// To learn more about handling inputs in a WebXR project, see the article +/// [Inputs and input sources](https://developer.mozilla.org/en-US/docs/Web/API/WebXR_Device_API/Inputs). +/// +/// --- +/// +/// API documentation sourced from +/// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/XRInputSourceEvent). +extension type XRInputSourceEvent._(JSObject _) implements Event, JSObject { + external factory XRInputSourceEvent( + String type, + XRInputSourceEventInit eventInitDict, + ); + + /// The read-only [XRInputSourceEvent] property + /// **`frame`** specifies an [XRFrame] object + /// representing the event frame during which a + /// [WebXR](https://developer.mozilla.org/en-US/docs/Web/API/WebXR_Device_API) + /// user input occurred. + /// This may thus be an event which occurred in the past rather than a current + /// or impending + /// event. + external JSObject get frame; + + /// The [XRInputSourceEvent] interface's read-only + /// **`inputSource`** property specifies the + /// [XRInputSource] which generated the input event. This information + /// lets you handle the event appropriately given the particulars of the user + /// input device + /// being manipulated. + external XRInputSource get inputSource; +} +extension type XRInputSourceEventInit._(JSObject _) + implements EventInit, JSObject { + external factory XRInputSourceEventInit({ + bool bubbles, + bool cancelable, + bool composed, + required JSObject frame, + required XRInputSource inputSource, + }); + + external JSObject get frame; + external set frame(JSObject value); + external XRInputSource get inputSource; + external set inputSource(XRInputSource value); +} + +/// The WebXR Device API interface **`XRInputSourcesChangeEvent`** is used to +/// represent the [XRSession.inputsourceschange_event] event sent to an +/// [XRSession] when the set of available WebXR input controllers changes. +/// +/// --- +/// +/// API documentation sourced from +/// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/XRInputSourcesChangeEvent). +extension type XRInputSourcesChangeEvent._(JSObject _) + implements Event, JSObject { + external factory XRInputSourcesChangeEvent( + String type, + XRInputSourcesChangeEventInit eventInitDict, + ); + + /// The [XRInputSourcesChangeEvent] property + /// [XRInputSourcesChangeEvent.session] specifies the + /// [XRSession] to which the input source list change event applies. + external JSObject get session; + + /// The read-only [XRInputSourcesChangeEvent] + /// property [XRInputSourcesChangeEvent.added] is a list of zero or + /// more input sources, each identified using an [XRInputSource] object, + /// which have been newly made available for use. + external JSArray get added; + + /// The read-only [XRInputSourcesChangeEvent] property + /// [XRInputSourcesChangeEvent.removed] is an array of + /// zero or more [XRInputSource] objects representing the input sources that + /// have been removed from the [XRSession]. + external JSArray get removed; +} +extension type XRInputSourcesChangeEventInit._(JSObject _) + implements EventInit, JSObject { + external factory XRInputSourcesChangeEventInit({ + bool bubbles, + bool cancelable, + bool composed, + required JSObject session, + required JSArray added, + required JSArray removed, + }); + + external JSObject get session; + external set session(JSObject value); + external JSArray get added; + external set added(JSArray value); + external JSArray get removed; + external set removed(JSArray value); +} + +/// The +/// [WebXR Device API](https://developer.mozilla.org/en-US/docs/Web/API/WebXR_Device_API) +/// interface **`XRReferenceSpaceEvent`** represents an event sent to an +/// [XRReferenceSpace]. Currently, the only event that uses this type is the +/// [XRReferenceSpace.reset_event] event. +/// +/// --- +/// +/// API documentation sourced from +/// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/XRReferenceSpaceEvent). +extension type XRReferenceSpaceEvent._(JSObject _) implements Event, JSObject { + external factory XRReferenceSpaceEvent( + String type, + XRReferenceSpaceEventInit eventInitDict, + ); + + /// The read-only [XRReferenceSpaceEvent] property + /// **`referenceSpace`** specifies the reference space which is the + /// originator of the event. + external XRReferenceSpace get referenceSpace; + + /// The read-only [XRReferenceSpaceEvent] property + /// **`transform`** indicates the position and orientation of the + /// affected [XRReferenceSpaceEvent.referenceSpace]'s + /// native origin after the changes the event represents are applied. The + /// `transform` is defined using the old coordinate system, which allows it to + /// be + /// used to convert coordinates from the pre-event coordinate system to the + /// post-event + /// coordinate system. + external XRRigidTransform? get transform; +} +extension type XRReferenceSpaceEventInit._(JSObject _) + implements EventInit, JSObject { + external factory XRReferenceSpaceEventInit({ + bool bubbles, + bool cancelable, + bool composed, + required XRReferenceSpace referenceSpace, + XRRigidTransform? transform, + }); + + external XRReferenceSpace get referenceSpace; + external set referenceSpace(XRReferenceSpace value); + external XRRigidTransform? get transform; + external set transform(XRRigidTransform? value); +} diff --git a/lib/src/dom/webxr_hand_input.dart b/lib/src/dom/webxr_hand_input.dart new file mode 100644 index 00000000..07267040 --- /dev/null +++ b/lib/src/dom/webxr_hand_input.dart @@ -0,0 +1,55 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. +// +// API docs from [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web). +// Attributions and copyright licensing by Mozilla Contributors is licensed +// under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/. + +// Generated from Web IDL definitions. + +@JS() +library; + +import 'dart:js_interop'; + +import 'webxr.dart'; + +typedef XRHandJoint = String; + +/// The **`XRHand`** interface is pair iterator (an ordered map) with the key +/// being the hand joints and the value being an [XRJointSpace]. +/// +/// `XRHand` is returned by [XRInputSource.hand]. +/// +/// --- +/// +/// API documentation sourced from +/// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/XRHand). +extension type XRHand._(JSObject _) implements JSObject {} + +/// The **`XRJointSpace`** interface is an [XRSpace] and represents the position +/// and orientation of an [XRHand] joint. +/// +/// --- +/// +/// API documentation sourced from +/// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/XRJointSpace). +extension type XRJointSpace._(JSObject _) implements XRSpace, JSObject { + /// The read-only **`jointName`** property of the [XRJointSpace] interface + /// contains the name of the joint it tracks. + external XRHandJoint get jointName; +} + +/// The **`XRJointPose`** interface is an [XRPose] with additional information +/// about the size of the skeleton joint it represents. +/// +/// --- +/// +/// API documentation sourced from +/// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/XRJointPose). +extension type XRJointPose._(JSObject _) implements XRPose, JSObject { + /// The read-only **`radius`** property of the [XRJointPose] interface + /// indicates the radius (distance from skin) for a joint. + external num get radius; +}