Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
e1645b15
Unverified
Commit
e1645b15
authored
Feb 12, 2024
by
Kevin Moore
Committed by
GitHub
Feb 12, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[web] Move JS interop to extension types (#143274)
Now that we can bump the min SDK to latest.
parent
52f923c3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
89 deletions
+23
-89
web.dart
packages/flutter/lib/src/web.dart
+22
-88
pubspec.yaml
packages/flutter/pubspec.yaml
+1
-1
No files found.
packages/flutter/lib/src/web.dart
View file @
e1645b15
...
@@ -33,11 +33,7 @@ external Document get document;
...
@@ -33,11 +33,7 @@ external Document get document;
@JS
()
@JS
()
external
Window
get
window
;
external
Window
get
window
;
@JS
(
'CSSStyleDeclaration'
)
extension
type
CSSStyleDeclaration
.
_
(
JSObject
_
)
implements
JSObject
{
@staticInterop
class
CSSStyleDeclaration
{}
extension
CSSStyleDeclarationExtension
on
CSSStyleDeclaration
{
external
set
backgroundColor
(
String
value
);
external
set
backgroundColor
(
String
value
);
external
String
get
backgroundColor
;
external
String
get
backgroundColor
;
external
set
border
(
String
value
);
external
set
border
(
String
value
);
...
@@ -48,22 +44,14 @@ extension CSSStyleDeclarationExtension on CSSStyleDeclaration {
...
@@ -48,22 +44,14 @@ extension CSSStyleDeclarationExtension on CSSStyleDeclaration {
external
String
get
width
;
external
String
get
width
;
}
}
@JS
(
'CSSStyleSheet'
)
extension
type
CSSStyleSheet
.
_
(
JSObject
_
)
implements
JSObject
{
@staticInterop
class
CSSStyleSheet
{}
extension
CSSStyleSheetExtension
on
CSSStyleSheet
{
external
int
insertRule
(
external
int
insertRule
(
String
rule
,
[
String
rule
,
[
int
index
,
int
index
,
]);
]);
}
}
@JS
(
'Document'
)
extension
type
Document
.
_
(
JSObject
_
)
implements
JSObject
{
@staticInterop
class
Document
implements
Node
{}
extension
DocumentExtension
on
Document
{
external
Element
createElement
(
external
Element
createElement
(
String
localName
,
[
String
localName
,
[
JSAny
options
,
JSAny
options
,
...
@@ -72,32 +60,18 @@ extension DocumentExtension on Document {
...
@@ -72,32 +60,18 @@ extension DocumentExtension on Document {
external
HTMLHeadElement
?
get
head
;
external
HTMLHeadElement
?
get
head
;
}
}
@JS
(
'DOMTokenList'
)
extension
type
DOMTokenList
.
_
(
JSObject
_
)
implements
JSObject
{
@staticInterop
class
DOMTokenList
{}
extension
DOMTokenListExtension
on
DOMTokenList
{
external
void
add
(
String
tokens
);
external
void
add
(
String
tokens
);
}
}
@JS
(
'Element'
)
extension
type
Element
.
_
(
JSObject
_
)
implements
Node
,
JSObject
{
@staticInterop
class
Element
implements
Node
{}
extension
ElementExtension
on
Element
{
external
DOMTokenList
get
classList
;
external
DOMTokenList
get
classList
;
external
void
append
(
JSAny
nodes
);
external
void
append
(
JSAny
nodes
);
}
}
@JS
(
'Event'
)
extension
type
Event
.
_
(
JSObject
_
)
implements
JSObject
{}
@staticInterop
class
Event
{}
@JS
(
'EventTarget'
)
@staticInterop
class
EventTarget
{}
extension
EventTargetExtension
on
EventTarge
t
{
extension
type
EventTarget
.
_
(
JSObject
_
)
implements
JSObjec
t
{
external
void
addEventListener
(
external
void
addEventListener
(
String
type
,
String
type
,
EventListener
?
callback
,
[
EventListener
?
callback
,
[
...
@@ -105,91 +79,52 @@ extension EventTargetExtension on EventTarget {
...
@@ -105,91 +79,52 @@ extension EventTargetExtension on EventTarget {
]);
]);
}
}
@JS
(
'HTMLElement'
)
extension
type
HTMLElement
.
_
(
JSObject
_
)
implements
Element
,
JSObject
{
@staticInterop
external
String
get
innerText
;
class
HTMLElement
implements
Element
{}
extension
HTMLElementExtension
on
HTMLElement
{
external
set
innerText
(
String
value
);
external
set
innerText
(
String
value
);
external
CSSStyleDeclaration
get
style
;
external
CSSStyleDeclaration
get
style
;
}
}
@JS
(
'HTMLHeadElement'
)
extension
type
HTMLHeadElement
.
_
(
JSObject
_
)
implements
HTMLElement
,
JSObject
{}
@staticInterop
class
HTMLHeadElement
implements
HTMLElement
{}
@JS
(
'HTMLStyleElement'
)
@staticInterop
class
HTMLStyleElement
implements
HTMLElement
{}
extension
HTMLStyleElementExtension
on
HTMLStyleElemen
t
{
extension
type
HTMLStyleElement
.
_
(
JSObject
_
)
implements
HTMLElement
,
JSObjec
t
{
external
CSSStyleSheet
?
get
sheet
;
external
CSSStyleSheet
?
get
sheet
;
}
}
@JS
(
'MediaQueryList'
)
extension
type
MediaQueryList
.
_
(
JSObject
_
)
implements
EventTarget
,
JSObject
{
@staticInterop
class
MediaQueryList
{}
extension
MediaQueryListExtension
on
MediaQueryList
{
external
bool
get
matches
;
external
bool
get
matches
;
}
}
@JS
(
'MouseEvent'
)
extension
type
MouseEvent
.
_
(
JSObject
_
)
implements
JSObject
{
@staticInterop
class
MouseEvent
{}
extension
MouseEventExtension
on
MouseEvent
{
external
num
get
offsetX
;
external
num
get
offsetX
;
external
num
get
offsetY
;
external
num
get
offsetY
;
external
int
get
button
;
external
int
get
button
;
}
}
@JS
(
'Navigator'
)
extension
type
Navigator
.
_
(
JSObject
_
)
implements
JSObject
{
@staticInterop
class
Navigator
{}
extension
NavigatorExtension
on
Navigator
{
external
String
get
platform
;
external
String
get
platform
;
}
}
@JS
(
'Node'
)
extension
type
Node
.
_
(
JSObject
_
)
implements
EventTarget
,
JSObject
{}
@staticInterop
class
Node
implements
EventTarget
{}
@JS
(
'Range'
)
@staticInterop
class
Range
{}
extension
RangeExtension
on
Range
{
extension
type
Range
.
_
(
JSObject
_
)
implements
JSObject
{
external
void
selectNode
(
Node
node
);
external
void
selectNode
(
Node
node
);
}
}
@JS
(
'Selection'
)
extension
type
Selection
.
_
(
JSObject
_
)
implements
JSObject
{
@staticInterop
class
Selection
{}
extension
SelectionExtension
on
Selection
{
external
void
addRange
(
Range
range
);
external
void
addRange
(
Range
range
);
external
void
removeAllRanges
();
external
void
removeAllRanges
();
}
}
@JS
(
'Window'
)
extension
type
Window
.
_
(
JSObject
_
)
implements
EventTarget
,
JSObject
{
@staticInterop
class
Window
{}
extension
WindowExtension
on
Window
{
external
Navigator
get
navigator
;
external
Navigator
get
navigator
;
external
MediaQueryList
matchMedia
(
String
query
);
external
MediaQueryList
matchMedia
(
String
query
);
external
Selection
?
getSelection
();
external
Selection
?
getSelection
();
}
}
@JS
(
'XMLHttpRequest'
)
extension
type
XMLHttpRequest
.
_
(
JSObject
_
)
@staticInterop
implements
XMLHttpRequestEventTarget
,
JSObject
{
class
XMLHttpRequest
implements
XMLHttpRequestEventTarget
{
external
factory
XMLHttpRequest
();
external
factory
XMLHttpRequest
();
}
extension
XMLHttpRequestExtension
on
XMLHttpRequest
{
external
void
open
(
external
void
open
(
String
method
,
String
method
,
String
url
,
[
String
url
,
[
...
@@ -208,6 +143,5 @@ extension XMLHttpRequestExtension on XMLHttpRequest {
...
@@ -208,6 +143,5 @@ extension XMLHttpRequestExtension on XMLHttpRequest {
external
JSAny
?
get
response
;
external
JSAny
?
get
response
;
}
}
@JS
(
'XMLHttpRequestEventTarget'
)
extension
type
XMLHttpRequestEventTarget
.
_
(
JSObject
_
)
@staticInterop
implements
EventTarget
,
JSObject
{}
class
XMLHttpRequestEventTarget
implements
EventTarget
{}
packages/flutter/pubspec.yaml
View file @
e1645b15
...
@@ -3,7 +3,7 @@ description: A framework for writing Flutter applications
...
@@ -3,7 +3,7 @@ description: A framework for writing Flutter applications
homepage
:
https://flutter.dev
homepage
:
https://flutter.dev
environment
:
environment
:
sdk
:
'
>=3.
2
.0-0
<4.0.0'
sdk
:
'
>=3.
3
.0-0
<4.0.0'
dependencies
:
dependencies
:
# To update these, use "flutter update-packages --force-upgrade".
# To update these, use "flutter update-packages --force-upgrade".
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment