Skip to content

Commit

Permalink
Change parameter double types to num
Browse files Browse the repository at this point in the history
Closes dart-lang#57

Makes it easier to migrate off of dart:html APIs and allows users
to pass integers without having to convert to doubles.
  • Loading branch information
srujzs committed Sep 26, 2023
1 parent 819f8b4 commit 1dd5839
Show file tree
Hide file tree
Showing 58 changed files with 1,127 additions and 1,110 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.2.2-wip

- Parameters that were typed `double` are now typed as `num`.

## 0.2.1-beta

- `helpers.dart`
Expand Down
12 changes: 6 additions & 6 deletions lib/src/dom/accelerometer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -51,18 +51,18 @@ class GravitySensor implements Accelerometer {
@anonymous
class AccelerometerReadingValues implements JSObject {
external factory AccelerometerReadingValues({
required double? x,
required double? y,
required double? z,
required num? x,
required num? y,
required num? z,
});
}

extension AccelerometerReadingValuesExtension on AccelerometerReadingValues {
external set x(double? value);
external set x(num? value);
external double? get x;
external set y(double? value);
external set y(num? value);
external double? get y;
external set z(double? value);
external set z(num? value);
external double? get z;
}

Expand Down
4 changes: 2 additions & 2 deletions lib/src/dom/ambient_light.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ extension AmbientLightSensorExtension on AmbientLightSensor {
@staticInterop
@anonymous
class AmbientLightReadingValues implements JSObject {
external factory AmbientLightReadingValues({required double? illuminance});
external factory AmbientLightReadingValues({required num? illuminance});
}

extension AmbientLightReadingValuesExtension on AmbientLightReadingValues {
external set illuminance(double? value);
external set illuminance(num? value);
external double? get illuminance;
}
4 changes: 2 additions & 2 deletions lib/src/dom/compute_pressure.dart
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ extension PressureRecordExtension on PressureRecord {
@staticInterop
@anonymous
class PressureObserverOptions implements JSObject {
external factory PressureObserverOptions({double sampleRate});
external factory PressureObserverOptions({num sampleRate});
}

extension PressureObserverOptionsExtension on PressureObserverOptions {
external set sampleRate(double value);
external set sampleRate(num value);
external double get sampleRate;
}
2 changes: 1 addition & 1 deletion lib/src/dom/css_animation_worklet.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class WorkletAnimationEffect implements JSObject {}
extension WorkletAnimationEffectExtension on WorkletAnimationEffect {
external EffectTiming getTiming();
external ComputedEffectTiming getComputedTiming();
external set localTime(double? value);
external set localTime(num? value);
external double? get localTime;
}

Expand Down
4 changes: 2 additions & 2 deletions lib/src/dom/css_animations.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ extension AnimationEventExtension on AnimationEvent {
class AnimationEventInit implements EventInit {
external factory AnimationEventInit({
String animationName,
double elapsedTime,
num elapsedTime,
String pseudoElement,
});
}

extension AnimationEventInitExtension on AnimationEventInit {
external set animationName(String value);
external String get animationName;
external set elapsedTime(double value);
external set elapsedTime(num value);
external double get elapsedTime;
external set pseudoElement(String value);
external String get pseudoElement;
Expand Down
52 changes: 26 additions & 26 deletions lib/src/dom/css_layout_api.dart
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ class LayoutFragment implements JSObject {}
extension LayoutFragmentExtension on LayoutFragment {
external double get inlineSize;
external double get blockSize;
external set inlineOffset(double value);
external set inlineOffset(num value);
external double get inlineOffset;
external set blockOffset(double value);
external set blockOffset(num value);
external double get blockOffset;
external JSAny? get data;
external ChildBreakToken? get breakToken;
Expand Down Expand Up @@ -99,32 +99,32 @@ extension LayoutConstraintsExtension on LayoutConstraints {
@anonymous
class LayoutConstraintsOptions implements JSObject {
external factory LayoutConstraintsOptions({
double availableInlineSize,
double availableBlockSize,
double fixedInlineSize,
double fixedBlockSize,
double percentageInlineSize,
double percentageBlockSize,
double blockFragmentationOffset,
num availableInlineSize,
num availableBlockSize,
num fixedInlineSize,
num fixedBlockSize,
num percentageInlineSize,
num percentageBlockSize,
num blockFragmentationOffset,
BlockFragmentationType blockFragmentationType,
JSAny? data,
});
}

extension LayoutConstraintsOptionsExtension on LayoutConstraintsOptions {
external set availableInlineSize(double value);
external set availableInlineSize(num value);
external double get availableInlineSize;
external set availableBlockSize(double value);
external set availableBlockSize(num value);
external double get availableBlockSize;
external set fixedInlineSize(double value);
external set fixedInlineSize(num value);
external double get fixedInlineSize;
external set fixedBlockSize(double value);
external set fixedBlockSize(num value);
external double get fixedBlockSize;
external set percentageInlineSize(double value);
external set percentageInlineSize(num value);
external double get percentageInlineSize;
external set percentageBlockSize(double value);
external set percentageBlockSize(num value);
external double get percentageBlockSize;
external set blockFragmentationOffset(double value);
external set blockFragmentationOffset(num value);
external double get blockFragmentationOffset;
external set blockFragmentationType(BlockFragmentationType value);
external BlockFragmentationType get blockFragmentationType;
Expand Down Expand Up @@ -185,21 +185,21 @@ extension LayoutEdgesExtension on LayoutEdges {
@anonymous
class FragmentResultOptions implements JSObject {
external factory FragmentResultOptions({
double inlineSize,
double blockSize,
double autoBlockSize,
num inlineSize,
num blockSize,
num autoBlockSize,
JSArray childFragments,
JSAny? data,
BreakTokenOptions breakToken,
});
}

extension FragmentResultOptionsExtension on FragmentResultOptions {
external set inlineSize(double value);
external set inlineSize(num value);
external double get inlineSize;
external set blockSize(double value);
external set blockSize(num value);
external double get blockSize;
external set autoBlockSize(double value);
external set autoBlockSize(num value);
external double get autoBlockSize;
external set childFragments(JSArray value);
external JSArray get childFragments;
Expand All @@ -225,14 +225,14 @@ extension FragmentResultExtension on FragmentResult {
@anonymous
class IntrinsicSizesResultOptions implements JSObject {
external factory IntrinsicSizesResultOptions({
double maxContentSize,
double minContentSize,
num maxContentSize,
num minContentSize,
});
}

extension IntrinsicSizesResultOptionsExtension on IntrinsicSizesResultOptions {
external set maxContentSize(double value);
external set maxContentSize(num value);
external double get maxContentSize;
external set minContentSize(double value);
external set minContentSize(num value);
external double get minContentSize;
}
4 changes: 2 additions & 2 deletions lib/src/dom/css_transitions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ extension TransitionEventExtension on TransitionEvent {
class TransitionEventInit implements EventInit {
external factory TransitionEventInit({
String propertyName,
double elapsedTime,
num elapsedTime,
String pseudoElement,
});
}

extension TransitionEventInitExtension on TransitionEventInit {
external set propertyName(String value);
external String get propertyName;
external set elapsedTime(double value);
external set elapsedTime(num value);
external double get elapsedTime;
external set pseudoElement(String value);
external String get pseudoElement;
Expand Down
4 changes: 2 additions & 2 deletions lib/src/dom/css_typed_om.dart
Original file line number Diff line number Diff line change
Expand Up @@ -152,13 +152,13 @@ extension CSSNumericValueExtension on CSSNumericValue {
@staticInterop
class CSSUnitValue implements CSSNumericValue {
external factory CSSUnitValue(
double value,
num value,
String unit,
);
}

extension CSSUnitValueExtension on CSSUnitValue {
external set value(double value);
external set value(num value);
external double get value;
external String get unit;
}
Expand Down
126 changes: 63 additions & 63 deletions lib/src/dom/cssom.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1522,70 +1522,70 @@ extension $CSSExtension on $CSS {
external JSArray parseValueList(String css);
external JSArray parseCommaValueList(String css);
external JSVoid registerProperty(PropertyDefinition definition);
external CSSUnitValue number(double value);
external CSSUnitValue percent(double value);
external CSSUnitValue cap(double value);
external CSSUnitValue ch(double value);
external CSSUnitValue em(double value);
external CSSUnitValue ex(double value);
external CSSUnitValue ic(double value);
external CSSUnitValue lh(double value);
external CSSUnitValue rcap(double value);
external CSSUnitValue rch(double value);
external CSSUnitValue rem(double value);
external CSSUnitValue rex(double value);
external CSSUnitValue ric(double value);
external CSSUnitValue rlh(double value);
external CSSUnitValue vw(double value);
external CSSUnitValue vh(double value);
external CSSUnitValue vi(double value);
external CSSUnitValue vb(double value);
external CSSUnitValue vmin(double value);
external CSSUnitValue vmax(double value);
external CSSUnitValue svw(double value);
external CSSUnitValue svh(double value);
external CSSUnitValue svi(double value);
external CSSUnitValue svb(double value);
external CSSUnitValue svmin(double value);
external CSSUnitValue svmax(double value);
external CSSUnitValue lvw(double value);
external CSSUnitValue lvh(double value);
external CSSUnitValue lvi(double value);
external CSSUnitValue lvb(double value);
external CSSUnitValue lvmin(double value);
external CSSUnitValue lvmax(double value);
external CSSUnitValue dvw(double value);
external CSSUnitValue dvh(double value);
external CSSUnitValue dvi(double value);
external CSSUnitValue dvb(double value);
external CSSUnitValue dvmin(double value);
external CSSUnitValue dvmax(double value);
external CSSUnitValue cqw(double value);
external CSSUnitValue cqh(double value);
external CSSUnitValue cqi(double value);
external CSSUnitValue cqb(double value);
external CSSUnitValue cqmin(double value);
external CSSUnitValue cqmax(double value);
external CSSUnitValue cm(double value);
external CSSUnitValue mm(double value);
external CSSUnitValue Q(double value);
external CSSUnitValue number(num value);
external CSSUnitValue percent(num value);
external CSSUnitValue cap(num value);
external CSSUnitValue ch(num value);
external CSSUnitValue em(num value);
external CSSUnitValue ex(num value);
external CSSUnitValue ic(num value);
external CSSUnitValue lh(num value);
external CSSUnitValue rcap(num value);
external CSSUnitValue rch(num value);
external CSSUnitValue rem(num value);
external CSSUnitValue rex(num value);
external CSSUnitValue ric(num value);
external CSSUnitValue rlh(num value);
external CSSUnitValue vw(num value);
external CSSUnitValue vh(num value);
external CSSUnitValue vi(num value);
external CSSUnitValue vb(num value);
external CSSUnitValue vmin(num value);
external CSSUnitValue vmax(num value);
external CSSUnitValue svw(num value);
external CSSUnitValue svh(num value);
external CSSUnitValue svi(num value);
external CSSUnitValue svb(num value);
external CSSUnitValue svmin(num value);
external CSSUnitValue svmax(num value);
external CSSUnitValue lvw(num value);
external CSSUnitValue lvh(num value);
external CSSUnitValue lvi(num value);
external CSSUnitValue lvb(num value);
external CSSUnitValue lvmin(num value);
external CSSUnitValue lvmax(num value);
external CSSUnitValue dvw(num value);
external CSSUnitValue dvh(num value);
external CSSUnitValue dvi(num value);
external CSSUnitValue dvb(num value);
external CSSUnitValue dvmin(num value);
external CSSUnitValue dvmax(num value);
external CSSUnitValue cqw(num value);
external CSSUnitValue cqh(num value);
external CSSUnitValue cqi(num value);
external CSSUnitValue cqb(num value);
external CSSUnitValue cqmin(num value);
external CSSUnitValue cqmax(num value);
external CSSUnitValue cm(num value);
external CSSUnitValue mm(num value);
external CSSUnitValue Q(num value);
@JS('in')
external CSSUnitValue in_(double value);
external CSSUnitValue pt(double value);
external CSSUnitValue pc(double value);
external CSSUnitValue px(double value);
external CSSUnitValue deg(double value);
external CSSUnitValue grad(double value);
external CSSUnitValue rad(double value);
external CSSUnitValue turn(double value);
external CSSUnitValue s(double value);
external CSSUnitValue ms(double value);
external CSSUnitValue Hz(double value);
external CSSUnitValue kHz(double value);
external CSSUnitValue dpi(double value);
external CSSUnitValue dpcm(double value);
external CSSUnitValue dppx(double value);
external CSSUnitValue fr(double value);
external CSSUnitValue in_(num value);
external CSSUnitValue pt(num value);
external CSSUnitValue pc(num value);
external CSSUnitValue px(num value);
external CSSUnitValue deg(num value);
external CSSUnitValue grad(num value);
external CSSUnitValue rad(num value);
external CSSUnitValue turn(num value);
external CSSUnitValue s(num value);
external CSSUnitValue ms(num value);
external CSSUnitValue Hz(num value);
external CSSUnitValue kHz(num value);
external CSSUnitValue dpi(num value);
external CSSUnitValue dpcm(num value);
external CSSUnitValue dppx(num value);
external CSSUnitValue fr(num value);
external String escape(String ident);
external Worklet get animationWorklet;
external HighlightRegistry get highlights;
Expand Down
8 changes: 4 additions & 4 deletions lib/src/dom/cssom_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@ extension ScrollOptionsExtension on ScrollOptions {
@anonymous
class ScrollToOptions implements ScrollOptions {
external factory ScrollToOptions({
double left,
double top,
num left,
num top,
});
}

extension ScrollToOptionsExtension on ScrollToOptions {
external set left(double value);
external set left(num value);
external double get left;
external set top(double value);
external set top(num value);
external double get top;
}

Expand Down
4 changes: 2 additions & 2 deletions lib/src/dom/datacue.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import 'html.dart';
@staticInterop
class DataCue implements TextTrackCue {
external factory DataCue(
double startTime,
double endTime,
num startTime,
num endTime,
JSAny? value, [
String type,
]);
Expand Down
Loading

0 comments on commit 1dd5839

Please sign in to comment.