Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: build with melange 3 #1

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions bs-css-emotion/src/Css.res
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,24 @@ include Css_Legacy_Core.Make({
type styleEncoding = string
type renderer = Js.Json.t // not relevant

@module("@emotion/css")
@mel.module("@emotion/css")
external injectRaw: (. string) => unit = "injectGlobal"
let renderRaw = (. _, css) => injectRaw(. css)

@module("@emotion/css")
@mel.module("@emotion/css")
external injectRawRules: (. Js.Json.t) => unit = "injectGlobal"

let injectRules = (. selector: string, rules) =>
injectRawRules(. Js.Dict.fromArray([(selector, rules)])->Js.Json.object_)
let renderRules = (. _, selector, rules) =>
injectRawRules(. Js.Dict.fromArray([(selector, rules)])->Js.Json.object_)

@module("@emotion/css")
@mel.module("@emotion/css")
external mergeStyles: (. array<styleEncoding>) => styleEncoding = "cx"

@module("@emotion/css") external make: (. Js.Json.t) => styleEncoding = "css"
@mel.module("@emotion/css") external make: (. Js.Json.t) => styleEncoding = "css"

@module("@emotion/css")
@mel.module("@emotion/css")
external makeAnimation: (. Js.Dict.t<Js.Json.t>) => string = "keyframes"

let makeKeyframes = (. frames) => makeAnimation(. frames)
Expand All @@ -31,7 +31,7 @@ include Css_Legacy_Core.Make({

type cache

@module("@emotion/cache") external cache: cache = "cache"
@mel.module("@emotion/cache") external cache: cache = "cache"

let fontFace = (
~fontFamily,
Expand Down
12 changes: 6 additions & 6 deletions bs-css-emotion/src/CssJs.res
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,24 @@ include Css_Js_Core.Make({
type styleEncoding = string
type renderer = Js.Json.t // not relevant

@module("@emotion/css")
@mel.module("@emotion/css")
external injectRaw: (. string) => unit = "injectGlobal"
let renderRaw = (. _, css) => injectRaw(. css)

@module("@emotion/css")
@mel.module("@emotion/css")
external injectRawRules: (. Js.Json.t) => unit = "injectGlobal"

let injectRules = (. selector, rules) =>
injectRawRules(. Js.Dict.fromArray([(selector, rules)])->Js.Json.object_)
let renderRules = (. _, selector, rules) =>
injectRawRules(. Js.Dict.fromArray([(selector, rules)])->Js.Json.object_)

@module("@emotion/css")
@mel.module("@emotion/css")
external mergeStyles: (. array<styleEncoding>) => styleEncoding = "cx"

@module("@emotion/css") external make: (. Js.Json.t) => styleEncoding = "css"
@mel.module("@emotion/css") external make: (. Js.Json.t) => styleEncoding = "css"

@module("@emotion/css")
@mel.module("@emotion/css")
external makeAnimation: (. Js.Dict.t<Js.Json.t>) => string = "keyframes"

let makeKeyframes = (. frames) => makeAnimation(. frames)
Expand All @@ -31,7 +31,7 @@ include Css_Js_Core.Make({

type cache

@module("@emotion/cache") external cache: cache = "cache"
@mel.module("@emotion/cache") external cache: cache = "cache"

let fontFace = (
~fontFamily,
Expand Down
8 changes: 4 additions & 4 deletions bs-css/src/Css_AtomicTypes.res
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ module Var = {
let var = x => #var(x)
let varDefault = (x, default) => #varDefault((x, default))

let prefix = x => Js.String.startsWith("--", x) ? x : "--" ++ x
let prefix = x => Js.String.startsWith(~prefix="--", x) ? x : "--" ++ x

let toString = x =>
switch x {
Expand Down Expand Up @@ -1387,7 +1387,7 @@ module GridTemplateAreas = {
switch x {
| #none => "none"
| #areas(items) =>
String.trim(Belt.Array.reduceU(items, "", (. carry, item) => carry ++ "'" ++ item ++ "' "))
String.trim(Belt.Array.reduceU(items, "", @u (. carry, item) => carry ++ "'" ++ item ++ "' " ))
}
}

Expand Down Expand Up @@ -1711,7 +1711,7 @@ module Gradient = {
let string_of_stops = stops =>
stops
->Belt.Array.map(((l, c)) => string_of_color(c) ++ " " ++ PercentageLengthCalc.toString(l))
->Js.Array2.joinWith(", ")
->Js.Array.join(~sep=", ")

let toString = x =>
switch x {
Expand Down Expand Up @@ -1998,7 +1998,7 @@ module Content = {
| #noCloseQuote => "no-close-quote"
| #attr(name) => "attr(" ++ name ++ ")"
| #text(value) =>
switch value->Js.String2.get(0) {
switch value->Js.String.get(0) {
| "\"" | "'" => value
| _ => "\"" ++ value ++ "\""
}
Expand Down
8 changes: 4 additions & 4 deletions bs-css/src/Css_Js_Core.res
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ type rec rule =
| PseudoClass(string, array<rule>)
| PseudoClassParam(string, string, array<rule>)

let rec ruleToDict = (. dict, rule) => {
let rec ruleToDict = @u (. dict, rule) => {
switch rule {
| D(name, value) if name == "content" =>
dict->Js.Dict.set(name, Js.Json.string(value == "" ? "\"\"" : value))
Expand Down Expand Up @@ -67,7 +67,7 @@ module Make = (CssImpl: Css_Core.CssImplementationIntf): (
let merge4 = (. s, s2, s3, s4) => merge(. [s, s2, s3, s4])

let framesToDict = frames =>
frames->Belt.Array.reduceU(Js.Dict.empty(), (. dict, (stop, rules)) => {
frames->Belt.Array.reduceU(Js.Dict.empty(), @u (. dict, (stop, rules)) => {
Js.Dict.set(dict, Js.Int.toString(stop) ++ "%", toJson(rules))
dict
})
Expand All @@ -86,7 +86,7 @@ module Calc = {
}

let join = (strings, separator) =>
strings->Belt.Array.reduceWithIndexU("", (. acc, item, index) =>
strings->Belt.Array.reduceWithIndexU("", @u (. acc, item, index) =>
index == 0 ? item : acc ++ (separator ++ item)
)

Expand Down Expand Up @@ -1800,7 +1800,7 @@ let fontFace = (
~sizeAdjust=?,
(),
) => {
let fontStyle = Js.Option.map((. value) => FontStyle.toString(value), fontStyle)
let fontStyle = Option.map((. value) => FontStyle.toString(value), fontStyle)

let src =
src
Expand Down
2 changes: 1 addition & 1 deletion bs-css/src/Css_Legacy_Core.res
Original file line number Diff line number Diff line change
Expand Up @@ -1789,7 +1789,7 @@ let fontFace = (
~sizeAdjust=?,
(),
) => {
let fontStyle = Js.Option.map((. value) => FontStyle.toString(value), fontStyle)
let fontStyle = Option.map((. value) => FontStyle.toString(value), fontStyle)
let src =
src
|> List.map(x =>
Expand Down