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

Deprecate JSX 3 #120

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
> - :house: [Internal]
> - :nail_care: [Polish]

## 0.13.1 (Unreleased)

- Deprecate JSX 3 https://github.com/rescript-lang/rescript-react/pull/120

## 0.13.0

#### :boom: Breaking Change
Expand Down
8 changes: 5 additions & 3 deletions src/v3/ReactDOMStyle_V3.res
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
type t = ReactDOMStyle.t

@obj
@obj @deprecated("Jsx 3 is deprecated, use jsx 4 instead")
external make: (
~azimuth: string=?,
~background: string=?,
Expand Down Expand Up @@ -420,16 +420,18 @@ external make: (
) => t = ""

/* CSS2Properties: https://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSS2Properties */
@val
@val @deprecated("Jsx 3 is deprecated, use jsx 4 instead")
external combine: (@as(json`{}`) _, t, t) => t = "Object.assign"

@deprecated("Jsx 3 is deprecated, use jsx 4 instead")
external _dictToStyle: Js.Dict.t<string> => t = "%identity"

@deprecated("Jsx 3 is deprecated, use jsx 4 instead")
let unsafeAddProp = (style, key, value) => {
let dict = Js.Dict.empty()
Js.Dict.set(dict, key, value)
combine(style, _dictToStyle(dict))
}

@val
@val @deprecated("Jsx 3 is deprecated, use jsx 4 instead")
external unsafeAddStyle: (@as(json`{}`) _, t, {..}) => t = "Object.assign"
21 changes: 13 additions & 8 deletions src/v3/ReactDOM_V3.res
Original file line number Diff line number Diff line change
Expand Up @@ -6,33 +6,35 @@
calls and add the appropriate `require("react-dom")` in the file calling this `render` */

// Helper so that ReactDOM itself doesn't bring any runtime
@val @return(nullable)
@val @return(nullable) @deprecated("Jsx 3 is deprecated, use jsx 4 instead")
external querySelector: string => option<Dom.element> = "document.querySelector"

@module("react-dom")
@module("react-dom") @deprecated("Jsx 3 is deprecated, use jsx 4 instead")
external render: (React.element, Dom.element) => unit = "render"

module Experimental = {
type root = ReactDOM.Client.Root.t

@module("react-dom")
@module("react-dom") @deprecated("Jsx 3 is deprecated, use jsx 4 instead")
external createRoot: Dom.element => root = "createRoot"

@module("react-dom")
@module("react-dom") @deprecated("Jsx 3 is deprecated, use jsx 4 instead")
external createBlockingRoot: Dom.element => root = "createBlockingRoot"

@send external render: (root, React.element) => unit = "render"
@send @deprecated("Jsx 3 is deprecated, use jsx 4 instead")
external render: (root, React.element) => unit = "render"
}

@module("react-dom")
@module("react-dom") @deprecated("Jsx 3 is deprecated, use jsx 4 instead")
external hydrate: (React.element, Dom.element) => unit = "hydrate"

@module("react-dom")
@module("react-dom") @deprecated("Jsx 3 is deprecated, use jsx 4 instead")
external createPortal: (React.element, Dom.element) => React.element = "createPortal"

@module("react-dom")
@module("react-dom") @deprecated("Jsx 3 is deprecated, use jsx 4 instead")
external unmountComponentAtNode: Dom.element => unit = "unmountComponentAtNode"

@deprecated("Jsx 3 is deprecated, use jsx 4 instead")
external domElementToObj: Dom.element => {..} = "%identity"

type style = ReactDOMStyle.t
Expand All @@ -44,7 +46,9 @@ module Ref = {
type currentDomRef = React.ref<Js.nullable<Dom.element>>
type callbackDomRef = Js.nullable<Dom.element> => unit

@deprecated("Jsx 3 is deprecated, use jsx 4 instead")
external domRef: currentDomRef => domRef = "%identity"
@deprecated("Jsx 3 is deprecated, use jsx 4 instead")
external callbackDomRef: callbackDomRef => domRef = "%identity"
}

Expand Down Expand Up @@ -2108,6 +2112,7 @@ include Props

// As we've removed `ReactDOMRe.createElement`, this enables patterns like
// React.createElement(ReactDOM.stringToComponent(multiline ? "textarea" : "input"), ...)
@deprecated("Jsx 3 is deprecated, use jsx 4 instead")
external stringToComponent: string => React.component<domProps> = "%identity"

module Style = ReactDOMStyle
Loading
Loading