Skip to content

Commit 2ae509e

Browse files
authored
Update doc comments, bump version to 1.0.0-wip (#268)
1 parent 72a806f commit 2ae509e

25 files changed

+783
-446
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## 0.6.0-wip
1+
## 1.0.0-wip
22

33
- Added supertypes' fields to dictionary constructors as dictionaries are
44
allowed to contain those fields.

lib/src/dom/clipboard_apis.dart

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,15 @@ extension type ClipboardItem._(JSObject _) implements JSObject {
8383
ClipboardItemOptions options,
8484
]);
8585

86+
/// The **`supports()`** static method of the [ClipboardItem] interface
87+
/// returns `true` if the given is supported by the clipboard, and `false`
88+
/// otherwise.
89+
///
90+
/// Note that the
91+
/// [Clipboard API](https://developer.mozilla.org/en-US/docs/Web/API/Clipboard_API)
92+
/// mandates support for plain text, HTML and PNG files.
93+
/// The `supports()` method will always return `true` for these MIME types, so
94+
/// testing them is unnecessary .
8695
external static bool supports(String type);
8796

8897
/// The **`getType()`** method of the [ClipboardItem] interface returns a

lib/src/dom/css_conditional.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import 'cssom.dart';
2929
/// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/CSSConditionRule).
3030
extension type CSSConditionRule._(JSObject _)
3131
implements CSSGroupingRule, JSObject {
32-
/// The **`conditionText`** property of
32+
/// The read-only **`conditionText`** property of
3333
/// the [CSSConditionRule] interface returns or sets the text of the CSS
3434
/// rule.
3535
external String get conditionText;

lib/src/dom/css_view_transitions.dart

Lines changed: 32 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,22 @@ import 'dart:js_interop';
1616
typedef UpdateCallback = JSFunction;
1717

1818
/// The **`ViewTransition`** interface of the [View Transitions API] represents
19-
/// a view transition, and provides functionality to react to the transition
20-
/// reaching different states (e.g. ready to run the animation, or animation
21-
/// finished) or skip the transition altogether.
19+
/// an active view transition, and provides functionality to react to the
20+
/// transition reaching different states (e.g. ready to run the animation, or
21+
/// animation finished) or skip the transition altogether.
2222
///
23-
/// This object type is returned by the [Document.startViewTransition] method.
24-
/// When `startViewTransition()` is invoked, a sequence of steps is followed as
25-
/// explained in
26-
/// [The view transition process](https://developer.mozilla.org/en-US/docs/Web/API/View_Transitions_API#the_view_transition_process).
23+
/// This object type is made available in the following ways:
24+
///
25+
/// - In the case of same-document (SPA) transitions, it is returned by the
26+
/// [Document.startViewTransition] method.
27+
/// - In the case of cross-document (MPA) transitions, it is made available:
28+
/// - In the outgoing page via the [Window.pageswap_event] event object's [PageSwapEvent.viewTransition] property.
29+
/// - In the inbound page via the [Window.pagereveal_event] event object's [PageRevealEvent.viewTransition] property.
30+
///
31+
/// When a view transition is triggered by a `startViewTransition()` call (or a
32+
/// page navigation in the case of MPA transitions), a sequence of steps is
33+
/// followed as explained in
34+
/// [The view transition process](https://developer.mozilla.org/en-US/docs/Web/API/View_Transitions_API/Using#the_view_transition_process).
2735
/// This also explains when the different promises fulfill.
2836
///
2937
/// ---
@@ -33,18 +41,21 @@ typedef UpdateCallback = JSFunction;
3341
extension type ViewTransition._(JSObject _) implements JSObject {
3442
/// The **`skipTransition()`** method of the
3543
/// [ViewTransition] interface skips the animation part of the view
36-
/// transition, but doesn't skip running the [Document.startViewTransition]
37-
/// callback that updates the DOM.
44+
/// transition, but doesn't skip running the associated view update.
3845
external void skipTransition();
3946

4047
/// The **`updateCallbackDone`** read-only property of the
4148
/// [ViewTransition] interface is a `Promise` that fulfills when the promise
42-
/// returned by the [Document.startViewTransition]'s callback fulfills, or
43-
/// rejects when it rejects.
49+
/// returned by the [Document.startViewTransition] method's callback fulfills,
50+
/// or rejects when it rejects.
4451
///
4552
/// `updateCallbackDone` is useful when you don't care about the
46-
/// success/failure of the transition animation, and just want to know if and
47-
/// when the DOM is updated.
53+
/// success/failure of a same-document (SPA) view transition animation, and
54+
/// just want to know if and when the DOM is updated.
55+
///
56+
/// > **Note:** In the case of a cross-document (MPA) view transition, the
57+
/// > `updateCallbackDone` promise of the associated `ViewTransition` is
58+
/// > automatically fulfilled.
4859
external JSPromise<JSAny?> get updateCallbackDone;
4960

5061
/// The **`ready`** read-only property of the
@@ -53,7 +64,7 @@ extension type ViewTransition._(JSObject _) implements JSObject {
5364
/// start.
5465
///
5566
/// `ready` will reject if the transition cannot begin. This can be due to
56-
/// misconfiguration, for example duplicate s, or if the callback passed to
67+
/// misconfiguration, for example, duplicate s, or if the callback passed to
5768
/// [Document.startViewTransition] throws or returns a promise that rejects.
5869
external JSPromise<JSAny?> get ready;
5970

@@ -62,12 +73,13 @@ extension type ViewTransition._(JSObject _) implements JSObject {
6273
/// transition animation is finished, and the new page view is visible and
6374
/// interactive to the user.
6475
///
65-
/// `finished` only rejects if the callback passed to
66-
/// [Document.startViewTransition]throws or returns a promise that rejects,
67-
/// which indicates that the new state of the page wasn't created.
76+
/// `finished` will only reject in the case of a same-document (SPA)
77+
/// transition, if the callback passed to [Document.startViewTransition]
78+
/// throws or returns a promise that rejects. This would indicate that the new
79+
/// state of the page wasn't created.
6880
///
69-
/// If a transition animation fails to start, or is skipped during the
70-
/// animation using [ViewTransition.skipTransition], the end state is still
71-
/// reached therefore `finished` still fulfills.
81+
/// If a transition animation fails to start or is skipped during the
82+
/// transition using [ViewTransition.skipTransition], the end state is still
83+
/// reached therefore `finished` will still fulfill.
7284
external JSPromise<JSAny?> get finished;
7385
}

lib/src/dom/cssom.dart

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -296,16 +296,19 @@ extension type StyleSheetList._(JSObject _) implements JSObject {
296296
/// [CSSStyleSheet.insertRule] and [CSSStyleSheet.deleteRule], which are methods
297297
/// of [CSSStyleSheet].
298298
///
299-
/// The interface has no constructor. An instance of `CSSRuleList` is returned
300-
/// by [CSSStyleSheet.cssRules] and [CSSKeyframesRule.cssRules].
299+
/// This interface was an
300+
/// [attempt to create an unmodifiable list](https://stackoverflow.com/questions/74630989/why-use-domstringlist-rather-than-an-array/74641156#74641156)
301+
/// and only continues to be supported to not break code that's already using
302+
/// it. Modern APIs represent list structures using types based on JavaScript
303+
/// [arrays](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array),
304+
/// thus making many array methods available, and at the same time imposing
305+
/// additional semantics on their usage (such as making their items read-only).
301306
///
302-
/// > **Note:** This interface was an
303-
/// > [attempt to create an unmodifiable list](https://stackoverflow.com/questions/74630989/why-use-domstringlist-rather-than-an-array/74641156#74641156)
304-
/// > and only continues to be supported to not break code that's already using
305-
/// > it. Modern APIs use types that wrap around ECMAScript array types instead,
306-
/// > so you can treat them like ECMAScript arrays, and at the same time impose
307-
/// > additional semantics on their usage (such as making their items
308-
/// > read-only).
307+
/// These historical reasons do not mean that you as a developer should avoid
308+
/// `CSSRuleList`. You don't create `CSSRuleList` objects yourself, but you get
309+
/// them from APIs such as [CSSStyleSheet.cssRules] and
310+
/// [CSSKeyframesRule.cssRules], and these APIs are not deprecated. However, be
311+
/// careful of the semantic differences from a real array.
309312
///
310313
/// ---
311314
///

0 commit comments

Comments
 (0)