Skip to content

Commit

Permalink
Fix fontWeight again
Browse files Browse the repository at this point in the history
  • Loading branch information
cknitt committed Mar 4, 2024
1 parent 4708a2b commit a134bc7
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/apis/Style.bs.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,13 @@ function rad(num) {
return num.toString() + "rad";
}

var FontWeight = {};

var empty = {};

exports.pct = pct;
exports.deg = deg;
exports.rad = rad;
exports.FontWeight = FontWeight;
exports.empty = empty;
/* No side effect */
31 changes: 30 additions & 1 deletion src/apis/Style.res
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,36 @@ type resizeMode = [#cover | #contain | #stretch | #repeat | #center]

type fontStyle = [#normal | #italic]

type fontWeight = [#normal | #bold | #100 | #200 | #300 | #400 | #500 | #600 | #700 | #800 | #900]
module FontWeight = {
// Note: we cannot model this as a polymorphic variant
// because #"100" = #100 = the number 100 in JS, but we need the string "100" here.
type t = string

@inline
let normal = "normal"
@inline
let bold = "bold"
@inline
let _100 = "100"
@inline
let _200 = "200"
@inline
let _300 = "300"
@inline
let _400 = "400"
@inline
let _500 = "500"
@inline
let _600 = "600"
@inline
let _700 = "700"
@inline
let _800 = "800"
@inline
let _900 = "900"
}

type fontWeight = FontWeight.t

// @todo in 0.71.0
// Apparently there are more `fontVariant` options IOS specific
Expand Down
30 changes: 29 additions & 1 deletion src/apis/Style.resi
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,36 @@ type resizeMode = [#cover | #contain | #stretch | #repeat | #center]

type fontStyle = [#normal | #italic]

type fontWeight = [#normal | #bold | #100 | #200 | #300 | #400 | #500 | #600 | #700 | #800 | #900]
module FontWeight: {
// Note: we cannot model this as a polymorphic variant
// because #"100" = #100 = the number 100 in JS, but we need the string "100" here.
type t

@inline("normal")
let normal: t
@inline("bold")
let bold: t
@inline("100")
let _100: t
@inline("200")
let _200: t
@inline("300")
let _300: t
@inline("400")
let _400: t
@inline("500")
let _500: t
@inline("600")
let _600: t
@inline("700")
let _700: t
@inline("800")
let _800: t
@inline("900")
let _900: t
}

type fontWeight = FontWeight.t
type fontVariant = [
| #"small-caps"
| #"oldstyle-nums"
Expand Down

0 comments on commit a134bc7

Please sign in to comment.