From e413ce1f87994b4682f7207f12019148d59bae9d Mon Sep 17 00:00:00 2001 From: David Sancho Moreno Date: Wed, 2 Aug 2023 19:16:28 +0200 Subject: [PATCH 1/2] Abstract layout --- server/comments.re | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/server/comments.re b/server/comments.re index cb2a499..f81d8d1 100644 --- a/server/comments.re +++ b/server/comments.re @@ -104,9 +104,18 @@ module Comments = { }; }; +module Layout = { + [@react.component] + let make = (~children) => { +
+ children +
; + }; +}; + module App = { let make = () => { -
+
@@ -127,6 +136,6 @@ module App = {

{React.string("Thanks for reading!")}

-
; + ; }; }; From f41b21d7c60790da00b2dead9f4cf03cd9289184 Mon Sep 17 00:00:00 2001 From: David Sancho Moreno Date: Fri, 4 Aug 2023 09:20:09 +0200 Subject: [PATCH 2/2] Update Reac tto 18 --- server/comments.re | 24 +- vendor/reason-react/React.re | 127 ++- vendor/reason-react/ReactDOM.re | 400 ++++---- vendor/reason-react/ReactDOMRe.re | 147 --- vendor/reason-react/ReactDOMServer.re | 77 ++ vendor/reason-react/ReactDOMServerRe.re | 6 - vendor/reason-react/ReactEvent.re | 30 + vendor/reason-react/ReactEvent.rei | 472 --------- vendor/reason-react/ReactEventRe.re | 215 ----- vendor/reason-react/ReactEventRe.rei | 857 ----------------- vendor/reason-react/ReasonReact.re | 739 --------------- vendor/reason-react/ReasonReact.rei | 229 ----- vendor/reason-react/ReasonReactCompat.re | 18 - vendor/reason-react/ReasonReactCompat.rei | 14 - .../ReasonReactOptimizedCreateClass.re | 893 ------------------ 15 files changed, 424 insertions(+), 3824 deletions(-) delete mode 100644 vendor/reason-react/ReactDOMServerRe.re delete mode 100644 vendor/reason-react/ReactEvent.rei delete mode 100644 vendor/reason-react/ReactEventRe.re delete mode 100644 vendor/reason-react/ReactEventRe.rei delete mode 100644 vendor/reason-react/ReasonReact.rei delete mode 100644 vendor/reason-react/ReasonReactCompat.re delete mode 100644 vendor/reason-react/ReasonReactCompat.rei delete mode 100644 vendor/reason-react/ReasonReactOptimizedCreateClass.re diff --git a/server/comments.re b/server/comments.re index f81d8d1..78a6142 100644 --- a/server/comments.re +++ b/server/comments.re @@ -124,17 +124,19 @@ module App = { style={ReactDOM.Style.make(~marginRight="16px", ())}> -
-

{React.string("Hello world")}

- -
-

{React.string("Comments")}

- }> - - -
-

{React.string("Thanks for reading!")}

-
+ }> +
+

{React.string("Hello world")}

+ +
+

{React.string("Comments")}

+ }> + + +
+

{React.string("Thanks for reading!")}

+
+
; }; diff --git a/vendor/reason-react/React.re b/vendor/reason-react/React.re index e5c519f..a383efe 100644 --- a/vendor/reason-react/React.re +++ b/vendor/reason-react/React.re @@ -28,17 +28,23 @@ external createElementVariadic: (component('props), 'props, array(element)) => element = "createElement"; -[@bs.module "react"] [@deprecated "Please use JSX syntax directly."] -external jsxKeyed: (component('props), 'props, string) => element = "jsx"; +[@bs.module "react/jsx-runtime"] +external jsxKeyed: + (component('props), 'props, ~key: string=?, unit) => element = + "jsx"; -[@bs.module "react"] [@deprecated "Please use JSX syntax directly."] +[@bs.module "react/jsx-runtime"] external jsx: (component('props), 'props) => element = "jsx"; -[@bs.module "react"] [@deprecated "Please use JSX syntax directly."] +[@bs.module "react/jsx-runtime"] external jsxs: (component('props), 'props) => element = "jsxs"; -[@bs.module "react"] [@deprecated "Please use JSX syntax directly."] -external jsxsKeyed: (component('props), 'props, string) => element = "jsxs"; +[@bs.module "react/jsx-runtime"] +external jsxsKeyed: + (component('props), 'props, ~key: string=?, unit) => element = + "jsxs"; + +[@bs.module "react/jsx-runtime"] external jsxFragment: 'element = "Fragment"; type ref('value) = {mutable current: 'value}; @@ -120,16 +126,15 @@ external memoCustomCompareProps: module Fragment = { [@bs.obj] - external makeProps: - (~children: element, ~key: 'key=?, unit) => {. "children": element}; + external makeProps: (~children: element, unit) => {. "children": element}; + [@bs.module "react"] external make: component({. "children": element}) = "Fragment"; }; module StrictMode = { [@bs.obj] - external makeProps: - (~children: element, ~key: 'key=?, unit) => {. "children": element}; + external makeProps: (~children: element, unit) => {. "children": element}; [@bs.module "react"] external make: component({. "children": element}) = "StrictMode"; }; @@ -137,7 +142,7 @@ module StrictMode = { module Suspense = { [@bs.obj] external makeProps: - (~children: element=?, ~fallback: element=?, ~key: 'key=?, unit) => + (~children: element=?, ~fallback: element=?, unit) => { . "children": option(element), @@ -153,35 +158,6 @@ module Suspense = { "Suspense"; }; -/* Experimental React.SuspenseList */ -module SuspenseList = { - type revealOrder; - type tail; - [@bs.obj] - external makeProps: - ( - ~children: element=?, - ~revealOrder: [ | `forwards | `backwards | `together]=?, - ~tail: [ | `collapsed | `hidden]=?, - unit - ) => - { - . - "children": option(element), - "revealOrder": option(revealOrder), - "tail": option(tail), - }; - - [@bs.module "react"] - external make: - component({ - . - "children": option(element), - "revealOrder": option(revealOrder), - "tail": option(tail), - }) = - "SuspenseList"; -}; /* HOOKS */ /* @@ -211,6 +187,16 @@ external useReducerWithMapState: ('state, 'action => unit) = "useReducer"; +[@bs.module "react"] +external useSyncExternalStore: + ( + ~subscribe: [@bs.uncurry] (unit => unit), + ~getSnapshot: [@bs.uncurry] (unit => 'snapshot), + ~getServerSnapshot: [@bs.uncurry] (unit => 'snapshot)=? + ) => + 'snapshot = + "useSyncExternalStore"; + [@bs.module "react"] external useEffect: ([@bs.uncurry] (unit => option(unit => unit))) => unit = "useEffect"; @@ -254,6 +240,50 @@ external useEffect7: unit = "useEffect"; +[@bs.module "react"] +external useInsertionEffect: + ([@bs.uncurry] (unit => option(unit => unit))) => unit = + "useInsertionEffect"; +[@bs.module "react"] +external useInsertionEffect0: + ([@bs.uncurry] (unit => option(unit => unit)), [@bs.as {json|[]|json}] _) => + unit = + "useInsertionEffect"; +[@bs.module "react"] +external useInsertionEffect1: + ([@bs.uncurry] (unit => option(unit => unit)), array('a)) => unit = + "useInsertionEffect"; +[@bs.module "react"] +external useInsertionEffect2: + ([@bs.uncurry] (unit => option(unit => unit)), ('a, 'b)) => unit = + "useInsertionEffect"; +[@bs.module "react"] +external useInsertionEffect3: + ([@bs.uncurry] (unit => option(unit => unit)), ('a, 'b, 'c)) => unit = + "useInsertionEffect"; +[@bs.module "react"] +external useInsertionEffect4: + ([@bs.uncurry] (unit => option(unit => unit)), ('a, 'b, 'c, 'd)) => unit = + "useInsertionEffect"; +[@bs.module "react"] +external useInsertionEffect5: + ([@bs.uncurry] (unit => option(unit => unit)), ('a, 'b, 'c, 'd, 'e)) => + unit = + "useInsertionEffect"; +[@bs.module "react"] +external useInsertionEffect6: + ([@bs.uncurry] (unit => option(unit => unit)), ('a, 'b, 'c, 'd, 'e, 'f)) => + unit = + "useInsertionEffect"; +[@bs.module "react"] +external useInsertionEffect7: + ( + [@bs.uncurry] (unit => option(unit => unit)), + ('a, 'b, 'c, 'd, 'e, 'f, 'g) + ) => + unit = + "useInsertionEffect"; + [@bs.module "react"] external useLayoutEffect: ([@bs.uncurry] (unit => option(unit => unit))) => unit = @@ -329,7 +359,7 @@ external useMemo7: ([@bs.uncurry] (unit => 'any), ('a, 'b, 'c, 'd, 'e, 'f, 'g)) => 'any = "useMemo"; -/* This is used as return values */ +/* This is used as return values */ type callback('input, 'output) = 'input => 'output; [@bs.module "react"] @@ -379,6 +409,9 @@ external useCallback7: external useContext: Context.t('any) => 'any = "useContext"; [@bs.module "react"] external useRef: 'value => ref('value) = "useRef"; +[@bs.module "react"] external useId: unit => string = "useId"; + +[@bs.module "react"] external useDeferredValue: 'a => 'a = "useDeferredValue"; [@bs.module "react"] external useImperativeHandle0: @@ -523,16 +556,18 @@ module Uncurried = { "useCallback"; }; -type transitionConfig = {timeoutMs: int}; - [@bs.module "react"] -external useTransition: - (~config: transitionConfig=?, unit) => - (callback(callback(unit, unit), unit), bool) = +external useTransition: unit => (bool, callback(callback(unit, unit), unit)) = "useTransition"; +[@bs.module "react"] external use: Js.Promise.t('a) => 'a = "use"; + [@bs.set] external setDisplayName: (component('props), string) => unit = "displayName"; [@bs.get] [@bs.return nullable] external displayName: component('props) => option(string) = "displayName"; + +[@bs.module "react"] +external useDebugValue: ('value, ~format: 'value => string=?, unit) => unit = + "useDebugValue"; diff --git a/vendor/reason-react/ReactDOM.re b/vendor/reason-react/ReactDOM.re index 2561188..eba82d6 100644 --- a/vendor/reason-react/ReactDOM.re +++ b/vendor/reason-react/ReactDOM.re @@ -10,21 +10,25 @@ external querySelector: string => option(Dom.element) = "document.querySelector"; -[@bs.module "react-dom"] -external render: (React.element, Dom.element) => unit = "render"; - -module Experimental = { +module Client = { type root; - [@bs.module "react-dom"] - external createRoot: Dom.element => root = "createRoot"; + [@bs.send] external render: (root, React.element) => unit = "render"; - [@bs.module "react-dom"] - external createBlockingRoot: Dom.element => root = "createBlockingRoot"; + [@bs.send] external unmount: (root, unit) => unit = "unmount"; - [@bs.send] external render: (root, React.element) => unit = "render"; + [@bs.module "react-dom/client"] + external createRoot: Dom.element => root = "createRoot"; + + [@bs.module "react-dom/client"] + external hydrateRoot: (Dom.element, React.element) => root = "hydrateRoot"; }; +module Server = ReactDOMServer; + +[@bs.module "react-dom"] +external render: (React.element, Dom.element) => unit = "render"; + [@bs.module "react-dom"] external hydrate: (React.element, Dom.element) => unit = "hydrate"; @@ -36,6 +40,9 @@ external createPortal: (React.element, Dom.element) => React.element = external unmountComponentAtNode: Dom.element => unit = "unmountComponentAtNode"; +[@bs.module "react-dom"] +external flushSync: (unit => unit) => unit = "flushSync"; + external domElementToObj: Dom.element => Js.t({..}) = "%identity"; type style = ReactDOMStyle.t; @@ -63,100 +70,106 @@ module Props = { key: string, [@bs.optional] ref: domRef, + [@bs.optional] + children: React.element, /* accessibility */ /* https://www.w3.org/TR/wai-aria-1.1/ */ - /* https://accessibilityresources.org/ is a great resource for these */ - /* [@bs.optional] [@bs.as "aria-current"] ariaCurrent: page|step|location|date|time|true|false, */ + [@bs.optional] [@bs.as "aria-activedescendant"] + ariaActivedescendant: string, /* https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-activedescendat */ + [@bs.optional] [@bs.as "aria-atomic"] + ariaAtomic: bool, /* https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-atomic */ + [@bs.optional] [@bs.as "aria-autocomplete"] + ariaAutocomplete: string, /* https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-autocomplete */ + [@bs.optional] [@bs.as "aria-busy"] + ariaBusy: bool, /* https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-busy */ + [@bs.optional] [@bs.as "aria-checked"] + ariaChecked: string, /* https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-checked */ + [@bs.optional] [@bs.as "aria-colcount"] + ariaColcount: int, /* https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-colcount */ + [@bs.optional] [@bs.as "aria-colindex"] + ariaColindex: int, /* https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-colindex */ + [@bs.optional] [@bs.as "aria-colspan"] + ariaColspan: int, /* https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-colspan */ + [@bs.optional] [@bs.as "aria-controls"] + ariaControls: string, /* https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-controls */ + [@bs.optional] [@bs.as "aria-current"] + ariaCurrent: string, /* https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-current */ + [@bs.optional] [@bs.as "aria-describedby"] + ariaDescribedby: string, /* https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-describedby */ [@bs.optional] [@bs.as "aria-details"] - ariaDetails: string, + ariaDetails: string, /* https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-details */ [@bs.optional] [@bs.as "aria-disabled"] - ariaDisabled: bool, + ariaDisabled: bool, /* https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-disabled */ + [@bs.optional] [@bs.as "aria-errormessage"] + ariaErrormessage: string, /* https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-errormessage */ + [@bs.optional] [@bs.as "aria-expanded"] + ariaExpanded: bool, /* string */ /* https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-expanded */ + [@bs.optional] [@bs.as "aria-flowto"] + ariaFlowto: string, /* https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-flowto */ + [@bs.optional] [@bs.as "aria-grabbed"] /* https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-relevant */ + ariaGrabbed: bool, + [@bs.optional] [@bs.as "aria-haspopup"] + ariaHaspopup: string, /* https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-haspopup */ [@bs.optional] [@bs.as "aria-hidden"] - ariaHidden: bool, - /* [@bs.optional] [@bs.as "aria-invalid"] ariaInvalid: grammar|false|spelling|true, */ + ariaHidden: bool, /* string */ /* https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-hidden */ + [@bs.optional] [@bs.as "aria-invalid"] + ariaInvalid: string, /* https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-invalid */ [@bs.optional] [@bs.as "aria-keyshortcuts"] - ariaKeyshortcuts: string, + ariaKeyshortcuts: string, /* https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-keyshortcuts */ [@bs.optional] [@bs.as "aria-label"] - ariaLabel: string, - [@bs.optional] [@bs.as "aria-roledescription"] - ariaRoledescription: string, - /* Widget Attributes */ - /* [@bs.optional] [@bs.as "aria-autocomplete"] ariaAutocomplete: inline|list|both|none, */ - /* [@bs.optional] [@bs.as "aria-checked"] ariaChecked: true|false|mixed, /* https://www.w3.org/TR/wai-aria-1.1/#valuetype_tristate */ */ - [@bs.optional] [@bs.as "aria-expanded"] - ariaExpanded: bool, - /* [@bs.optional] [@bs.as "aria-haspopup"] ariaHaspopup: false|true|menu|listbox|tree|grid|dialog, */ + ariaLabel: string, /* https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-label */ + [@bs.optional] [@bs.as "aria-labelledby"] + ariaLabelledby: string, /* https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-labelledby */ [@bs.optional] [@bs.as "aria-level"] - ariaLevel: int, + ariaLevel: int, /* https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-level */ + [@bs.optional] [@bs.as "aria-live"] + ariaLive: string, /* https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-live */ [@bs.optional] [@bs.as "aria-modal"] - ariaModal: bool, + ariaModal: bool, /* https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-modal */ [@bs.optional] [@bs.as "aria-multiline"] - ariaMultiline: bool, + ariaMultiline: bool, /* https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-multiline */ [@bs.optional] [@bs.as "aria-multiselectable"] - ariaMultiselectable: bool, - /* [@bs.optional] [@bs.as "aria-orientation"] ariaOrientation: horizontal|vertical|undefined, */ + ariaMultiselectable: bool, /* https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-multiselectable */ + [@bs.optional] [@bs.as "aria-orientation"] + ariaOrientation: string, /* https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-orientation */ + [@bs.optional] [@bs.as "aria-owns"] + ariaOwns: string, /* https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-owns */ [@bs.optional] [@bs.as "aria-placeholder"] - ariaPlaceholder: string, - /* [@bs.optional] [@bs.as "aria-pressed"] ariaPressed: true|false|mixed, /* https://www.w3.org/TR/wai-aria-1.1/#valuetype_tristate */ */ + ariaPlaceholder: string, /* https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-placeholder */ + [@bs.optional] [@bs.as "aria-posinset"] + ariaPosinset: int, /* https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-posinset */ + [@bs.optional] [@bs.as "aria-pressed"] + ariaPressed: string, /* https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-pressed */ [@bs.optional] [@bs.as "aria-readonly"] - ariaReadonly: bool, + ariaReadonly: bool, /* https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-readonly */ + [@bs.optional] [@bs.as "aria-relevant"] + ariaRelevant: string, /* https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-relevant */ [@bs.optional] [@bs.as "aria-required"] - ariaRequired: bool, + ariaRequired: bool, /* https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-required */ + [@bs.optional] [@bs.as "aria-roledescription"] + ariaRoledescription: string, /* https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-roledescription */ + [@bs.optional] [@bs.as "aria-rowcount"] + ariaRowcount: int, /* https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-rowcount */ + [@bs.optional] [@bs.as "aria-rowindex"] + ariaRowindex: int, /* https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-rowindex */ + [@bs.optional] [@bs.as "aria-rowindextext"] + ariaRowindextext: string, /* https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-rowindextext */ + [@bs.optional] [@bs.as "aria-rowspan"] + ariaRowspan: int, /* https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-rowspan */ [@bs.optional] [@bs.as "aria-selected"] - ariaSelected: bool, + ariaSelected: bool, /* string */ /* https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-selected */ + [@bs.optional] [@bs.as "aria-setsize"] + ariaSetsize: int, /* https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-setsize */ [@bs.optional] [@bs.as "aria-sort"] - ariaSort: string, + ariaSort: string, /* https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-sort */ [@bs.optional] [@bs.as "aria-valuemax"] - ariaValuemax: float, + ariaValuemax: float, /* https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-valuemax */ [@bs.optional] [@bs.as "aria-valuemin"] - ariaValuemin: float, + ariaValuemin: float, /* https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-valuemin */ [@bs.optional] [@bs.as "aria-valuenow"] - ariaValuenow: float, + ariaValuenow: float, /* https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-valuenow */ [@bs.optional] [@bs.as "aria-valuetext"] - ariaValuetext: string, - /* Live Region Attributes */ - [@bs.optional] [@bs.as "aria-atomic"] - ariaAtomic: bool, - [@bs.optional] [@bs.as "aria-busy"] - ariaBusy: bool, - /* [@bs.optional] [@bs.as "aria-live"] ariaLive: off|polite|assertive|rude, */ - [@bs.optional] [@bs.as "aria-relevant"] - ariaRelevant: string, - /* Drag-and-Drop Attributes */ - /* [@bs.optional] [@bs.as "aria-dropeffect"] ariaDropeffect: copy|move|link|execute|popup|none, */ - [@bs.optional] [@bs.as "aria-grabbed"] - ariaGrabbed: bool, - /* Relationship Attributes */ - [@bs.optional] [@bs.as "aria-activedescendant"] - ariaActivedescendant: string, - [@bs.optional] [@bs.as "aria-colcount"] - ariaColcount: int, - [@bs.optional] [@bs.as "aria-colindex"] - ariaColindex: int, - [@bs.optional] [@bs.as "aria-colspan"] - ariaColspan: int, - [@bs.optional] [@bs.as "aria-controls"] - ariaControls: string, - [@bs.optional] [@bs.as "aria-describedby"] - ariaDescribedby: string, - [@bs.optional] [@bs.as "aria-errormessage"] - ariaErrormessage: string, - [@bs.optional] [@bs.as "aria-flowto"] - ariaFlowto: string, - [@bs.optional] [@bs.as "aria-labelledby"] - ariaLabelledby: string, - [@bs.optional] [@bs.as "aria-owns"] - ariaOwns: string, - [@bs.optional] [@bs.as "aria-posinset"] - ariaPosinset: int, - [@bs.optional] [@bs.as "aria-rowcount"] - ariaRowcount: int, - [@bs.optional] [@bs.as "aria-rowindex"] - ariaRowindex: int, - [@bs.optional] [@bs.as "aria-rowspan"] - ariaRowspan: int, - [@bs.optional] [@bs.as "aria-setsize"] - ariaSetsize: int, + ariaValuetext: string, /* https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-valuetext */ /* react textarea/input */ [@bs.optional] defaultChecked: bool, @@ -203,6 +216,8 @@ module Props = { [@bs.optional] itemType: string, /* uri */ /* tag-specific html attributes */ + [@bs.optional] [@bs.as "as"] + as_: string, [@bs.optional] accept: string, [@bs.optional] @@ -439,21 +454,21 @@ module Props = { [@bs.optional] onDoubleClick: ReactEvent.Mouse.t => unit, [@bs.optional] - onDrag: ReactEvent.Mouse.t => unit, + onDrag: ReactEvent.Drag.t => unit, [@bs.optional] - onDragEnd: ReactEvent.Mouse.t => unit, + onDragEnd: ReactEvent.Drag.t => unit, [@bs.optional] - onDragEnter: ReactEvent.Mouse.t => unit, + onDragEnter: ReactEvent.Drag.t => unit, [@bs.optional] - onDragExit: ReactEvent.Mouse.t => unit, + onDragExit: ReactEvent.Drag.t => unit, [@bs.optional] - onDragLeave: ReactEvent.Mouse.t => unit, + onDragLeave: ReactEvent.Drag.t => unit, [@bs.optional] - onDragOver: ReactEvent.Mouse.t => unit, + onDragOver: ReactEvent.Drag.t => unit, [@bs.optional] - onDragStart: ReactEvent.Mouse.t => unit, + onDragStart: ReactEvent.Drag.t => unit, [@bs.optional] - onDrop: ReactEvent.Mouse.t => unit, + onDrop: ReactEvent.Drag.t => unit, [@bs.optional] onMouseDown: ReactEvent.Mouse.t => unit, [@bs.optional] @@ -555,7 +570,8 @@ module Props = { [@bs.optional] onWaiting: ReactEvent.Media.t => unit, /* Image events */ - [@bs.optional]onLoad: ReactEvent.Image.t => unit /* duplicate */, /*~onError: ReactEvent.Image.t => unit=?,*/ + [@bs.optional] + onLoad: ReactEvent.Image.t => unit, /* Animation events */ [@bs.optional] onAnimationStart: ReactEvent.Animation.t => unit, @@ -1074,6 +1090,8 @@ module Props = { dangerouslySetInnerHTML: {. "__html": string}, [@bs.optional] suppressContentEditableWarning: bool, + [@bs.optional] + suppressHydrationWarning: bool, }; /* This list isn't exhaustive. We'll add more as we go. */ @@ -1081,7 +1099,7 @@ module Props = { * Watch out! There are two props types and the only difference is the type of ref. * Please keep in sync. */ - [@bs.deriving abstract] + [@deriving abstract] type props = { [@bs.optional] key: string, @@ -1089,98 +1107,102 @@ module Props = { ref: Js.nullable(Dom.element) => unit, /* accessibility */ /* https://www.w3.org/TR/wai-aria-1.1/ */ - /* https://accessibilityresources.org/ is a great resource for these */ - /* [@bs.optional] [@bs.as "aria-current"] ariaCurrent: page|step|location|date|time|true|false, */ + [@bs.optional] [@bs.as "aria-activedescendant"] + ariaActivedescendant: string, /* https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-activedescendat */ + [@bs.optional] [@bs.as "aria-atomic"] + ariaAtomic: bool, /* https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-atomic */ + [@bs.optional] [@bs.as "aria-autocomplete"] + ariaAutocomplete: string, /* https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-autocomplete */ + [@bs.optional] [@bs.as "aria-busy"] + ariaBusy: bool, /* https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-busy */ + [@bs.optional] [@bs.as "aria-checked"] + ariaChecked: string, /* https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-checked */ + [@bs.optional] [@bs.as "aria-colcount"] + ariaColcount: int, /* https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-colcount */ + [@bs.optional] [@bs.as "aria-colindex"] + ariaColindex: int, /* https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-colindex */ + [@bs.optional] [@bs.as "aria-colspan"] + ariaColspan: int, /* https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-colspan */ + [@bs.optional] [@bs.as "aria-controls"] + ariaControls: string, /* https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-controls */ + [@bs.optional] [@bs.as "aria-current"] + ariaCurrent: string, /* https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-current */ + [@bs.optional] [@bs.as "aria-describedby"] + ariaDescribedby: string, /* https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-describedby */ [@bs.optional] [@bs.as "aria-details"] - ariaDetails: string, + ariaDetails: string, /* https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-details */ [@bs.optional] [@bs.as "aria-disabled"] - ariaDisabled: bool, + ariaDisabled: bool, /* https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-disabled */ + [@bs.optional] [@bs.as "aria-errormessage"] + ariaErrormessage: string, /* https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-errormessage */ + [@bs.optional] [@bs.as "aria-expanded"] + ariaExpanded: bool, /* string */ /* https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-expanded */ + [@bs.optional] [@bs.as "aria-flowto"] + ariaFlowto: string, /* https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-flowto */ + [@bs.optional] [@bs.as "aria-grabbed"] /* https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-relevant */ + ariaGrabbed: bool, + [@bs.optional] [@bs.as "aria-haspopup"] + ariaHaspopup: string, /* https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-haspopup */ [@bs.optional] [@bs.as "aria-hidden"] - ariaHidden: bool, - /* [@bs.optional] [@bs.as "aria-invalid"] ariaInvalid: grammar|false|spelling|true, */ + ariaHidden: bool, /* string */ /* https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-hidden */ + [@bs.optional] [@bs.as "aria-invalid"] + ariaInvalid: string, /* https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-invalid */ [@bs.optional] [@bs.as "aria-keyshortcuts"] - ariaKeyshortcuts: string, + ariaKeyshortcuts: string, /* https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-keyshortcuts */ [@bs.optional] [@bs.as "aria-label"] - ariaLabel: string, - [@bs.optional] [@bs.as "aria-roledescription"] - ariaRoledescription: string, - /* Widget Attributes */ - /* [@bs.optional] [@bs.as "aria-autocomplete"] ariaAutocomplete: inline|list|both|none, */ - /* [@bs.optional] [@bs.as "aria-checked"] ariaChecked: true|false|mixed, /* https://www.w3.org/TR/wai-aria-1.1/#valuetype_tristate */ */ - [@bs.optional] [@bs.as "aria-expanded"] - ariaExpanded: bool, - /* [@bs.optional] [@bs.as "aria-haspopup"] ariaHaspopup: false|true|menu|listbox|tree|grid|dialog, */ + ariaLabel: string, /* https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-label */ + [@bs.optional] [@bs.as "aria-labelledby"] + ariaLabelledby: string, /* https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-labelledby */ [@bs.optional] [@bs.as "aria-level"] - ariaLevel: int, + ariaLevel: int, /* https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-level */ + [@bs.optional] [@bs.as "aria-live"] + ariaLive: string, /* https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-live */ [@bs.optional] [@bs.as "aria-modal"] - ariaModal: bool, + ariaModal: bool, /* https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-modal */ [@bs.optional] [@bs.as "aria-multiline"] - ariaMultiline: bool, + ariaMultiline: bool, /* https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-multiline */ [@bs.optional] [@bs.as "aria-multiselectable"] - ariaMultiselectable: bool, - /* [@bs.optional] [@bs.as "aria-orientation"] ariaOrientation: horizontal|vertical|undefined, */ + ariaMultiselectable: bool, /* https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-multiselectable */ + [@bs.optional] [@bs.as "aria-orientation"] + ariaOrientation: string, /* https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-orientation */ + [@bs.optional] [@bs.as "aria-owns"] + ariaOwns: string, /* https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-owns */ [@bs.optional] [@bs.as "aria-placeholder"] - ariaPlaceholder: string, - /* [@bs.optional] [@bs.as "aria-pressed"] ariaPressed: true|false|mixed, /* https://www.w3.org/TR/wai-aria-1.1/#valuetype_tristate */ */ + ariaPlaceholder: string, /* https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-placeholder */ + [@bs.optional] [@bs.as "aria-posinset"] + ariaPosinset: int, /* https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-posinset */ + [@bs.optional] [@bs.as "aria-pressed"] + ariaPressed: string, /* https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-pressed */ [@bs.optional] [@bs.as "aria-readonly"] - ariaReadonly: bool, + ariaReadonly: bool, /* https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-readonly */ + [@bs.optional] [@bs.as "aria-relevant"] + ariaRelevant: string, /* https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-relevant */ [@bs.optional] [@bs.as "aria-required"] - ariaRequired: bool, + ariaRequired: bool, /* https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-required */ + [@bs.optional] [@bs.as "aria-roledescription"] + ariaRoledescription: string, /* https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-roledescription */ + [@bs.optional] [@bs.as "aria-rowcount"] + ariaRowcount: int, /* https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-rowcount */ + [@bs.optional] [@bs.as "aria-rowindex"] + ariaRowindex: int, /* https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-rowindex */ + [@bs.optional] [@bs.as "aria-rowindextext"] + ariaRowindextext: string, /* https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-rowindextext */ + [@bs.optional] [@bs.as "aria-rowspan"] + ariaRowspan: int, /* https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-rowspan */ [@bs.optional] [@bs.as "aria-selected"] - ariaSelected: bool, + ariaSelected: bool, /* string */ /* https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-selected */ + [@bs.optional] [@bs.as "aria-setsize"] + ariaSetsize: int, /* https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-setsize */ [@bs.optional] [@bs.as "aria-sort"] - ariaSort: string, + ariaSort: string, /* https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-sort */ [@bs.optional] [@bs.as "aria-valuemax"] - ariaValuemax: float, + ariaValuemax: float, /* https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-valuemax */ [@bs.optional] [@bs.as "aria-valuemin"] - ariaValuemin: float, + ariaValuemin: float, /* https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-valuemin */ [@bs.optional] [@bs.as "aria-valuenow"] - ariaValuenow: float, + ariaValuenow: float, /* https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-valuenow */ [@bs.optional] [@bs.as "aria-valuetext"] - ariaValuetext: string, - /* Live Region Attributes */ - [@bs.optional] [@bs.as "aria-atomic"] - ariaAtomic: bool, - [@bs.optional] [@bs.as "aria-busy"] - ariaBusy: bool, - /* [@bs.optional] [@bs.as "aria-live"] ariaLive: off|polite|assertive|rude, */ - [@bs.optional] [@bs.as "aria-relevant"] - ariaRelevant: string, - /* Drag-and-Drop Attributes */ - /* [@bs.optional] [@bs.as "aria-dropeffect"] ariaDropeffect: copy|move|link|execute|popup|none, */ - [@bs.optional] [@bs.as "aria-grabbed"] - ariaGrabbed: bool, - /* Relationship Attributes */ - [@bs.optional] [@bs.as "aria-activedescendant"] - ariaActivedescendant: string, - [@bs.optional] [@bs.as "aria-colcount"] - ariaColcount: int, - [@bs.optional] [@bs.as "aria-colindex"] - ariaColindex: int, - [@bs.optional] [@bs.as "aria-colspan"] - ariaColspan: int, - [@bs.optional] [@bs.as "aria-controls"] - ariaControls: string, - [@bs.optional] [@bs.as "aria-describedby"] - ariaDescribedby: string, - [@bs.optional] [@bs.as "aria-errormessage"] - ariaErrormessage: string, - [@bs.optional] [@bs.as "aria-flowto"] - ariaFlowto: string, - [@bs.optional] [@bs.as "aria-labelledby"] - ariaLabelledby: string, - [@bs.optional] [@bs.as "aria-owns"] - ariaOwns: string, - [@bs.optional] [@bs.as "aria-posinset"] - ariaPosinset: int, - [@bs.optional] [@bs.as "aria-rowcount"] - ariaRowcount: int, - [@bs.optional] [@bs.as "aria-rowindex"] - ariaRowindex: int, - [@bs.optional] [@bs.as "aria-rowspan"] - ariaRowspan: int, - [@bs.optional] [@bs.as "aria-setsize"] - ariaSetsize: int, + ariaValuetext: string, /* https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-valuetext */ /* react textarea/input */ [@bs.optional] defaultChecked: bool, @@ -1227,6 +1249,8 @@ module Props = { [@bs.optional] itemType: string, /* uri */ /* tag-specific html attributes */ + [@bs.optional] [@bs.as "as"] + as_: string, [@bs.optional] accept: string, [@bs.optional] @@ -1461,21 +1485,21 @@ module Props = { [@bs.optional] onDoubleClick: ReactEvent.Mouse.t => unit, [@bs.optional] - onDrag: ReactEvent.Mouse.t => unit, + onDrag: ReactEvent.Drag.t => unit, [@bs.optional] - onDragEnd: ReactEvent.Mouse.t => unit, + onDragEnd: ReactEvent.Drag.t => unit, [@bs.optional] - onDragEnter: ReactEvent.Mouse.t => unit, + onDragEnter: ReactEvent.Drag.t => unit, [@bs.optional] - onDragExit: ReactEvent.Mouse.t => unit, + onDragExit: ReactEvent.Drag.t => unit, [@bs.optional] - onDragLeave: ReactEvent.Mouse.t => unit, + onDragLeave: ReactEvent.Drag.t => unit, [@bs.optional] - onDragOver: ReactEvent.Mouse.t => unit, + onDragOver: ReactEvent.Drag.t => unit, [@bs.optional] - onDragStart: ReactEvent.Mouse.t => unit, + onDragStart: ReactEvent.Drag.t => unit, [@bs.optional] - onDrop: ReactEvent.Mouse.t => unit, + onDrop: ReactEvent.Drag.t => unit, [@bs.optional] onMouseDown: ReactEvent.Mouse.t => unit, [@bs.optional] @@ -1577,7 +1601,8 @@ module Props = { [@bs.optional] onWaiting: ReactEvent.Media.t => unit, /* Image events */ - [@bs.optional]onLoad: ReactEvent.Image.t => unit /* duplicate */, /*~onError: ReactEvent.Image.t => unit=?,*/ + [@bs.optional] + onLoad: ReactEvent.Image.t => unit, /* Animation events */ [@bs.optional] onAnimationStart: ReactEvent.Animation.t => unit, @@ -2095,6 +2120,8 @@ module Props = { [@bs.optional] dangerouslySetInnerHTML: {. "__html": string}, [@bs.optional] + suppressHydrationWarning: bool, + [@bs.optional] suppressContentEditableWarning: bool, }; }; @@ -2105,9 +2132,28 @@ include Props; // React.createElement(ReactDOM.stringToComponent(multiline ? "textarea" : "input"), ...) external stringToComponent: string => React.component(domProps) = "%identity"; +module Style = ReactDOMStyle; + +[@bs.variadic] [@bs.module "react"] +external createElement: + (string, ~props: props=?, array(React.element)) => React.element = + "createElement"; + [@bs.variadic] [@bs.module "react"] external createDOMElementVariadic: (string, ~props: domProps=?, array(React.element)) => React.element = "createElement"; -module Style = ReactDOMStyle; +[@bs.module "react/jsx-runtime"] +external jsxKeyed: (string, domProps, ~key: string=?, unit) => React.element = + "jsx"; + +[@bs.module "react/jsx-runtime"] +external jsx: (string, domProps) => React.element = "jsx"; + +[@bs.module "react/jsx-runtime"] +external jsxs: (string, domProps) => React.element = "jsxs"; + +[@bs.module "react/jsx-runtime"] +external jsxsKeyed: (string, domProps, ~key: string=?, unit) => React.element = + "jsxs"; diff --git a/vendor/reason-react/ReactDOMRe.re b/vendor/reason-react/ReactDOMRe.re index 6507eb1..673a052 100644 --- a/vendor/reason-react/ReactDOMRe.re +++ b/vendor/reason-react/ReactDOMRe.re @@ -1,114 +1,3 @@ -/* First time reading an OCaml/Reason/BuckleScript file? */ -/* `external` is the foreign function call in OCaml. */ -/* here we're saying `I guarantee that on the JS side, we have a `render` function in the module "react-dom" - that takes in a reactElement, a dom element, and returns unit (nothing) */ -/* It's like `let`, except you're pointing the implementation to the JS side. The compiler will inline these - calls and add the appropriate `require("react-dom")` in the file calling this `render` */ -[@bs.val] [@bs.module "react-dom"] -external render: (React.element, Dom.element) => unit = "render"; - -[@bs.val] -external _getElementsByClassName: string => array(Dom.element) = - "document.getElementsByClassName"; - -[@bs.val] [@bs.return nullable] -external _getElementById: string => option(Dom.element) = - "document.getElementById"; - -let renderToElementWithClassName = (reactElement, className) => - switch (_getElementsByClassName(className)) { - | [||] => - Js.Console.error( - "ReactDOMRe.renderToElementWithClassName: no element of class " - ++ className - ++ " found in the HTML.", - ) - | elements => render(reactElement, Array.unsafe_get(elements, 0)) - }; - -let renderToElementWithId = (reactElement, id) => - switch (_getElementById(id)) { - | None => - Js.Console.error( - "ReactDOMRe.renderToElementWithId : no element of id " - ++ id - ++ " found in the HTML.", - ) - | Some(element) => render(reactElement, element) - }; - -module Experimental = { - type root = ReactDOM.Experimental.root; - - [@bs.module "react-dom"] - external createRoot: Dom.element => root = "createRoot"; - - [@bs.send] external render: (root, React.element) => unit = "render"; - - let createRootWithClassName = className => - switch (_getElementsByClassName(className)) { - | [||] => None - | elements => Some(createRoot(Array.unsafe_get(elements, 0))) - }; - - let createRootWithId = id => - switch (_getElementById(id)) { - | None => None - | Some(element) => Some(createRoot(element)) - }; -}; - -[@bs.val] [@bs.module "react-dom"] -external hydrate: (React.element, Dom.element) => unit = "hydrate"; - -let hydrateToElementWithClassName = (reactElement, className) => - switch (_getElementsByClassName(className)) { - | [||] => - Js.Console.error( - "ReactDOMRe.hydrateToElementWithClassName: no element of class " - ++ className - ++ " found in the HTML.", - ) - | elements => hydrate(reactElement, Array.unsafe_get(elements, 0)) - }; - -let hydrateToElementWithId = (reactElement, id) => - switch (_getElementById(id)) { - | None => - Js.Console.error( - "ReactDOMRe.hydrateToElementWithId : no element of id " - ++ id - ++ " found in the HTML.", - ) - | Some(element) => hydrate(reactElement, element) - }; - -[@bs.val] [@bs.module "react-dom"] -external createPortal: (React.element, Dom.element) => React.element = - "createPortal"; - -[@bs.val] [@bs.module "react-dom"] -external unmountComponentAtNode: Dom.element => unit = - "unmountComponentAtNode"; - -[@bs.val] [@bs.module "react-dom"] -external findDOMNode: ReasonReact.reactRef => Dom.element = "findDOMNode"; - -external domElementToObj: Dom.element => Js.t({..}) = "%identity"; - -type style = ReactDOM.style; - -type domRef = ReactDOM.domRef; - -module Ref = { - type t = domRef; - type currentDomRef = React.ref(Js.nullable(Dom.element)); - type callbackDomRef = Js.nullable(Dom.element) => unit; - - external domRef: currentDomRef => domRef = "%identity"; - external callbackDomRef: callbackDomRef => domRef = "%identity"; -}; - include ReactDOM.Props; [@bs.splice] [@bs.module "react"] @@ -116,43 +5,7 @@ external createDOMElementVariadic: (string, ~props: domProps=?, array(React.element)) => React.element = "createElement"; -external objToDOMProps: Js.t({..}) => props = "%identity"; - -[@deprecated "Please use ReactDOMRe.props instead"] -type reactDOMProps = props; - [@bs.splice] [@bs.val] [@bs.module "react"] external createElement: (string, ~props: props=?, array(React.element)) => React.element = "createElement"; - -/* Only wanna expose createElementVariadic here. Don't wanna write an interface file */ -include ( - /* Use varargs to avoid the ReactJS warning for duplicate keys in children */ - { - [@bs.val] [@bs.module "react"] - external createElementInternalHack: 'a = "createElement"; - [@bs.send] - external apply: - ('theFunction, 'theContext, 'arguments) => - 'returnTypeOfTheFunction = - "apply"; - - let createElementVariadic = (domClassName, ~props=?, children) => { - let variadicArguments = - [|Obj.magic(domClassName), Obj.magic(props)|] - |> Js.Array.concat(children); - createElementInternalHack->( - apply( - Js.Nullable.null, - variadicArguments, - ) - ); - }; - }: { - let createElementVariadic: - (string, ~props: props=?, array(React.element)) => React.element; - } - ); - -module Style = ReactDOMStyle; diff --git a/vendor/reason-react/ReactDOMServer.re b/vendor/reason-react/ReactDOMServer.re index 135e99c..e218a68 100644 --- a/vendor/reason-react/ReactDOMServer.re +++ b/vendor/reason-react/ReactDOMServer.re @@ -1,3 +1,80 @@ +[@warning "-32"] [@bs.module "react-dom/server"] +external renderToString: React.element => string = "renderToString"; + +[@warning "-32"] [@bs.module "react-dom/server"] +external renderToStaticMarkup: React.element => string = + "renderToStaticMarkup"; + +type error = {.}; + +[@deriving abstract] +type options = { + [@bs.optional] + bootstrapScriptContent: string, + [@bs.optional] + bootstrapScripts: array(string), + [@bs.optional] + bootstrapModules: array(string), + [@bs.optional] + identifierPrefix: string, + [@bs.optional] + namespaceURI: string, + [@bs.optional] + nonce: string, + [@bs.optional] + onAllReady: unit => unit, + [@bs.optional] + onError: error => unit, + [@bs.optional] + onShellReady: unit => unit, + [@bs.optional] + onShellError: error => unit, + [@bs.optional] + progressiveChunkSize: int, +}; + +type pipeableStream = { + /* Using empty object instead of Node.stream since Melange don't provide a binding to node's Stream (https://nodejs.org/api/stream.html) */ + pipe: {.} => unit, + abort: unit => unit, +}; + +[@bs.module "react-dom/server"] +external renderToPipeableStream: (React.element, options) => pipeableStream = + "renderToPipeableStream"; + +let renderToPipeableStream = + ( + ~bootstrapScriptContent=?, + ~bootstrapScripts=?, + ~bootstrapModules=?, + ~identifierPrefix=?, + ~namespaceURI=?, + ~nonce=?, + ~onAllReady=?, + ~onError=?, + ~onShellReady=?, + ~onShellError=?, + ~progressiveChunkSize=?, + element, + ) => + renderToPipeableStream( + element, + options( + ~bootstrapScriptContent?, + ~bootstrapScripts?, + ~bootstrapModules?, + ~identifierPrefix?, + ~namespaceURI?, + ~nonce?, + ~onAllReady?, + ~onError?, + ~onShellReady?, + ~onShellError?, + ~progressiveChunkSize?, + (), + ), + ); [@bs.module "react-dom/server"] external renderToString: React.element => string = "renderToString"; diff --git a/vendor/reason-react/ReactDOMServerRe.re b/vendor/reason-react/ReactDOMServerRe.re deleted file mode 100644 index d3187ae..0000000 --- a/vendor/reason-react/ReactDOMServerRe.re +++ /dev/null @@ -1,6 +0,0 @@ -[@bs.val] [@bs.module "react-dom/server"] -external renderToString: React.element => string = "renderToString"; - -[@bs.val] [@bs.module "react-dom/server"] -external renderToStaticMarkup: React.element => string = - "renderToStaticMarkup"; diff --git a/vendor/reason-react/ReactEvent.re b/vendor/reason-react/ReactEvent.re index 0735962..c298945 100644 --- a/vendor/reason-react/ReactEvent.re +++ b/vendor/reason-react/ReactEvent.re @@ -134,6 +134,36 @@ module Mouse = { [@bs.get] external shiftKey: t => bool = "shiftKey"; }; +module Drag = { + type tag; + type t = synthetic(tag); + include MakeEventWithType({ + type nonrec t = t; + }); + + // MouseEvent + [@bs.get] external altKey: t => bool = "altKey"; + [@bs.get] external button: t => int = "button"; + [@bs.get] external buttons: t => int = "buttons"; + [@bs.get] external clientX: t => int = "clientX"; + [@bs.get] external clientY: t => int = "clientY"; + [@bs.get] external ctrlKey: t => bool = "ctrlKey"; + [@bs.send] + external getModifierState: (t, string) => bool = "getModifierState"; + [@bs.get] external metaKey: t => bool = "metaKey"; + [@bs.get] external movementX: t => int = "movementX"; + [@bs.get] external movementY: t => int = "movementY"; + [@bs.get] external pageX: t => int = "pageX"; + [@bs.get] external pageY: t => int = "pageY"; + [@bs.get] [@bs.return nullable] + external relatedTarget: t => option(Js.t({..})) = "relatedTarget"; /* Should return Dom.eventTarget */ + [@bs.get] external screenX: t => int = "screenX"; + [@bs.get] external screenY: t => int = "screenY"; + [@bs.get] external shiftKey: t => bool = "shiftKey"; + + [@bs.get] external dataTransfer: t => Js.t({..}) = "dataTransfer"; /* Should return Dom.dataTransfer */ +}; + module Pointer = { type tag; type t = synthetic(tag); diff --git a/vendor/reason-react/ReactEvent.rei b/vendor/reason-react/ReactEvent.rei deleted file mode 100644 index 29a89ea..0000000 --- a/vendor/reason-react/ReactEvent.rei +++ /dev/null @@ -1,472 +0,0 @@ -/* This is the whole synthetic event system of ReactJS/ReasonReact. The first module `Synthetic` represents - the generic synthetic event. The rest are the specific ones. - - In each module, the type `t` commonly means "the type of that module" (OCaml convention). In our case, e.g. - `ReactEvent.Mouse.t` represents a ReactJS synthetic mouse event. You'd use it to type your props: - - ``` - type props = { - onClick: ReactEvent.Mouse.t => unit - }; - ``` - - All the methods and properties of a type of event are in the module, as seen below. - - Each module also has a `tag` type. You can ignore it; they're only needed by their `t` type. This way, we - get to allow a base `Synthetic` event module with generic methods. So e.g. even a mouse event (`Mouse.t`) - get to be passed to a generic handler: - - ``` - let handleClick = ({state, props}, event) => { - ReactEvent.Mouse.preventDefault(event); - ... - }; - let handleSubmit = ({state, props}, event) => { - /* this handler can be triggered by either a Keyboard or a Mouse event; conveniently use the generic - preventDefault */ - ReactEvent.Synthetic.preventDefault(event); - ... - }; - - let render = (_) => ; - ``` - - How to translate idioms from ReactJS: - - 1. myMouseEvent.preventDefault() -> ReactEvent.Mouse.preventDefault(myMouseEvent) - 2. myKeyboardEvent.which -> ReactEvent.Keyboard.which(myKeyboardEvent) - */ -type synthetic('a); - -module Synthetic: { - type tag; - type t = synthetic(tag); - [@bs.get] external bubbles: synthetic('a) => bool = "bubbles"; - [@bs.get] external cancelable: synthetic('a) => bool = "cancelable"; - [@bs.get] - external currentTarget: synthetic('a) => Js.t({..}) = "currentTarget"; - [@bs.get] - external defaultPrevented: synthetic('a) => bool = "defaultPrevented"; - [@bs.get] external eventPhase: synthetic('a) => int = "eventPhase"; - [@bs.get] external isTrusted: synthetic('a) => bool = "isTrusted"; - [@bs.get] - external nativeEvent: synthetic('a) => Js.t({..}) = "nativeEvent"; - [@bs.send] - external preventDefault: synthetic('a) => unit = "preventDefault"; - [@bs.send] - external isDefaultPrevented: synthetic('a) => bool = "isDefaultPrevented"; - [@bs.send] - external stopPropagation: synthetic('a) => unit = "stopPropagation"; - [@bs.send] - external isPropagationStopped: synthetic('a) => bool = - "isPropagationStopped"; - [@bs.get] external target: synthetic('a) => Js.t({..}) = "target"; - [@bs.get] external timeStamp: synthetic('a) => float = "timeStamp"; - [@bs.get] external type_: synthetic('a) => string = "type"; - [@bs.send] external persist: synthetic('a) => unit = "persist"; -}; - -/* Cast any event type to the general synthetic type. This is safe, since synthetic is more general */ -external toSyntheticEvent: synthetic('a) => Synthetic.t = "%identity"; - -module Clipboard: { - type tag; - type t = synthetic(tag); - [@bs.get] external bubbles: t => bool = "bubbles"; - [@bs.get] external cancelable: t => bool = "cancelable"; - [@bs.get] external currentTarget: t => Js.t({..}) = "currentTarget"; - [@bs.get] external defaultPrevented: t => bool = "defaultPrevented"; - [@bs.get] external eventPhase: t => int = "eventPhase"; - [@bs.get] external isTrusted: t => bool = "isTrusted"; - [@bs.get] external nativeEvent: t => Js.t({..}) = "nativeEvent"; - [@bs.send] external preventDefault: t => unit = "preventDefault"; - [@bs.send] external isDefaultPrevented: t => bool = "isDefaultPrevented"; - [@bs.send] external stopPropagation: t => unit = "stopPropagation"; - [@bs.send] external isPropagationStopped: t => bool = "isPropagationStopped"; - [@bs.get] external target: t => Js.t({..}) = "target"; - [@bs.get] external timeStamp: t => float = "timeStamp"; - [@bs.get] external type_: t => string = "type"; - [@bs.send] external persist: t => unit = "persist"; - [@bs.get] external clipboardData: t => Js.t({..}) = "clipboardData"; /* Should return Dom.dataTransfer */ -}; - -module Composition: { - type tag; - type t = synthetic(tag); - [@bs.get] external bubbles: t => bool = "bubbles"; - [@bs.get] external cancelable: t => bool = "cancelable"; - [@bs.get] external currentTarget: t => Js.t({..}) = "currentTarget"; - [@bs.get] external defaultPrevented: t => bool = "defaultPrevented"; - [@bs.get] external eventPhase: t => int = "eventPhase"; - [@bs.get] external isTrusted: t => bool = "isTrusted"; - [@bs.get] external nativeEvent: t => Js.t({..}) = "nativeEvent"; - [@bs.send] external preventDefault: t => unit = "preventDefault"; - [@bs.send] external isDefaultPrevented: t => bool = "isDefaultPrevented"; - [@bs.send] external stopPropagation: t => unit = "stopPropagation"; - [@bs.send] external isPropagationStopped: t => bool = "isPropagationStopped"; - [@bs.get] external target: t => Js.t({..}) = "target"; - [@bs.get] external timeStamp: t => float = "timeStamp"; - [@bs.get] external type_: t => string = "type"; - [@bs.send] external persist: t => unit = "persist"; - [@bs.get] external data: t => string = "data"; -}; - -module Keyboard: { - type tag; - type t = synthetic(tag); - [@bs.get] external bubbles: t => bool = "bubbles"; - [@bs.get] external cancelable: t => bool = "cancelable"; - [@bs.get] external currentTarget: t => Js.t({..}) = "currentTarget"; - [@bs.get] external defaultPrevented: t => bool = "defaultPrevented"; - [@bs.get] external eventPhase: t => int = "eventPhase"; - [@bs.get] external isTrusted: t => bool = "isTrusted"; - [@bs.get] external nativeEvent: t => Js.t({..}) = "nativeEvent"; - [@bs.send] external preventDefault: t => unit = "preventDefault"; - [@bs.send] external isDefaultPrevented: t => bool = "isDefaultPrevented"; - [@bs.send] external stopPropagation: t => unit = "stopPropagation"; - [@bs.send] external isPropagationStopped: t => bool = "isPropagationStopped"; - [@bs.get] external target: t => Js.t({..}) = "target"; - [@bs.get] external timeStamp: t => float = "timeStamp"; - [@bs.get] external type_: t => string = "type"; - [@bs.send] external persist: t => unit = "persist"; - [@bs.get] external altKey: t => bool = "altKey"; - [@bs.get] external charCode: t => int = "charCode"; - [@bs.get] external ctrlKey: t => bool = "ctrlKey"; - [@bs.send] - external getModifierState: (t, string) => bool = "getModifierState"; - [@bs.get] external key: t => string = "key"; - [@bs.get] external keyCode: t => int = "keyCode"; - [@bs.get] external locale: t => string = "locale"; - [@bs.get] external location: t => int = "location"; - [@bs.get] external metaKey: t => bool = "metaKey"; - [@bs.get] external repeat: t => bool = "repeat"; - [@bs.get] external shiftKey: t => bool = "shiftKey"; - [@bs.get] external which: t => int = "which"; -}; - -module Focus: { - type tag; - type t = synthetic(tag); - [@bs.get] external bubbles: t => bool = "bubbles"; - [@bs.get] external cancelable: t => bool = "cancelable"; - [@bs.get] external currentTarget: t => Js.t({..}) = "currentTarget"; - [@bs.get] external defaultPrevented: t => bool = "defaultPrevented"; - [@bs.get] external eventPhase: t => int = "eventPhase"; - [@bs.get] external isTrusted: t => bool = "isTrusted"; - [@bs.get] external nativeEvent: t => Js.t({..}) = "nativeEvent"; - [@bs.send] external preventDefault: t => unit = "preventDefault"; - [@bs.send] external isDefaultPrevented: t => bool = "isDefaultPrevented"; - [@bs.send] external stopPropagation: t => unit = "stopPropagation"; - [@bs.send] external isPropagationStopped: t => bool = "isPropagationStopped"; - [@bs.get] external target: t => Js.t({..}) = "target"; - [@bs.get] external timeStamp: t => float = "timeStamp"; - [@bs.get] external type_: t => string = "type"; - [@bs.send] external persist: t => unit = "persist"; - [@bs.get] [@bs.return nullable] - external relatedTarget: t => option(Js.t({..})) = "relatedTarget"; /* Should return Dom.eventTarget */ -}; - -module Form: { - type tag; - type t = synthetic(tag); - [@bs.get] external bubbles: t => bool = "bubbles"; - [@bs.get] external cancelable: t => bool = "cancelable"; - [@bs.get] external currentTarget: t => Js.t({..}) = "currentTarget"; - [@bs.get] external defaultPrevented: t => bool = "defaultPrevented"; - [@bs.get] external eventPhase: t => int = "eventPhase"; - [@bs.get] external isTrusted: t => bool = "isTrusted"; - [@bs.get] external nativeEvent: t => Js.t({..}) = "nativeEvent"; - [@bs.send] external preventDefault: t => unit = "preventDefault"; - [@bs.send] external isDefaultPrevented: t => bool = "isDefaultPrevented"; - [@bs.send] external stopPropagation: t => unit = "stopPropagation"; - [@bs.send] external isPropagationStopped: t => bool = "isPropagationStopped"; - [@bs.get] external target: t => Js.t({..}) = "target"; - [@bs.get] external timeStamp: t => float = "timeStamp"; - [@bs.get] external type_: t => string = "type"; - [@bs.send] external persist: t => unit = "persist"; -}; - -module Mouse: { - type tag; - type t = synthetic(tag); - [@bs.get] external bubbles: t => bool = "bubbles"; - [@bs.get] external cancelable: t => bool = "cancelable"; - [@bs.get] external currentTarget: t => Js.t({..}) = "currentTarget"; - [@bs.get] external defaultPrevented: t => bool = "defaultPrevented"; - [@bs.get] external eventPhase: t => int = "eventPhase"; - [@bs.get] external isTrusted: t => bool = "isTrusted"; - [@bs.get] external nativeEvent: t => Js.t({..}) = "nativeEvent"; - [@bs.send] external preventDefault: t => unit = "preventDefault"; - [@bs.send] external isDefaultPrevented: t => bool = "isDefaultPrevented"; - [@bs.send] external stopPropagation: t => unit = "stopPropagation"; - [@bs.send] external isPropagationStopped: t => bool = "isPropagationStopped"; - [@bs.get] external target: t => Js.t({..}) = "target"; - [@bs.get] external timeStamp: t => float = "timeStamp"; - [@bs.get] external type_: t => string = "type"; - [@bs.send] external persist: t => unit = "persist"; - [@bs.get] external altKey: t => bool = "altKey"; - [@bs.get] external button: t => int = "button"; - [@bs.get] external buttons: t => int = "buttons"; - [@bs.get] external clientX: t => int = "clientX"; - [@bs.get] external clientY: t => int = "clientY"; - [@bs.get] external ctrlKey: t => bool = "ctrlKey"; - [@bs.send] - external getModifierState: (t, string) => bool = "getModifierState"; - [@bs.get] external metaKey: t => bool = "metaKey"; - [@bs.get] external movementX: t => int = "movementX"; - [@bs.get] external movementY: t => int = "movementY"; - [@bs.get] external pageX: t => int = "pageX"; - [@bs.get] external pageY: t => int = "pageY"; - [@bs.get] [@bs.return nullable] - external relatedTarget: t => option(Js.t({..})) = "relatedTarget"; /* Should return Dom.eventTarget */ - [@bs.get] external screenX: t => int = "screenX"; - [@bs.get] external screenY: t => int = "screenY"; - [@bs.get] external shiftKey: t => bool = "shiftKey"; -}; - -module Pointer: { - type tag; - type t = synthetic(tag); - - // Event - [@bs.get] external type_: t => string = "type"; - [@bs.get] external target: t => Js.t({..}) = "target"; - [@bs.get] external currentTarget: t => Js.t({..}) = "currentTarget"; - - [@bs.get] external eventPhase: t => int = "eventPhase"; - - [@bs.send] external stopPropagation: t => unit = "stopPropagation"; // aka cancelBubble - [@bs.get] external bubbles: t => bool = "bubbles"; - [@bs.get] external cancelable: t => bool = "cancelable"; - [@bs.send] external preventDefault: t => unit = "preventDefault"; - [@bs.get] external defaultPrevented: t => bool = "defaultPrevented"; - - [@bs.get] external isTrusted: t => bool = "isTrusted"; - [@bs.get] external timeStamp: t => float = "timeStamp"; - - // SyntheticEvent - [@bs.get] external nativeEvent: t => Js.t({..}) = "nativeEvent"; - [@bs.send] external isDefaultPrevented: t => bool = "isDefaultPrevented"; - [@bs.send] external isPropagationStopped: t => bool = "isPropagationStopped"; - [@bs.send] external persist: t => unit = "persist"; - - // UIEvent - [@bs.get] external detail: t => int = "detail"; - [@bs.get] external view: t => Dom.window = "view"; /* Should return DOMAbstractView/WindowProxy */ - - // MouseEvent - [@bs.get] external screenX: t => int = "screenX"; - [@bs.get] external screenY: t => int = "screenY"; - [@bs.get] external clientX: t => int = "clientX"; - [@bs.get] external clientY: t => int = "clientY"; - [@bs.get] external pageX: t => int = "pageX"; - [@bs.get] external pageY: t => int = "pageY"; - [@bs.get] external movementX: t => int = "movementX"; - [@bs.get] external movementY: t => int = "movementY"; - - [@bs.get] external ctrlKey: t => bool = "ctrlKey"; - [@bs.get] external shiftKey: t => bool = "shiftKey"; - [@bs.get] external altKey: t => bool = "altKey"; - [@bs.get] external metaKey: t => bool = "metaKey"; - [@bs.send] - external getModifierState: (t, string) => bool = "getModifierState"; - - [@bs.get] external button: t => int = "button"; - [@bs.get] external buttons: t => int = "buttons"; - - [@bs.get] [@bs.return nullable] - external relatedTarget: t => option(Js.t({..})) = "relatedTarget"; /* Should return Dom.eventTarget */ - - // PointerEvent - [@bs.get] external pointerId: t => Dom.eventPointerId = "pointerId"; - [@bs.get] external width: t => float = "width"; - [@bs.get] external height: t => float = "height"; - [@bs.get] external pressure: t => float = "pressure"; - [@bs.get] external tangentialPressure: t => float = "tangentialPressure"; - [@bs.get] external tiltX: t => int = "tiltX"; - [@bs.get] external tiltY: t => int = "tiltY"; - [@bs.get] external twist: t => int = "twist"; - [@bs.get] external pointerType: t => string = "pointerType"; - [@bs.get] external isPrimary: t => bool = "isPrimary"; -}; - -module Selection: { - type tag; - type t = synthetic(tag); - [@bs.get] external bubbles: t => bool = "bubbles"; - [@bs.get] external cancelable: t => bool = "cancelable"; - [@bs.get] external currentTarget: t => Js.t({..}) = "currentTarget"; - [@bs.get] external defaultPrevented: t => bool = "defaultPrevented"; - [@bs.get] external eventPhase: t => int = "eventPhase"; - [@bs.get] external isTrusted: t => bool = "isTrusted"; - [@bs.get] external nativeEvent: t => Js.t({..}) = "nativeEvent"; - [@bs.send] external preventDefault: t => unit = "preventDefault"; - [@bs.send] external isDefaultPrevented: t => bool = "isDefaultPrevented"; - [@bs.send] external stopPropagation: t => unit = "stopPropagation"; - [@bs.send] external isPropagationStopped: t => bool = "isPropagationStopped"; - [@bs.get] external target: t => Js.t({..}) = "target"; - [@bs.get] external timeStamp: t => float = "timeStamp"; - [@bs.get] external type_: t => string = "type"; - [@bs.send] external persist: t => unit = "persist"; -}; - -module Touch: { - type tag; - type t = synthetic(tag); - [@bs.get] external bubbles: t => bool = "bubbles"; - [@bs.get] external cancelable: t => bool = "cancelable"; - [@bs.get] external currentTarget: t => Js.t({..}) = "currentTarget"; - [@bs.get] external defaultPrevented: t => bool = "defaultPrevented"; - [@bs.get] external eventPhase: t => int = "eventPhase"; - [@bs.get] external isTrusted: t => bool = "isTrusted"; - [@bs.get] external nativeEvent: t => Js.t({..}) = "nativeEvent"; - [@bs.send] external preventDefault: t => unit = "preventDefault"; - [@bs.send] external isDefaultPrevented: t => bool = "isDefaultPrevented"; - [@bs.send] external stopPropagation: t => unit = "stopPropagation"; - [@bs.send] external isPropagationStopped: t => bool = "isPropagationStopped"; - [@bs.get] external target: t => Js.t({..}) = "target"; - [@bs.get] external timeStamp: t => float = "timeStamp"; - [@bs.get] external type_: t => string = "type"; - [@bs.send] external persist: t => unit = "persist"; - [@bs.get] external altKey: t => bool = "altKey"; - [@bs.get] external changedTouches: t => Js.t({..}) = "changedTouches"; /* Should return Dom.touchList */ - [@bs.get] external ctrlKey: t => bool = "ctrlKey"; - [@bs.send] - external getModifierState: (t, string) => bool = "getModifierState"; - [@bs.get] external metaKey: t => bool = "metaKey"; - [@bs.get] external shiftKey: t => bool = "shiftKey"; - [@bs.get] external targetTouches: t => Js.t({..}) = "targetTouches"; /* Should return Dom.touchList */ - [@bs.get] external touches: t => Js.t({..}) = "touches"; /* Should return Dom.touchList */ -}; - -module UI: { - type tag; - type t = synthetic(tag); - [@bs.get] external bubbles: t => bool = "bubbles"; - [@bs.get] external cancelable: t => bool = "cancelable"; - [@bs.get] external currentTarget: t => Js.t({..}) = "currentTarget"; - [@bs.get] external defaultPrevented: t => bool = "defaultPrevented"; - [@bs.get] external eventPhase: t => int = "eventPhase"; - [@bs.get] external isTrusted: t => bool = "isTrusted"; - [@bs.get] external nativeEvent: t => Js.t({..}) = "nativeEvent"; - [@bs.send] external preventDefault: t => unit = "preventDefault"; - [@bs.send] external isDefaultPrevented: t => bool = "isDefaultPrevented"; - [@bs.send] external stopPropagation: t => unit = "stopPropagation"; - [@bs.send] external isPropagationStopped: t => bool = "isPropagationStopped"; - [@bs.get] external target: t => Js.t({..}) = "target"; - [@bs.get] external timeStamp: t => float = "timeStamp"; - [@bs.get] external type_: t => string = "type"; - [@bs.send] external persist: t => unit = "persist"; - [@bs.get] external detail: t => int = "detail"; - [@bs.get] external view: t => Dom.window = "view"; /* Should return DOMAbstractView/WindowProxy */ -}; - -module Wheel: { - type tag; - type t = synthetic(tag); - [@bs.get] external bubbles: t => bool = "bubbles"; - [@bs.get] external cancelable: t => bool = "cancelable"; - [@bs.get] external currentTarget: t => Js.t({..}) = "currentTarget"; - [@bs.get] external defaultPrevented: t => bool = "defaultPrevented"; - [@bs.get] external eventPhase: t => int = "eventPhase"; - [@bs.get] external isTrusted: t => bool = "isTrusted"; - [@bs.get] external nativeEvent: t => Js.t({..}) = "nativeEvent"; - [@bs.send] external preventDefault: t => unit = "preventDefault"; - [@bs.send] external isDefaultPrevented: t => bool = "isDefaultPrevented"; - [@bs.send] external stopPropagation: t => unit = "stopPropagation"; - [@bs.send] external isPropagationStopped: t => bool = "isPropagationStopped"; - [@bs.get] external target: t => Js.t({..}) = "target"; - [@bs.get] external timeStamp: t => float = "timeStamp"; - [@bs.get] external type_: t => string = "type"; - [@bs.send] external persist: t => unit = "persist"; - [@bs.get] external deltaMode: t => int = "deltaMode"; - [@bs.get] external deltaX: t => float = "deltaX"; - [@bs.get] external deltaY: t => float = "deltaY"; - [@bs.get] external deltaZ: t => float = "deltaZ"; -}; - -module Media: { - type tag; - type t = synthetic(tag); - [@bs.get] external bubbles: t => bool = "bubbles"; - [@bs.get] external cancelable: t => bool = "cancelable"; - [@bs.get] external currentTarget: t => Js.t({..}) = "currentTarget"; - [@bs.get] external defaultPrevented: t => bool = "defaultPrevented"; - [@bs.get] external eventPhase: t => int = "eventPhase"; - [@bs.get] external isTrusted: t => bool = "isTrusted"; - [@bs.get] external nativeEvent: t => Js.t({..}) = "nativeEvent"; - [@bs.send] external preventDefault: t => unit = "preventDefault"; - [@bs.send] external isDefaultPrevented: t => bool = "isDefaultPrevented"; - [@bs.send] external stopPropagation: t => unit = "stopPropagation"; - [@bs.send] external isPropagationStopped: t => bool = "isPropagationStopped"; - [@bs.get] external target: t => Js.t({..}) = "target"; - [@bs.get] external timeStamp: t => float = "timeStamp"; - [@bs.get] external type_: t => string = "type"; - [@bs.send] external persist: t => unit = "persist"; -}; - -module Image: { - type tag; - type t = synthetic(tag); - [@bs.get] external bubbles: t => bool = "bubbles"; - [@bs.get] external cancelable: t => bool = "cancelable"; - [@bs.get] external currentTarget: t => Js.t({..}) = "currentTarget"; - [@bs.get] external defaultPrevented: t => bool = "defaultPrevented"; - [@bs.get] external eventPhase: t => int = "eventPhase"; - [@bs.get] external isTrusted: t => bool = "isTrusted"; - [@bs.get] external nativeEvent: t => Js.t({..}) = "nativeEvent"; - [@bs.send] external preventDefault: t => unit = "preventDefault"; - [@bs.send] external isDefaultPrevented: t => bool = "isDefaultPrevented"; - [@bs.send] external stopPropagation: t => unit = "stopPropagation"; - [@bs.send] external isPropagationStopped: t => bool = "isPropagationStopped"; - [@bs.get] external target: t => Js.t({..}) = "target"; - [@bs.get] external timeStamp: t => float = "timeStamp"; - [@bs.get] external type_: t => string = "type"; - [@bs.send] external persist: t => unit = "persist"; -}; - -module Animation: { - type tag; - type t = synthetic(tag); - [@bs.get] external bubbles: t => bool = "bubbles"; - [@bs.get] external cancelable: t => bool = "cancelable"; - [@bs.get] external currentTarget: t => Js.t({..}) = "currentTarget"; - [@bs.get] external defaultPrevented: t => bool = "defaultPrevented"; - [@bs.get] external eventPhase: t => int = "eventPhase"; - [@bs.get] external isTrusted: t => bool = "isTrusted"; - [@bs.get] external nativeEvent: t => Js.t({..}) = "nativeEvent"; - [@bs.send] external preventDefault: t => unit = "preventDefault"; - [@bs.send] external isDefaultPrevented: t => bool = "isDefaultPrevented"; - [@bs.send] external stopPropagation: t => unit = "stopPropagation"; - [@bs.send] external isPropagationStopped: t => bool = "isPropagationStopped"; - [@bs.get] external target: t => Js.t({..}) = "target"; - [@bs.get] external timeStamp: t => float = "timeStamp"; - [@bs.get] external type_: t => string = "type"; - [@bs.send] external persist: t => unit = "persist"; - [@bs.get] external animationName: t => string = "animationName"; - [@bs.get] external pseudoElement: t => string = "pseudoElement"; - [@bs.get] external elapsedTime: t => float = "elapsedTime"; -}; - -module Transition: { - type tag; - type t = synthetic(tag); - [@bs.get] external bubbles: t => bool = "bubbles"; - [@bs.get] external cancelable: t => bool = "cancelable"; - [@bs.get] external currentTarget: t => Js.t({..}) = "currentTarget"; - [@bs.get] external defaultPrevented: t => bool = "defaultPrevented"; - [@bs.get] external eventPhase: t => int = "eventPhase"; - [@bs.get] external isTrusted: t => bool = "isTrusted"; - [@bs.get] external nativeEvent: t => Js.t({..}) = "nativeEvent"; - [@bs.send] external preventDefault: t => unit = "preventDefault"; - [@bs.send] external isDefaultPrevented: t => bool = "isDefaultPrevented"; - [@bs.send] external stopPropagation: t => unit = "stopPropagation"; - [@bs.send] external isPropagationStopped: t => bool = "isPropagationStopped"; - [@bs.get] external target: t => Js.t({..}) = "target"; - [@bs.get] external timeStamp: t => float = "timeStamp"; - [@bs.get] external type_: t => string = "type"; - [@bs.send] external persist: t => unit = "persist"; - [@bs.get] external propertyName: t => string = "propertyName"; - [@bs.get] external pseudoElement: t => string = "pseudoElement"; - [@bs.get] external elapsedTime: t => float = "elapsedTime"; -}; diff --git a/vendor/reason-react/ReactEventRe.re b/vendor/reason-react/ReactEventRe.re deleted file mode 100644 index 57a3529..0000000 --- a/vendor/reason-react/ReactEventRe.re +++ /dev/null @@ -1,215 +0,0 @@ -type synthetic('a) = ReactEvent.synthetic('a); - -module MakeSyntheticWrapper = (Type: {type t;}) => { - [@bs.get] external bubbles: Type.t => bool = "bubbles"; - [@bs.get] external cancelable: Type.t => bool = "cancelable"; - [@bs.get] external currentTarget: Type.t => Dom.element = "currentTarget"; /* Should return Dom.evetTarget */ - [@bs.get] external defaultPrevented: Type.t => bool = "defaultPrevented"; - [@bs.get] external eventPhase: Type.t => int = "eventPhase"; - [@bs.get] external isTrusted: Type.t => bool = "isTrusted"; - [@bs.get] external nativeEvent: Type.t => Js.t({..}) = "nativeEvent"; /* Should return Dom.event */ - [@bs.send.pipe: Type.t] external preventDefault: unit = "preventDefault"; - [@bs.send.pipe: Type.t] - external isDefaultPrevented: bool = "isDefaultPrevented"; - [@bs.send.pipe: Type.t] external stopPropagation: unit = "stopPropagation"; - [@bs.send.pipe: Type.t] - external isPropagationStopped: bool = "isPropagationStopped"; - [@bs.get] external target: Type.t => Dom.element = "target"; /* Should return Dom.evetTarget */ - [@bs.get] external timeStamp: Type.t => float = "timeStamp"; - [@bs.get] external _type: Type.t => string = "type"; - [@bs.send.pipe: Type.t] external persist: unit = "persist"; -}; - -module Synthetic = { - type tag = ReactEvent.Synthetic.tag; - type t = ReactEvent.Synthetic.t; - [@bs.get] external bubbles: synthetic('a) => bool = "bubbles"; - [@bs.get] external cancelable: synthetic('a) => bool = "cancelable"; - [@bs.get] - external currentTarget: synthetic('a) => Dom.element = "currentTarget"; /* Should return Dom.evetTarget */ - [@bs.get] - external defaultPrevented: synthetic('a) => bool = "defaultPrevented"; - [@bs.get] external eventPhase: synthetic('a) => int = "eventPhase"; - [@bs.get] external isTrusted: synthetic('a) => bool = "isTrusted"; - [@bs.get] - external nativeEvent: synthetic('a) => Js.t({..}) = "nativeEvent"; /* Should return Dom.event */ - [@bs.send.pipe: synthetic('a)] - external preventDefault: unit = "preventDefault"; - [@bs.send.pipe: synthetic('a)] - external isDefaultPrevented: bool = "isDefaultPrevented"; - [@bs.send.pipe: synthetic('a)] - external stopPropagation: unit = "stopPropagation"; - [@bs.send.pipe: synthetic('a)] - external isPropagationStopped: bool = "isPropagationStopped"; - [@bs.get] external target: synthetic('a) => Dom.element = "target"; /* Should return Dom.evetTarget */ - [@bs.get] external timeStamp: synthetic('a) => float = "timeStamp"; - [@bs.get] external _type: synthetic('a) => string = "type"; - [@bs.send.pipe: synthetic('a)] external persist: unit = "persist"; -}; - -/* Cast any event type to the general synthetic type. This is safe, since synthetic is more general */ -external toSyntheticEvent: synthetic('a) => Synthetic.t = "%identity"; - -module Clipboard = { - type tag = ReactEvent.Clipboard.tag; - type t = ReactEvent.Clipboard.t; - include MakeSyntheticWrapper({ - type nonrec t = t; - }); - [@bs.get] external clipboardData: t => Js.t({..}) = "clipboardData"; /* Should return Dom.dataTransfer */ -}; - -module Composition = { - type tag = ReactEvent.Composition.tag; - type t = ReactEvent.Composition.t; - include MakeSyntheticWrapper({ - type nonrec t = t; - }); - [@bs.get] external data: t => string = "data"; -}; - -module Keyboard = { - type tag = ReactEvent.Keyboard.tag; - type t = ReactEvent.Keyboard.t; - include MakeSyntheticWrapper({ - type nonrec t = t; - }); - [@bs.get] external altKey: t => bool = "altKey"; - [@bs.get] external charCode: t => int = "charCode"; - [@bs.get] external ctrlKey: t => bool = "ctrlKey"; - [@bs.send.pipe: t] - external getModifierState: string => bool = "getModifierState"; - [@bs.get] external key: t => string = "key"; - [@bs.get] external keyCode: t => int = "keyCode"; - [@bs.get] external locale: t => string = "locale"; - [@bs.get] external location: t => int = "location"; - [@bs.get] external metaKey: t => bool = "metaKey"; - [@bs.get] external repeat: t => bool = "repeat"; - [@bs.get] external shiftKey: t => bool = "shiftKey"; - [@bs.get] external which: t => int = "which"; -}; - -module Focus = { - type tag = ReactEvent.Focus.tag; - type t = ReactEvent.Focus.t; - include MakeSyntheticWrapper({ - type nonrec t = t; - }); - [@bs.get] external relatedTarget: t => Dom.element = "relatedTarget"; /* Should return Dom.eventTarget */ -}; - -module Form = { - type tag = ReactEvent.Form.tag; - type t = ReactEvent.Form.t; - include MakeSyntheticWrapper({ - type nonrec t = t; - }); -}; - -module Mouse = { - type tag = ReactEvent.Mouse.tag; - type t = ReactEvent.Mouse.t; - include MakeSyntheticWrapper({ - type nonrec t = t; - }); - [@bs.get] external altKey: t => bool = "altKey"; - [@bs.get] external button: t => int = "button"; - [@bs.get] external buttons: t => int = "buttons"; - [@bs.get] external clientX: t => int = "clientX"; - [@bs.get] external clientY: t => int = "clientY"; - [@bs.get] external ctrlKey: t => bool = "ctrlKey"; - [@bs.send.pipe: t] - external getModifierState: string => bool = "getModifierState"; - [@bs.get] external metaKey: t => bool = "metaKey"; - [@bs.get] external pageX: t => int = "pageX"; - [@bs.get] external pageY: t => int = "pageY"; - [@bs.get] external relatedTarget: t => Dom.element = "relatedTarget"; /* Should return Dom.eventTarget */ - [@bs.get] external screenX: t => int = "screenX"; - [@bs.get] external screenY: t => int = "screenY"; - [@bs.get] external shiftKey: t => bool = "shiftKey"; -}; - -module Selection = { - type tag = ReactEvent.Selection.tag; - type t = ReactEvent.Selection.t; - include MakeSyntheticWrapper({ - type nonrec t = t; - }); -}; - -module Touch = { - type tag = ReactEvent.Touch.tag; - type t = ReactEvent.Touch.t; - include MakeSyntheticWrapper({ - type nonrec t = t; - }); - [@bs.get] external altKey: t => bool = "altKey"; - [@bs.get] external changedTouches: t => Js.t({..}) = "changedTouches"; /* Should return Dom.touchList */ - [@bs.get] external ctrlKey: t => bool = "ctrlKey"; - [@bs.send.pipe: t] - external getModifierState: string => bool = "getModifierState"; - [@bs.get] external metaKey: t => bool = "metaKey"; - [@bs.get] external shiftKey: t => bool = "shiftKey"; - [@bs.get] external targetTouches: t => Js.t({..}) = "targetTouches"; /* Should return Dom.touchList */ - [@bs.get] external touches: t => Js.t({..}) = "touches"; /* Should return Dom.touchList */ -}; - -module UI = { - type tag = ReactEvent.UI.tag; - type t = ReactEvent.UI.t; - include MakeSyntheticWrapper({ - type nonrec t = t; - }); - [@bs.get] external detail: t => int = "detail"; - [@bs.get] external view: t => Dom.window = "view"; /* Should return DOMAbstractView/WindowProxy */ -}; - -module Wheel = { - type tag = ReactEvent.Wheel.tag; - type t = ReactEvent.Wheel.t; - include MakeSyntheticWrapper({ - type nonrec t = t; - }); - [@bs.get] external deltaMode: t => int = "deltaMode"; - [@bs.get] external deltaX: t => float = "deltaX"; - [@bs.get] external deltaY: t => float = "deltaY"; - [@bs.get] external deltaZ: t => float = "deltaZ"; -}; - -module Media = { - type tag = ReactEvent.Media.tag; - type t = ReactEvent.Media.t; - include MakeSyntheticWrapper({ - type nonrec t = t; - }); -}; - -module Image = { - type tag = ReactEvent.Image.tag; - type t = ReactEvent.Image.t; - include MakeSyntheticWrapper({ - type nonrec t = t; - }); -}; - -module Animation = { - type tag = ReactEvent.Animation.tag; - type t = ReactEvent.Animation.t; - include MakeSyntheticWrapper({ - type nonrec t = t; - }); - [@bs.get] external animationName: t => string = "animationName"; - [@bs.get] external pseudoElement: t => string = "pseudoElement"; - [@bs.get] external elapsedTime: t => float = "elapsedTime"; -}; - -module Transition = { - type tag = ReactEvent.Transition.tag; - type t = ReactEvent.Transition.t; - include MakeSyntheticWrapper({ - type nonrec t = t; - }); - [@bs.get] external propertyName: t => string = "propertyName"; - [@bs.get] external pseudoElement: t => string = "pseudoElement"; - [@bs.get] external elapsedTime: t => float = "elapsedTime"; -}; diff --git a/vendor/reason-react/ReactEventRe.rei b/vendor/reason-react/ReactEventRe.rei deleted file mode 100644 index 214688c..0000000 --- a/vendor/reason-react/ReactEventRe.rei +++ /dev/null @@ -1,857 +0,0 @@ -/* Old code. See ReactEvent.re for documentation. */ -[@deprecated "Please use ReactEvent.synthetic"] -type synthetic('a) = ReactEvent.synthetic('a); - -module Synthetic: { - [@deprecated "Please use ReactEvent.Synthetic.tag"] - type tag = ReactEvent.Synthetic.tag; - [@deprecated "Please use ReactEvent.Synthetic.t"] - type t = ReactEvent.Synthetic.t; - [@deprecated "Please use ReactEvent.Synthetic.bubbles"] [@bs.get] - external bubbles: ReactEvent.synthetic('a) => bool = "bubbles"; - [@deprecated "Please use ReactEvent.Synthetic.cancelable"] [@bs.get] - external cancelable: ReactEvent.synthetic('a) => bool = "cancelable"; - [@deprecated - "Please use ReactEvent.Synthetic.currentTarget and remove the surrounding ReactDOMRe.domElementToObj wrapper if any (no longer needed)" - ] - [@bs.get] - external currentTarget: ReactEvent.synthetic('a) => Dom.element = - "currentTarget"; - [@deprecated "Please use ReactEvent.Synthetic.defaultPrevented"] [@bs.get] - external defaultPrevented: ReactEvent.synthetic('a) => bool = - "defaultPrevented"; - [@deprecated "Please use ReactEvent.Synthetic.eventPhase"] [@bs.get] - external eventPhase: ReactEvent.synthetic('a) => int = "eventPhase"; - [@deprecated "Please use ReactEvent.Synthetic.isTrusted"] [@bs.get] - external isTrusted: ReactEvent.synthetic('a) => bool = "isTrusted"; - [@deprecated "Please use ReactEvent.Synthetic.nativeEvent"] [@bs.get] - external nativeEvent: ReactEvent.synthetic('a) => Js.t({..}) = - "nativeEvent"; - [@deprecated "Please use myEvent->ReactEvent.Synthetic.preventDefault"] - [@bs.send.pipe: ReactEvent.synthetic('a)] - external preventDefault: unit = "preventDefault"; - [@deprecated "Please use myEvent->ReactEvent.Synthetic.isDefaultPrevented"] - [@bs.send.pipe: ReactEvent.synthetic('a)] - external isDefaultPrevented: bool = "isDefaultPrevented"; - [@deprecated "Please use myEvent->ReactEvent.Synthetic.stopPropagation"] - [@bs.send.pipe: ReactEvent.synthetic('a)] - external stopPropagation: unit = "stopPropagation"; - [@deprecated "Please use myEvent->ReactEvent.Synthetic.isPropagationStopped"] - [@bs.send.pipe: ReactEvent.synthetic('a)] - external isPropagationStopped: bool = "isPropagationStopped"; - [@deprecated - "Please use ReactEvent.Synthetic.target and remove the surrounding ReactDOMRe.domElementToObj wrapper if any (no longer needed)" - ] - [@bs.get] - external target: ReactEvent.synthetic('a) => Dom.element = "target"; - [@deprecated "Please use ReactEvent.Synthetic.timeStamp"] [@bs.get] - external timeStamp: ReactEvent.synthetic('a) => float = "timeStamp"; - [@deprecated "Please use ReactEvent.Synthetic.type_"] [@bs.get] - external _type: ReactEvent.synthetic('a) => string = "type"; - [@deprecated "Please use myEvent->ReactEvent.Synthetic.persist"] - [@bs.send.pipe: ReactEvent.synthetic('a)] - external persist: unit = "persist"; -}; - -/* Cast any event type to the general synthetic type. This is safe, since synthetic is more general */ -[@deprecated "Please use ReactEvent.toSyntheticEvent"] -external toSyntheticEvent: ReactEvent.synthetic('a) => ReactEvent.Synthetic.t = - "%identity"; - -module Clipboard: { - [@deprecated "Please use ReactEvent.Clipboard.tag"] - type tag = ReactEvent.Clipboard.tag; - [@deprecated "Please use ReactEvent.Clipboard.tag"] - type t = ReactEvent.Clipboard.t; - [@deprecated "Please use ReactEvent.Clipboard.bubbles"] [@bs.get] - external bubbles: ReactEvent.Clipboard.t => bool = "bubbles"; - [@deprecated "Please use ReactEvent.Clipboard.cancelable"] [@bs.get] - external cancelable: ReactEvent.Clipboard.t => bool = "cancelable"; - [@deprecated - "Please use ReactEvent.Clipboard.currentTarget and remove the surrounding ReactDOMRe.domElementToObj wrapper if any (no longer needed)" - ] - [@bs.get] - external currentTarget: ReactEvent.Clipboard.t => Dom.element = - "currentTarget"; - [@deprecated "Please use ReactEvent.Clipboard.defaultPrevented"] [@bs.get] - external defaultPrevented: ReactEvent.Clipboard.t => bool = - "defaultPrevented"; - [@deprecated "Please use ReactEvent.Clipboard.eventPhase"] [@bs.get] - external eventPhase: ReactEvent.Clipboard.t => int = "eventPhase"; - [@deprecated "Please use ReactEvent.Clipboard.isTrusted"] [@bs.get] - external isTrusted: ReactEvent.Clipboard.t => bool = "isTrusted"; - [@deprecated "Please use ReactEvent.Clipboard.nativeEvent"] [@bs.get] - external nativeEvent: ReactEvent.Clipboard.t => Js.t({..}) = "nativeEvent"; - [@deprecated "Please use myEvent->ReactEvent.Clipboard.preventDefault"] - [@bs.send.pipe: ReactEvent.Clipboard.t] - external preventDefault: unit = "preventDefault"; - [@deprecated "Please use myEvent->ReactEvent.Clipboard.isDefaultPrevented"] - [@bs.send.pipe: ReactEvent.Clipboard.t] - external isDefaultPrevented: bool = "isDefaultPrevented"; - [@deprecated "Please use myEvent->ReactEvent.Clipboard.stopPropagation"] - [@bs.send.pipe: ReactEvent.Clipboard.t] - external stopPropagation: unit = "stopPropagation"; - [@deprecated "Please use myEvent->ReactEvent.Clipboard.isPropagationStopped"] - [@bs.send.pipe: ReactEvent.Clipboard.t] - external isPropagationStopped: bool = "isPropagationStopped"; - [@deprecated - "Please use ReactEvent.Clipboard.target and remove the surrounding ReactDOMRe.domElementToObj wrapper if any (no longer needed)" - ] - [@bs.get] - external target: ReactEvent.Clipboard.t => Dom.element = "target"; - [@deprecated "Please use ReactEvent.Clipboard.timeStamp"] [@bs.get] - external timeStamp: ReactEvent.Clipboard.t => float = "timeStamp"; - [@deprecated "Please use ReactEvent.Clipboard.type_"] [@bs.get] - external _type: ReactEvent.Clipboard.t => string = "type"; - [@deprecated "Please use myEvent->ReactEvent.Clipboard.persist"] - [@bs.send.pipe: ReactEvent.Clipboard.t] - external persist: unit = "persist"; - [@deprecated "Please use ReactEvent.Clipboard.clipboardData"] [@bs.get] - external clipboardData: ReactEvent.Clipboard.t => Js.t({..}) = - "clipboardData"; /* Should return Dom.dataTransfer */ -}; - -module Composition: { - [@deprecated "Please use ReactEvent.Composition.tag"] - type tag = ReactEvent.Composition.tag; - [@deprecated "Please use ReactEvent.Composition.t"] - type t = ReactEvent.Composition.t; - [@deprecated "Please use ReactEvent.Composition.bubbles"] [@bs.get] - external bubbles: ReactEvent.Composition.t => bool = "bubbles"; - [@deprecated "Please use ReactEvent.Composition.cancelable"] [@bs.get] - external cancelable: ReactEvent.Composition.t => bool = "cancelable"; - [@deprecated - "Please use ReactEvent.Composition.currentTarget and remove the surrounding ReactDOMRe.domElementToObj wrapper if any (no longer needed)" - ] - [@bs.get] - external currentTarget: ReactEvent.Composition.t => Dom.element = - "currentTarget"; - [@deprecated "Please use ReactEvent.Composition.defaultPrevented"] [@bs.get] - external defaultPrevented: ReactEvent.Composition.t => bool = - "defaultPrevented"; - [@deprecated "Please use ReactEvent.Composition.eventPhase"] [@bs.get] - external eventPhase: ReactEvent.Composition.t => int = "eventPhase"; - [@deprecated "Please use ReactEvent.Composition.isTrusted"] [@bs.get] - external isTrusted: ReactEvent.Composition.t => bool = "isTrusted"; - [@deprecated "Please use ReactEvent.Composition.nativeEvent"] [@bs.get] - external nativeEvent: ReactEvent.Composition.t => Js.t({..}) = - "nativeEvent"; - [@deprecated "Please use myEvent->ReactEvent.Composition.preventDefault"] - [@bs.send.pipe: ReactEvent.Composition.t] - external preventDefault: unit = "preventDefault"; - [@deprecated "Please use myEvent->ReactEvent.Composition.isDefaultPrevented"] - [@bs.send.pipe: ReactEvent.Composition.t] - external isDefaultPrevented: bool = "isDefaultPrevented"; - [@deprecated "Please use myEvent->ReactEvent.Composition.stopPropagation"] - [@bs.send.pipe: ReactEvent.Composition.t] - external stopPropagation: unit = "stopPropagation"; - [@deprecated - "Please use myEvent->ReactEvent.Composition.isPropagationStopped" - ] - [@bs.send.pipe: ReactEvent.Composition.t] - external isPropagationStopped: bool = "isPropagationStopped"; - [@deprecated - "Please use ReactEvent.Composition.target and remove the surrounding ReactDOMRe.domElementToObj wrapper if any (no longer needed)" - ] - [@bs.get] - external target: ReactEvent.Composition.t => Dom.element = "target"; - [@deprecated "Please use ReactEvent.Composition.timeStamp"] [@bs.get] - external timeStamp: ReactEvent.Composition.t => float = "timeStamp"; - [@deprecated "Please use ReactEvent.Composition.type_"] [@bs.get] - external _type: ReactEvent.Composition.t => string = "type"; - [@deprecated "Please use myEvent->ReactEvent.Composition.persist"] - [@bs.send.pipe: ReactEvent.Composition.t] - external persist: unit = "persist"; - [@deprecated "Please use ReactEvent.Composition.data"] [@bs.get] - external data: ReactEvent.Composition.t => string = "data"; -}; - -module Keyboard: { - [@deprecated "Please use ReactEvent.Keyboard.tag"] - type tag = ReactEvent.Keyboard.tag; - [@deprecated "Please use ReactEvent.Keyboard.t"] - type t = ReactEvent.Keyboard.t; - [@deprecated "Please use ReactEvent.Keyboard.bubbles"] [@bs.get] - external bubbles: ReactEvent.Keyboard.t => bool = "bubbles"; - [@deprecated "Please use ReactEvent.Keyboard.cancelable"] [@bs.get] - external cancelable: ReactEvent.Keyboard.t => bool = "cancelable"; - [@deprecated - "Please use ReactEvent.Keyboard.currentTarget and remove the surrounding ReactDOMRe.domElementToObj wrapper if any (no longer needed)" - ] - [@bs.get] - external currentTarget: ReactEvent.Keyboard.t => Dom.element = - "currentTarget"; - [@deprecated "Please use ReactEvent.Keyboard.defaultPrevented"] [@bs.get] - external defaultPrevented: ReactEvent.Keyboard.t => bool = - "defaultPrevented"; - [@deprecated "Please use ReactEvent.Keyboard.eventPhase"] [@bs.get] - external eventPhase: ReactEvent.Keyboard.t => int = "eventPhase"; - [@deprecated "Please use ReactEvent.Keyboard.isTrusted"] [@bs.get] - external isTrusted: ReactEvent.Keyboard.t => bool = "isTrusted"; - [@deprecated "Please use ReactEvent.Keyboard.nativeEvent"] [@bs.get] - external nativeEvent: ReactEvent.Keyboard.t => Js.t({..}) = "nativeEvent"; - [@deprecated "Please use myEvent->ReactEvent.Keyboard.preventDefault"] - [@bs.send.pipe: ReactEvent.Keyboard.t] - external preventDefault: unit = "preventDefault"; - [@deprecated "Please use myEvent->ReactEvent.Keyboard.isDefaultPrevented"] - [@bs.send.pipe: ReactEvent.Keyboard.t] - external isDefaultPrevented: bool = "isDefaultPrevented"; - [@deprecated "Please use myEvent->ReactEvent.Keyboard.stopPropagation"] - [@bs.send.pipe: ReactEvent.Keyboard.t] - external stopPropagation: unit = "stopPropagation"; - [@deprecated "Please use myEvent->ReactEvent.Keyboard.isPropagationStopped"] - [@bs.send.pipe: ReactEvent.Keyboard.t] - external isPropagationStopped: bool = "isPropagationStopped"; - [@deprecated - "Please use ReactEvent.Keyboard.target and remove the surrounding ReactDOMRe.domElementToObj wrapper if any (no longer needed)" - ] - [@bs.get] - external target: ReactEvent.Keyboard.t => Dom.element = "target"; - [@deprecated "Please use ReactEvent.Keyboard.timeStamp"] [@bs.get] - external timeStamp: ReactEvent.Keyboard.t => float = "timeStamp"; - [@deprecated "Please use ReactEvent.Keyboard.type_"] [@bs.get] - external _type: ReactEvent.Keyboard.t => string = "type"; - [@deprecated "Please use myEvent->ReactEvent.Keyboard.persist"] - [@bs.send.pipe: ReactEvent.Keyboard.t] - external persist: unit = "persist"; - [@deprecated "Please use ReactEvent.Keyboard.altKey"] [@bs.get] - external altKey: ReactEvent.Keyboard.t => bool = "altKey"; - [@deprecated "Please use ReactEvent.Keyboard.charCode"] [@bs.get] - external charCode: ReactEvent.Keyboard.t => int = "charCode"; - [@deprecated "Please use ReactEvent.Keyboard.ctrlKey"] [@bs.get] - external ctrlKey: ReactEvent.Keyboard.t => bool = "ctrlKey"; - [@deprecated "Please use myEvent->ReactEvent.Keyboard.getModifierState"] - [@bs.send.pipe: ReactEvent.Keyboard.t] - external getModifierState: string => bool = "getModifierState"; - [@deprecated "Please use ReactEvent.Keyboard.key"] [@bs.get] - external key: ReactEvent.Keyboard.t => string = "key"; - [@deprecated "Please use ReactEvent.Keyboard.keyCode"] [@bs.get] - external keyCode: ReactEvent.Keyboard.t => int = "keyCode"; - [@deprecated "Please use ReactEvent.Keyboard.locale"] [@bs.get] - external locale: ReactEvent.Keyboard.t => string = "locale"; - [@deprecated "Please use ReactEvent.Keyboard.location"] [@bs.get] - external location: ReactEvent.Keyboard.t => int = "location"; - [@deprecated "Please use ReactEvent.Keyboard.metaKey"] [@bs.get] - external metaKey: ReactEvent.Keyboard.t => bool = "metaKey"; - [@deprecated "Please use ReactEvent.Keyboard.repeat"] [@bs.get] - external repeat: ReactEvent.Keyboard.t => bool = "repeat"; - [@deprecated "Please use ReactEvent.Keyboard.shiftKey"] [@bs.get] - external shiftKey: ReactEvent.Keyboard.t => bool = "shiftKey"; - [@deprecated "Please use ReactEvent.Keyboard.which"] [@bs.get] - external which: ReactEvent.Keyboard.t => int = "which"; -}; - -module Focus: { - [@deprecated "Please use ReactEvent.Focus.tag"] - type tag = ReactEvent.Focus.tag; - [@deprecated "Please use ReactEvent.Focus.t"] - type t = ReactEvent.Focus.t; - [@deprecated "Please use ReactEvent.Focus.bubbles"] [@bs.get] - external bubbles: ReactEvent.Focus.t => bool = "bubbles"; - [@deprecated "Please use ReactEvent.Focus.cancelable"] [@bs.get] - external cancelable: ReactEvent.Focus.t => bool = "cancelable"; - [@deprecated - "Please use ReactEvent.Focus.currentTarget and remove the surrounding ReactDOMRe.domElementToObj wrapper if any (no longer needed)" - ] - [@bs.get] - external currentTarget: ReactEvent.Focus.t => Dom.element = "currentTarget"; - [@deprecated "Please use ReactEvent.Focus.defaultPrevented"] [@bs.get] - external defaultPrevented: ReactEvent.Focus.t => bool = "defaultPrevented"; - [@deprecated "Please use ReactEvent.Focus.eventPhase"] [@bs.get] - external eventPhase: ReactEvent.Focus.t => int = "eventPhase"; - [@deprecated "Please use ReactEvent.Focus.isTrusted"] [@bs.get] - external isTrusted: ReactEvent.Focus.t => bool = "isTrusted"; - [@deprecated "Please use ReactEvent.Focus.nativeEvent"] [@bs.get] - external nativeEvent: ReactEvent.Focus.t => Js.t({..}) = "nativeEvent"; - [@deprecated "Please use myEvent->ReactEvent.Focus.preventDefault"] - [@bs.send.pipe: ReactEvent.Focus.t] - external preventDefault: unit = "preventDefault"; - [@deprecated "Please use myEvent->ReactEvent.Focus.isDefaultPrevented"] - [@bs.send.pipe: ReactEvent.Focus.t] - external isDefaultPrevented: bool = "isDefaultPrevented"; - [@deprecated "Please use myEvent->ReactEvent.Focus.stopPropagation"] - [@bs.send.pipe: ReactEvent.Focus.t] - external stopPropagation: unit = "stopPropagation"; - [@deprecated "Please use myEvent->ReactEvent.Focus.isPropagationStopped"] - [@bs.send.pipe: ReactEvent.Focus.t] - external isPropagationStopped: bool = "isPropagationStopped"; - [@deprecated - "Please use ReactEvent.Focus.target and remove the surrounding ReactDOMRe.domElementToObj wrapper if any (no longer needed)" - ] - [@bs.get] - external target: ReactEvent.Focus.t => Dom.element = "target"; - [@deprecated "Please use ReactEvent.Focus.timeStamp"] [@bs.get] - external timeStamp: ReactEvent.Focus.t => float = "timeStamp"; - [@deprecated "Please use ReactEvent.Focus.type_"] [@bs.get] - external _type: ReactEvent.Focus.t => string = "type"; - [@deprecated "Please use myEvent->ReactEvent.Focus.persist"] - [@bs.send.pipe: ReactEvent.Focus.t] - external persist: unit = "persist"; - [@deprecated - "Please use ReactEvent.Focus.relatedTarget and remove the surrounding ReactDOMRe.domElementToObj wrapper if any (no longer needed)" - ] - [@bs.get] - external relatedTarget: ReactEvent.Focus.t => Dom.element = "relatedTarget"; /* Should return Dom.eventTarget */ -}; - -module Form: { - [@deprecated "Please use ReactEvent.Form.tag"] - type tag = ReactEvent.Form.tag; - [@deprecated "Please use ReactEvent.Form.t"] - type t = ReactEvent.Form.t; - [@deprecated "Please use ReactEvent.Form.bubbles"] [@bs.get] - external bubbles: ReactEvent.Form.t => bool = "bubbles"; - [@deprecated "Please use ReactEvent.Form.cancelable"] [@bs.get] - external cancelable: ReactEvent.Form.t => bool = "cancelable"; - [@deprecated - "Please use ReactEvent.Form.currentTarget and remove the surrounding ReactDOMRe.domElementToObj wrapper if any (no longer needed)" - ] - [@bs.get] - external currentTarget: ReactEvent.Form.t => Dom.element = "currentTarget"; - [@deprecated "Please use ReactEvent.Form.defaultPrevented"] [@bs.get] - external defaultPrevented: ReactEvent.Form.t => bool = "defaultPrevented"; - [@deprecated "Please use ReactEvent.Form.eventPhase"] [@bs.get] - external eventPhase: ReactEvent.Form.t => int = "eventPhase"; - [@deprecated "Please use ReactEvent.Form.isTrusted"] [@bs.get] - external isTrusted: ReactEvent.Form.t => bool = "isTrusted"; - [@deprecated "Please use ReactEvent.Form.nativeEvent"] [@bs.get] - external nativeEvent: ReactEvent.Form.t => Js.t({..}) = "nativeEvent"; - [@deprecated "Please use myEvent->ReactEvent.Form.preventDefault"] - [@bs.send.pipe: ReactEvent.Form.t] - external preventDefault: unit = "preventDefault"; - [@deprecated "Please use myEvent->ReactEvent.Form.isDefaultPrevented"] - [@bs.send.pipe: ReactEvent.Form.t] - external isDefaultPrevented: bool = "isDefaultPrevented"; - [@deprecated "Please use myEvent->ReactEvent.Form.stopPropagation"] - [@bs.send.pipe: ReactEvent.Form.t] - external stopPropagation: unit = "stopPropagation"; - [@deprecated "Please use myEvent->ReactEvent.Form.isPropagationStopped"] - [@bs.send.pipe: ReactEvent.Form.t] - external isPropagationStopped: bool = "isPropagationStopped"; - [@deprecated - "Please use ReactEvent.Form.target and remove the surrounding ReactDOMRe.domElementToObj wrapper if any (no longer needed)" - ] - [@bs.get] - external target: ReactEvent.Form.t => Dom.element = "target"; - [@deprecated "Please use ReactEvent.Form.timeStamp"] [@bs.get] - external timeStamp: ReactEvent.Form.t => float = "timeStamp"; - [@deprecated "Please use ReactEvent.Form.type_"] [@bs.get] - external _type: ReactEvent.Form.t => string = "type"; - [@deprecated "Please use myEvent->ReactEvent.Form.persist"] - [@bs.send.pipe: ReactEvent.Form.t] - external persist: unit = "persist"; -}; - -module Mouse: { - [@deprecated "Please use ReactEvent.Mouse.tag"] - type tag = ReactEvent.Mouse.tag; - [@deprecated "Please use ReactEvent.Mouse.t"] - type t = ReactEvent.Mouse.t; - [@deprecated "Please use ReactEvent.Mouse.bubbles"] [@bs.get] - external bubbles: ReactEvent.Mouse.t => bool = "bubbles"; - [@deprecated "Please use ReactEvent.Mouse.cancelable"] [@bs.get] - external cancelable: ReactEvent.Mouse.t => bool = "cancelable"; - [@deprecated - "Please use ReactEvent.Mouse.currentTarget and remove the surrounding ReactDOMRe.domElementToObj wrapper if any (no longer needed)" - ] - [@bs.get] - external currentTarget: ReactEvent.Mouse.t => Dom.element = "currentTarget"; - [@deprecated "Please use ReactEvent.Mouse.defaultPrevented"] [@bs.get] - external defaultPrevented: ReactEvent.Mouse.t => bool = "defaultPrevented"; - [@deprecated "Please use ReactEvent.Mouse.eventPhase"] [@bs.get] - external eventPhase: ReactEvent.Mouse.t => int = "eventPhase"; - [@deprecated "Please use ReactEvent.Mouse.isTrusted"] [@bs.get] - external isTrusted: ReactEvent.Mouse.t => bool = "isTrusted"; - [@deprecated "Please use ReactEvent.Mouse.nativeEvent"] [@bs.get] - external nativeEvent: ReactEvent.Mouse.t => Js.t({..}) = "nativeEvent"; - [@deprecated "Please use myEvent->ReactEvent.Mouse.preventDefault"] - [@bs.send.pipe: ReactEvent.Mouse.t] - external preventDefault: unit = "preventDefault"; - [@deprecated "Please use myEvent->ReactEvent.Mouse.isDefaultPrevented"] - [@bs.send.pipe: ReactEvent.Mouse.t] - external isDefaultPrevented: bool = "isDefaultPrevented"; - [@deprecated "Please use myEvent->ReactEvent.Mouse.stopPropagation"] - [@bs.send.pipe: ReactEvent.Mouse.t] - external stopPropagation: unit = "stopPropagation"; - [@deprecated "Please use myEvent->ReactEvent.Mouse.isPropagationStopped"] - [@bs.send.pipe: ReactEvent.Mouse.t] - external isPropagationStopped: bool = "isPropagationStopped"; - [@deprecated - "Please use ReactEvent.Mouse.target and remove the surrounding ReactDOMRe.domElementToObj wrapper if any (no longer needed)" - ] - [@bs.get] - external target: ReactEvent.Mouse.t => Dom.element = "target"; - [@deprecated "Please use ReactEvent.Mouse.timeStamp"] [@bs.get] - external timeStamp: ReactEvent.Mouse.t => float = "timeStamp"; - [@deprecated "Please use ReactEvent.Mouse.type_"] [@bs.get] - external _type: ReactEvent.Mouse.t => string = "type"; - [@deprecated "Please use myEvent->ReactEvent.Mouse.persist"] - [@bs.send.pipe: ReactEvent.Mouse.t] - external persist: unit = "persist"; - [@deprecated "Please use ReactEvent.Mouse.altKey"] [@bs.get] - external altKey: ReactEvent.Mouse.t => bool = "altKey"; - [@deprecated "Please use ReactEvent.Mouse.button"] [@bs.get] - external button: ReactEvent.Mouse.t => int = "button"; - [@deprecated "Please use ReactEvent.Mouse.buttons"] [@bs.get] - external buttons: ReactEvent.Mouse.t => int = "buttons"; - [@deprecated "Please use ReactEvent.Mouse.clientX"] [@bs.get] - external clientX: ReactEvent.Mouse.t => int = "clientX"; - [@deprecated "Please use ReactEvent.Mouse.clientY"] [@bs.get] - external clientY: ReactEvent.Mouse.t => int = "clientY"; - [@deprecated "Please use ReactEvent.Mouse.ctrlKey"] [@bs.get] - external ctrlKey: ReactEvent.Mouse.t => bool = "ctrlKey"; - [@deprecated "Please use myEvent->ReactEvent.Mouse.getModifierState"] - [@bs.send.pipe: ReactEvent.Mouse.t] - external getModifierState: string => bool = "getModifierState"; - [@deprecated "Please use ReactEvent.Mouse.metaKey"] [@bs.get] - external metaKey: ReactEvent.Mouse.t => bool = "metaKey"; - [@deprecated "Please use ReactEvent.Mouse.pageX"] [@bs.get] - external pageX: ReactEvent.Mouse.t => int = "pageX"; - [@deprecated "Please use ReactEvent.Mouse.pageY"] [@bs.get] - external pageY: ReactEvent.Mouse.t => int = "pageY"; - [@deprecated - "Please use ReactEvent.Mouse.relatedTarget and remove the surrounding ReactDOMRe.domElementToObj wrapper if any (no longer needed)" - ] - [@bs.get] - external relatedTarget: ReactEvent.Mouse.t => Dom.element = "relatedTarget"; /* Should return Dom.eventTarget */ - [@deprecated "Please use ReactEvent.Mouse.screenX"] [@bs.get] - external screenX: ReactEvent.Mouse.t => int = "screenX"; - [@deprecated "Please use ReactEvent.Mouse.screenY"] [@bs.get] - external screenY: ReactEvent.Mouse.t => int = "screenY"; - [@deprecated "Please use ReactEvent.Mouse.shiftKey"] [@bs.get] - external shiftKey: ReactEvent.Mouse.t => bool = "shiftKey"; -}; - -module Selection: { - [@deprecated "Please use ReactEvent.Selection.tag"] - type tag = ReactEvent.Selection.tag; - [@deprecated "Please use ReactEvent.Selection.t"] - type t = ReactEvent.Selection.t; - [@deprecated "Please use ReactEvent.Selection.bubbles"] [@bs.get] - external bubbles: ReactEvent.Selection.t => bool = "bubbles"; - [@deprecated "Please use ReactEvent.Selection.cancelable"] [@bs.get] - external cancelable: ReactEvent.Selection.t => bool = "cancelable"; - [@deprecated - "Please use ReactEvent.Selection.currentTarget and remove the surrounding ReactDOMRe.domElementToObj wrapper if any (no longer needed)" - ] - [@bs.get] - external currentTarget: ReactEvent.Selection.t => Dom.element = - "currentTarget"; - [@deprecated "Please use ReactEvent.Selection.defaultPrevented"] [@bs.get] - external defaultPrevented: ReactEvent.Selection.t => bool = - "defaultPrevented"; - [@deprecated "Please use ReactEvent.Selection.eventPhase"] [@bs.get] - external eventPhase: ReactEvent.Selection.t => int = "eventPhase"; - [@deprecated "Please use ReactEvent.Selection.isTrusted"] [@bs.get] - external isTrusted: ReactEvent.Selection.t => bool = "isTrusted"; - [@deprecated "Please use ReactEvent.Selection.nativeEvent"] [@bs.get] - external nativeEvent: ReactEvent.Selection.t => Js.t({..}) = "nativeEvent"; - [@deprecated "Please use myEvent->ReactEvent.Selection.preventDefault"] - [@bs.send.pipe: ReactEvent.Selection.t] - external preventDefault: unit = "preventDefault"; - [@deprecated "Please use myEvent->ReactEvent.Selection.isDefaultPrevented"] - [@bs.send.pipe: ReactEvent.Selection.t] - external isDefaultPrevented: bool = "isDefaultPrevented"; - [@deprecated "Please use myEvent->ReactEvent.Selection.stopPropagation"] - [@bs.send.pipe: ReactEvent.Selection.t] - external stopPropagation: unit = "stopPropagation"; - [@deprecated "Please use myEvent->ReactEvent.Selection.isPropagationStopped"] - [@bs.send.pipe: ReactEvent.Selection.t] - external isPropagationStopped: bool = "isPropagationStopped"; - [@deprecated - "Please use ReactEvent.Selection.target and remove the surrounding ReactDOMRe.domElementToObj wrapper if any (no longer needed)" - ] - [@bs.get] - external target: ReactEvent.Selection.t => Dom.element = "target"; - [@deprecated "Please use ReactEvent.Selection.timeStamp"] [@bs.get] - external timeStamp: ReactEvent.Selection.t => float = "timeStamp"; - [@deprecated "Please use ReactEvent.Selection.type_"] [@bs.get] - external _type: ReactEvent.Selection.t => string = "type"; - [@deprecated "Please use myEvent->ReactEvent.Selection.persist"] - [@bs.send.pipe: ReactEvent.Selection.t] - external persist: unit = "persist"; -}; - -module Touch: { - [@deprecated "Please use ReactEvent.Touch.tag"] - type tag = ReactEvent.Touch.tag; - [@deprecated "Please use ReactEvent.Touch.t"] - type t = ReactEvent.Touch.t; - [@deprecated "Please use ReactEvent.Touch.bubbles"] [@bs.get] - external bubbles: ReactEvent.Touch.t => bool = "bubbles"; - [@deprecated "Please use ReactEvent.Touch.cancelable"] [@bs.get] - external cancelable: ReactEvent.Touch.t => bool = "cancelable"; - [@deprecated - "Please use ReactEvent.Touch.currentTarget and remove the surrounding ReactDOMRe.domElementToObj wrapper if any (no longer needed)" - ] - [@bs.get] - external currentTarget: ReactEvent.Touch.t => Dom.element = "currentTarget"; - [@deprecated "Please use ReactEvent.Touch.defaultPrevented"] [@bs.get] - external defaultPrevented: ReactEvent.Touch.t => bool = "defaultPrevented"; - [@deprecated "Please use ReactEvent.Touch.eventPhase"] [@bs.get] - external eventPhase: ReactEvent.Touch.t => int = "eventPhase"; - [@deprecated "Please use ReactEvent.Touch.isTrusted"] [@bs.get] - external isTrusted: ReactEvent.Touch.t => bool = "isTrusted"; - [@deprecated "Please use ReactEvent.Touch.nativeEvent"] [@bs.get] - external nativeEvent: ReactEvent.Touch.t => Js.t({..}) = "nativeEvent"; - [@deprecated "Please use myEvent->ReactEvent.Touch.preventDefault"] - [@bs.send.pipe: ReactEvent.Touch.t] - external preventDefault: unit = "preventDefault"; - [@deprecated "Please use myEvent->ReactEvent.Touch.isDefaultPrevented"] - [@bs.send.pipe: ReactEvent.Touch.t] - external isDefaultPrevented: bool = "isDefaultPrevented"; - [@deprecated "Please use myEvent->ReactEvent.Touch.stopPropagation"] - [@bs.send.pipe: ReactEvent.Touch.t] - external stopPropagation: unit = "stopPropagation"; - [@deprecated "Please use myEvent->ReactEvent.Touch.isPropagationStopped"] - [@bs.send.pipe: ReactEvent.Touch.t] - external isPropagationStopped: bool = "isPropagationStopped"; - [@deprecated - "Please use ReactEvent.Touch.target and remove the surrounding ReactDOMRe.domElementToObj wrapper if any (no longer needed)" - ] - [@bs.get] - external target: ReactEvent.Touch.t => Dom.element = "target"; - [@deprecated "Please use ReactEvent.Touch.timeStamp"] [@bs.get] - external timeStamp: ReactEvent.Touch.t => float = "timeStamp"; - [@deprecated "Please use ReactEvent.Touch.type_"] [@bs.get] - external _type: ReactEvent.Touch.t => string = "type"; - [@deprecated "Please use myEvent->ReactEvent.Touch.persist"] - [@bs.send.pipe: ReactEvent.Touch.t] - external persist: unit = "persist"; - [@deprecated "Please use ReactEvent.Touch.altKey"] [@bs.get] - external altKey: ReactEvent.Touch.t => bool = "altKey"; - [@deprecated "Please use ReactEvent.Touch.changedTouches"] [@bs.get] - external changedTouches: ReactEvent.Touch.t => Js.t({..}) = - "changedTouches"; /* Should return Dom.touchList */ - [@deprecated "Please use ReactEvent.Touch.ctrlKey"] [@bs.get] - external ctrlKey: ReactEvent.Touch.t => bool = "ctrlKey"; - [@deprecated "Please use myEvent->ReactEvent.Touch.getModifierState"] - [@bs.send.pipe: ReactEvent.Touch.t] - external getModifierState: string => bool = "getModifierState"; - [@deprecated "Please use ReactEvent.Touch.metaKey"] [@bs.get] - external metaKey: ReactEvent.Touch.t => bool = "metaKey"; - [@deprecated "Please use ReactEvent.Touch.shiftKey"] [@bs.get] - external shiftKey: ReactEvent.Touch.t => bool = "shiftKey"; - [@deprecated "Please use ReactEvent.Touch.targetTouches"] [@bs.get] - external targetTouches: ReactEvent.Touch.t => Js.t({..}) = "targetTouches"; /* Should return Dom.touchList */ - [@deprecated "Please use ReactEvent.Touch.touches"] [@bs.get] - external touches: ReactEvent.Touch.t => Js.t({..}) = "touches"; /* Should return Dom.touchList */ -}; - -module UI: { - [@deprecated "Please use ReactEvent.UI.tag"] - type tag = ReactEvent.UI.tag; - [@deprecated "Please use ReactEvent.UI.t"] - type t = ReactEvent.UI.t; - [@deprecated "Please use ReactEvent.UI.bubbles"] [@bs.get] - external bubbles: ReactEvent.UI.t => bool = "bubbles"; - [@deprecated "Please use ReactEvent.UI.cancelable"] [@bs.get] - external cancelable: ReactEvent.UI.t => bool = "cancelable"; - [@deprecated - "Please use ReactEvent.UI.currentTarget and remove the surrounding ReactDOMRe.domElementToObj wrapper if any (no longer needed)" - ] - [@bs.get] - external currentTarget: ReactEvent.UI.t => Dom.element = "currentTarget"; - [@deprecated "Please use ReactEvent.UI.defaultPrevented"] [@bs.get] - external defaultPrevented: ReactEvent.UI.t => bool = "defaultPrevented"; - [@deprecated "Please use ReactEvent.UI.eventPhase"] [@bs.get] - external eventPhase: ReactEvent.UI.t => int = "eventPhase"; - [@deprecated "Please use ReactEvent.UI.isTrusted"] [@bs.get] - external isTrusted: ReactEvent.UI.t => bool = "isTrusted"; - [@deprecated "Please use ReactEvent.UI.nativeEvent"] [@bs.get] - external nativeEvent: ReactEvent.UI.t => Js.t({..}) = "nativeEvent"; - [@deprecated "Please use myEvent->ReactEvent.UI.preventDefault"] - [@bs.send.pipe: ReactEvent.UI.t] - external preventDefault: unit = "preventDefault"; - [@deprecated "Please use myEvent->ReactEvent.UI.isDefaultPrevented"] - [@bs.send.pipe: ReactEvent.UI.t] - external isDefaultPrevented: bool = "isDefaultPrevented"; - [@deprecated "Please use myEvent->ReactEvent.UI.stopPropagation"] - [@bs.send.pipe: ReactEvent.UI.t] - external stopPropagation: unit = "stopPropagation"; - [@deprecated "Please use myEvent->ReactEvent.UI.isPropagationStopped"] - [@bs.send.pipe: ReactEvent.UI.t] - external isPropagationStopped: bool = "isPropagationStopped"; - [@deprecated - "Please use ReactEvent.UI.target and remove the surrounding ReactDOMRe.domElementToObj wrapper if any (no longer needed)" - ] - [@bs.get] - external target: ReactEvent.UI.t => Dom.element = "target"; - [@deprecated "Please use ReactEvent.UI.timeStamp"] [@bs.get] - external timeStamp: ReactEvent.UI.t => float = "timeStamp"; - [@deprecated "Please use ReactEvent.UI.type_"] [@bs.get] - external _type: ReactEvent.UI.t => string = "type"; - [@deprecated "Please use myEvent->ReactEvent.UI.persist"] - [@bs.send.pipe: ReactEvent.UI.t] - external persist: unit = "persist"; - [@deprecated "Please use ReactEvent.UI.detail"] [@bs.get] - external detail: ReactEvent.UI.t => int = "detail"; - [@deprecated "Please use ReactEvent.UI.view"] [@bs.get] - external view: ReactEvent.UI.t => Dom.window = "view"; /* Should return DOMAbstractView/WindowProxy */ -}; - -module Wheel: { - [@deprecated "Please use ReactEvent.Wheel.tag"] - type tag = ReactEvent.Wheel.tag; - [@deprecated "Please use ReactEvent.Wheel.t"] - type t = ReactEvent.Wheel.t; - [@deprecated "Please use ReactEvent.Wheel.bubbles"] [@bs.get] - external bubbles: ReactEvent.Wheel.t => bool = "bubbles"; - [@deprecated "Please use ReactEvent.Wheel.cancelable"] [@bs.get] - external cancelable: ReactEvent.Wheel.t => bool = "cancelable"; - [@deprecated - "Please use ReactEvent.Wheel.currentTarget and remove the surrounding ReactDOMRe.domElementToObj wrapper if any (no longer needed)" - ] - [@bs.get] - external currentTarget: ReactEvent.Wheel.t => Dom.element = "currentTarget"; - [@deprecated "Please use ReactEvent.Wheel.defaultPrevented"] [@bs.get] - external defaultPrevented: ReactEvent.Wheel.t => bool = "defaultPrevented"; - [@deprecated "Please use ReactEvent.Wheel.eventPhase"] [@bs.get] - external eventPhase: ReactEvent.Wheel.t => int = "eventPhase"; - [@deprecated "Please use ReactEvent.Wheel.isTrusted"] [@bs.get] - external isTrusted: ReactEvent.Wheel.t => bool = "isTrusted"; - [@deprecated "Please use ReactEvent.Wheel.nativeEvent"] [@bs.get] - external nativeEvent: ReactEvent.Wheel.t => Js.t({..}) = "nativeEvent"; - [@deprecated "Please use myEvent->ReactEvent.Wheel.preventDefault"] - [@bs.send.pipe: ReactEvent.Wheel.t] - external preventDefault: unit = "preventDefault"; - [@deprecated "Please use myEvent->ReactEvent.Wheel.isDefaultPrevented"] - [@bs.send.pipe: ReactEvent.Wheel.t] - external isDefaultPrevented: bool = "isDefaultPrevented"; - [@deprecated "Please use myEvent->ReactEvent.Wheel.stopPropagation"] - [@bs.send.pipe: ReactEvent.Wheel.t] - external stopPropagation: unit = "stopPropagation"; - [@deprecated "Please use myEvent->ReactEvent.Wheel.isPropagationStopped"] - [@bs.send.pipe: ReactEvent.Wheel.t] - external isPropagationStopped: bool = "isPropagationStopped"; - [@deprecated - "Please use ReactEvent.Wheel.target and remove the surrounding ReactDOMRe.domElementToObj wrapper if any (no longer needed)" - ] - [@bs.get] - external target: ReactEvent.Wheel.t => Dom.element = "target"; - [@deprecated "Please use ReactEvent.Wheel.timeStamp"] [@bs.get] - external timeStamp: ReactEvent.Wheel.t => float = "timeStamp"; - [@deprecated "Please use ReactEvent.Wheel.type_"] [@bs.get] - external _type: ReactEvent.Wheel.t => string = "type"; - [@deprecated "Please use myEvent->ReactEvent.Wheel.persist"] - [@bs.send.pipe: ReactEvent.Wheel.t] - external persist: unit = "persist"; - [@deprecated "Please use ReactEvent.Wheel.deltaMode"] [@bs.get] - external deltaMode: ReactEvent.Wheel.t => int = "deltaMode"; - [@deprecated "Please use ReactEvent.Wheel.deltaX"] [@bs.get] - external deltaX: ReactEvent.Wheel.t => float = "deltaX"; - [@deprecated "Please use ReactEvent.Wheel.deltaY"] [@bs.get] - external deltaY: ReactEvent.Wheel.t => float = "deltaY"; - [@deprecated "Please use ReactEvent.Wheel.deltaZ"] [@bs.get] - external deltaZ: ReactEvent.Wheel.t => float = "deltaZ"; -}; - -module Media: { - [@deprecated "Please use ReactEvent.Media.tag"] - type tag = ReactEvent.Media.tag; - [@deprecated "Please use ReactEvent.Media.t"] - type t = ReactEvent.Media.t; - [@deprecated "Please use ReactEvent.Media.bubbles"] [@bs.get] - external bubbles: ReactEvent.Media.t => bool = "bubbles"; - [@deprecated "Please use ReactEvent.Media.cancelable"] [@bs.get] - external cancelable: ReactEvent.Media.t => bool = "cancelable"; - [@deprecated - "Please use ReactEvent.Media.currentTarget and remove the surrounding ReactDOMRe.domElementToObj wrapper if any (no longer needed)" - ] - [@bs.get] - external currentTarget: ReactEvent.Media.t => Dom.element = "currentTarget"; - [@deprecated "Please use ReactEvent.Media.defaultPrevented"] [@bs.get] - external defaultPrevented: ReactEvent.Media.t => bool = "defaultPrevented"; - [@deprecated "Please use ReactEvent.Media.eventPhase"] [@bs.get] - external eventPhase: ReactEvent.Media.t => int = "eventPhase"; - [@deprecated "Please use ReactEvent.Media.isTrusted"] [@bs.get] - external isTrusted: ReactEvent.Media.t => bool = "isTrusted"; - [@deprecated "Please use ReactEvent.Media.nativeEvent"] [@bs.get] - external nativeEvent: ReactEvent.Media.t => Js.t({..}) = "nativeEvent"; - [@deprecated "Please use myEvent->ReactEvent.Media.preventDefault"] - [@bs.send.pipe: ReactEvent.Media.t] - external preventDefault: unit = "preventDefault"; - [@deprecated "Please use myEvent->ReactEvent.Media.isDefaultPrevented"] - [@bs.send.pipe: ReactEvent.Media.t] - external isDefaultPrevented: bool = "isDefaultPrevented"; - [@deprecated "Please use myEvent->ReactEvent.Media.stopPropagation"] - [@bs.send.pipe: ReactEvent.Media.t] - external stopPropagation: unit = "stopPropagation"; - [@deprecated "Please use myEvent->ReactEvent.Media.isPropagationStopped"] - [@bs.send.pipe: ReactEvent.Media.t] - external isPropagationStopped: bool = "isPropagationStopped"; - [@deprecated - "Please use ReactEvent.Media.target and remove the surrounding ReactDOMRe.domElementToObj wrapper if any (no longer needed)" - ] - [@bs.get] - external target: ReactEvent.Media.t => Dom.element = "target"; - [@deprecated "Please use ReactEvent.Media.timeStamp"] [@bs.get] - external timeStamp: ReactEvent.Media.t => float = "timeStamp"; - [@deprecated "Please use ReactEvent.Media.type_"] [@bs.get] - external _type: ReactEvent.Media.t => string = "type"; - [@deprecated "Please use myEvent->ReactEvent.Media.persist"] - [@bs.send.pipe: ReactEvent.Media.t] - external persist: unit = "persist"; -}; - -module Image: { - [@deprecated "Please use ReactEvent.Image.tag"] - type tag = ReactEvent.Image.tag; - [@deprecated "Please use ReactEvent.Image.t"] - type t = ReactEvent.Image.t; - [@deprecated "Please use ReactEvent.Image.bubbles"] [@bs.get] - external bubbles: ReactEvent.Image.t => bool = "bubbles"; - [@deprecated "Please use ReactEvent.Image.cancelable"] [@bs.get] - external cancelable: ReactEvent.Image.t => bool = "cancelable"; - [@deprecated - "Please use ReactEvent.Image.currentTarget and remove the surrounding ReactDOMRe.domElementToObj wrapper if any (no longer needed)" - ] - [@bs.get] - external currentTarget: ReactEvent.Image.t => Dom.element = "currentTarget"; - [@deprecated "Please use ReactEvent.Image.defaultPrevented"] [@bs.get] - external defaultPrevented: ReactEvent.Image.t => bool = "defaultPrevented"; - [@deprecated "Please use ReactEvent.Image.eventPhase"] [@bs.get] - external eventPhase: ReactEvent.Image.t => int = "eventPhase"; - [@deprecated "Please use ReactEvent.Image.isTrusted"] [@bs.get] - external isTrusted: ReactEvent.Image.t => bool = "isTrusted"; - [@deprecated "Please use ReactEvent.Image.nativeEvent"] [@bs.get] - external nativeEvent: ReactEvent.Image.t => Js.t({..}) = "nativeEvent"; - [@deprecated "Please use myEvent->ReactEvent.Image.preventDefault"] - [@bs.send.pipe: ReactEvent.Image.t] - external preventDefault: unit = "preventDefault"; - [@deprecated "Please use myEvent->ReactEvent.Image.isDefaultPrevented"] - [@bs.send.pipe: ReactEvent.Image.t] - external isDefaultPrevented: bool = "isDefaultPrevented"; - [@deprecated "Please use myEvent->ReactEvent.Image.stopPropagation"] - [@bs.send.pipe: ReactEvent.Image.t] - external stopPropagation: unit = "stopPropagation"; - [@deprecated "Please use myEvent->ReactEvent.Image.isPropagationStopped"] - [@bs.send.pipe: ReactEvent.Image.t] - external isPropagationStopped: bool = "isPropagationStopped"; - [@deprecated - "Please use ReactEvent.Image.target and remove the surrounding ReactDOMRe.domElementToObj wrapper if any (no longer needed)" - ] - [@bs.get] - external target: ReactEvent.Image.t => Dom.element = "target"; - [@deprecated "Please use ReactEvent.Image.timeStamp"] [@bs.get] - external timeStamp: ReactEvent.Image.t => float = "timeStamp"; - [@deprecated "Please use ReactEvent.Image.type_"] [@bs.get] - external _type: ReactEvent.Image.t => string = "type"; - [@deprecated "Please use myEvent->ReactEvent.Image.persist"] - [@bs.send.pipe: ReactEvent.Image.t] - external persist: unit = "persist"; -}; - -module Animation: { - [@deprecated "Please use ReactEvent.Animation.tag"] - type tag = ReactEvent.Animation.tag; - [@deprecated "Please use ReactEvent.Animation.t"] - type t = ReactEvent.Animation.t; - [@deprecated "Please use ReactEvent.Animation.bubbles"] [@bs.get] - external bubbles: ReactEvent.Animation.t => bool = "bubbles"; - [@deprecated "Please use ReactEvent.Animation.cancelable"] [@bs.get] - external cancelable: ReactEvent.Animation.t => bool = "cancelable"; - [@deprecated - "Please use ReactEvent.Animation.currentTarget and remove the surrounding ReactDOMRe.domElementToObj wrapper if any (no longer needed)" - ] - [@bs.get] - external currentTarget: ReactEvent.Animation.t => Dom.element = - "currentTarget"; - [@deprecated "Please use ReactEvent.Animation.defaultPrevented"] [@bs.get] - external defaultPrevented: ReactEvent.Animation.t => bool = - "defaultPrevented"; - [@deprecated "Please use ReactEvent.Animation.eventPhase"] [@bs.get] - external eventPhase: ReactEvent.Animation.t => int = "eventPhase"; - [@deprecated "Please use ReactEvent.Animation.isTrusted"] [@bs.get] - external isTrusted: ReactEvent.Animation.t => bool = "isTrusted"; - [@deprecated "Please use ReactEvent.Animation.nativeEvent"] [@bs.get] - external nativeEvent: ReactEvent.Animation.t => Js.t({..}) = "nativeEvent"; - [@deprecated "Please use myEvent->ReactEvent.Animation.preventDefault"] - [@bs.send.pipe: ReactEvent.Animation.t] - external preventDefault: unit = "preventDefault"; - [@deprecated "Please use myEvent->ReactEvent.Animation.isDefaultPrevented"] - [@bs.send.pipe: ReactEvent.Animation.t] - external isDefaultPrevented: bool = "isDefaultPrevented"; - [@deprecated "Please use myEvent->ReactEvent.Animation.stopPropagation"] - [@bs.send.pipe: ReactEvent.Animation.t] - external stopPropagation: unit = "stopPropagation"; - [@deprecated "Please use myEvent->ReactEvent.Animation.isPropagationStopped"] - [@bs.send.pipe: ReactEvent.Animation.t] - external isPropagationStopped: bool = "isPropagationStopped"; - [@deprecated - "Please use ReactEvent.Animation.target and remove the surrounding ReactDOMRe.domElementToObj wrapper if any (no longer needed)" - ] - [@bs.get] - external target: ReactEvent.Animation.t => Dom.element = "target"; - [@deprecated "Please use ReactEvent.Animation.timeStamp"] [@bs.get] - external timeStamp: ReactEvent.Animation.t => float = "timeStamp"; - [@deprecated "Please use ReactEvent.Animation.type_"] [@bs.get] - external _type: ReactEvent.Animation.t => string = "type"; - [@deprecated "Please use myEvent->ReactEvent.Animation.persist"] - [@bs.send.pipe: ReactEvent.Animation.t] - external persist: unit = "persist"; - [@deprecated "Please use ReactEvent.Animation.animationName"] [@bs.get] - external animationName: ReactEvent.Animation.t => string = "animationName"; - [@deprecated "Please use ReactEvent.Animation.pseudoElement"] [@bs.get] - external pseudoElement: ReactEvent.Animation.t => string = "pseudoElement"; - [@deprecated "Please use ReactEvent.Animation.elapsedTime"] [@bs.get] - external elapsedTime: ReactEvent.Animation.t => float = "elapsedTime"; -}; - -module Transition: { - [@deprecated "Please use ReactEvent.Transition.tag"] - type tag = ReactEvent.Transition.tag; - [@deprecated "Please use ReactEvent.Transition.t"] - type t = ReactEvent.Transition.t; - [@deprecated "Please use ReactEvent.Transition.bubbles"] [@bs.get] - external bubbles: ReactEvent.Transition.t => bool = "bubbles"; - [@deprecated "Please use ReactEvent.Transition.cancelable"] [@bs.get] - external cancelable: ReactEvent.Transition.t => bool = "cancelable"; - [@deprecated - "Please use ReactEvent.Transition.currentTarget and remove the surrounding ReactDOMRe.domElementToObj wrapper if any (no longer needed)" - ] - [@bs.get] - external currentTarget: ReactEvent.Transition.t => Dom.element = - "currentTarget"; - [@deprecated "Please use ReactEvent.Transition.defaultPrevented"] [@bs.get] - external defaultPrevented: ReactEvent.Transition.t => bool = - "defaultPrevented"; - [@deprecated "Please use ReactEvent.Transition.eventPhase"] [@bs.get] - external eventPhase: ReactEvent.Transition.t => int = "eventPhase"; - [@deprecated "Please use ReactEvent.Transition.isTrusted"] [@bs.get] - external isTrusted: ReactEvent.Transition.t => bool = "isTrusted"; - [@deprecated "Please use ReactEvent.Transition.nativeEvent"] [@bs.get] - external nativeEvent: ReactEvent.Transition.t => Js.t({..}) = "nativeEvent"; - [@deprecated "Please use myEvent->ReactEvent.Transition.preventDefault"] - [@bs.send.pipe: ReactEvent.Transition.t] - external preventDefault: unit = "preventDefault"; - [@deprecated "Please use myEvent->ReactEvent.Transition.isDefaultPrevented"] - [@bs.send.pipe: ReactEvent.Transition.t] - external isDefaultPrevented: bool = "isDefaultPrevented"; - [@deprecated "Please use myEvent->ReactEvent.Transition.stopPropagation"] - [@bs.send.pipe: ReactEvent.Transition.t] - external stopPropagation: unit = "stopPropagation"; - [@deprecated - "Please use myEvent->ReactEvent.Transition.isPropagationStopped" - ] - [@bs.send.pipe: ReactEvent.Transition.t] - external isPropagationStopped: bool = "isPropagationStopped"; - [@deprecated - "Please use ReactEvent.Transition.target and remove the surrounding ReactDOMRe.domElementToObj wrapper if any (no longer needed)" - ] - [@bs.get] - external target: ReactEvent.Transition.t => Dom.element = "target"; - [@deprecated "Please use ReactEvent.Transition.timeStamp"] [@bs.get] - external timeStamp: ReactEvent.Transition.t => float = "timeStamp"; - [@deprecated "Please use ReactEvent.Transition.type_"] [@bs.get] - external _type: ReactEvent.Transition.t => string = "type"; - [@deprecated "Please use myEvent->ReactEvent.Transition.persist"] - [@bs.send.pipe: ReactEvent.Transition.t] - external persist: unit = "persist"; - [@deprecated "Please use ReactEvent.Transition.propertyName"] [@bs.get] - external propertyName: ReactEvent.Transition.t => string = "propertyName"; - [@deprecated "Please use ReactEvent.Transition.pseudoElement"] [@bs.get] - external pseudoElement: ReactEvent.Transition.t => string = "pseudoElement"; - [@deprecated "Please use ReactEvent.Transition.elapsedTime"] [@bs.get] - external elapsedTime: ReactEvent.Transition.t => float = "elapsedTime"; -}; diff --git a/vendor/reason-react/ReasonReact.re b/vendor/reason-react/ReasonReact.re index 97ae622..5252261 100644 --- a/vendor/reason-react/ReasonReact.re +++ b/vendor/reason-react/ReasonReact.re @@ -1,740 +1 @@ -// Prevent warning about the `retainedProps` field being defined in both -// `self` and `componentSpec` record types. -[@warning "-30"]; - -type reactClass; - -type jsProps; - -type reactElement = React.element; - -type reactRef; - -[@bs.val] external null: reactElement = "null"; - -external string: string => reactElement = "%identity"; - -external array: array(reactElement) => reactElement = "%identity"; - -external refToJsObj: reactRef => Js.t({..}) = "%identity"; - -[@bs.splice] [@bs.val] [@bs.module "react"] -external createElement: - (reactClass, ~props: Js.t({..})=?, array(reactElement)) => reactElement = - "createElement"; - -[@bs.splice] [@bs.module "react"] -external cloneElement: - (reactElement, ~props: Js.t({..})=?, array(reactElement)) => reactElement = - "cloneElement"; - -[@bs.val] [@bs.module "react"] -external createElementVerbatim: 'a = "createElement"; - -let createDomElement = (s, ~props, children) => { - let vararg = - [|Obj.magic(s), Obj.magic(props)|] |> Js.Array.concat(children); - /* Use varargs to avoid warnings on duplicate keys in children */ - Obj.magic(createElementVerbatim)##apply(Js.Nullable.null, vararg); -}; - -[@bs.val] external magicNull: 'a = "null"; - -type reactClassInternal = reactClass; - -type renderNotImplemented = - | RenderNotImplemented; - -type stateless = unit; - -type noRetainedProps = unit; - -type actionless = unit; - -/*** - * Elements are what JSX blocks become. They represent the *potential* for a - * component instance and state to be created / updated. They are not yet - * instances. - */ -type element = - | Element(component('state, 'retainedProps, 'action)): element -and jsPropsToReason('jsProps, 'state, 'retainedProps, 'action) = - 'jsProps => component('state, 'retainedProps, 'action) -and uncurriedJsPropsToReason('jsProps, 'state, 'retainedProps, 'action) = - (. 'jsProps) => component('state, 'retainedProps, 'action) -/*** - * Type of hidden field for Reason components that use JS components - */ -and jsElementWrapped = - option( - ( - ~key: Js.nullable(string), - ~ref: Js.nullable(Js.nullable(reactRef) => unit) - ) => - reactElement, - ) -and update('state, 'retainedProps, 'action) = - | NoUpdate - | Update('state) - | SideEffects(self('state, 'retainedProps, 'action) => unit) - | UpdateWithSideEffects( - 'state, - self('state, 'retainedProps, 'action) => unit, - ) -/*** - * Granularly types state, and initial state as being independent, so that we - * may include a template that all instances extend from. - */ -and componentSpec( - 'state, - 'initialState, - 'retainedProps, - 'initialRetainedProps, - 'action, -) = { - debugName: string, - reactClassInternal, - /* Keep here as a way to prove that the API may be implemented soundly */ - mutable handedOffState: ref(option('state)), - willReceiveProps: self('state, 'retainedProps, 'action) => 'state, - didMount: self('state, 'retainedProps, 'action) => unit, - didUpdate: oldNewSelf('state, 'retainedProps, 'action) => unit, - willUnmount: self('state, 'retainedProps, 'action) => unit, - willUpdate: oldNewSelf('state, 'retainedProps, 'action) => unit, - shouldUpdate: oldNewSelf('state, 'retainedProps, 'action) => bool, - render: self('state, 'retainedProps, 'action) => reactElement, - initialState: unit => 'initialState, - retainedProps: 'initialRetainedProps, - reducer: ('action, 'state) => update('state, 'retainedProps, 'action), - jsElementWrapped, -} -and component('state, 'retainedProps, 'action) = - componentSpec('state, 'state, 'retainedProps, 'retainedProps, 'action) -and self('state, 'retainedProps, 'action) = { - handle: - 'payload. - (('payload, self('state, 'retainedProps, 'action)) => unit, 'payload) => - unit, - - state: 'state, - retainedProps: 'retainedProps, - send: 'action => unit, - onUnmount: (unit => unit) => unit, -} -and oldNewSelf('state, 'retainedProps, 'action) = { - oldSelf: self('state, 'retainedProps, 'action), - newSelf: self('state, 'retainedProps, 'action), -}; - -type jsComponentThis('state, 'props, 'retainedProps, 'action) = { - . - "state": totalState('state, 'retainedProps, 'action), - "props": {. "reasonProps": 'props}, - "setState": - [@bs.meth] ( - ( - (totalState('state, 'retainedProps, 'action), 'props) => - totalState('state, 'retainedProps, 'action), - Js.nullable(unit => unit) - ) => - unit - ), - "jsPropsToReason": - option( - uncurriedJsPropsToReason('props, 'state, 'retainedProps, 'action), - ), -} -/*** - * `totalState` tracks all of the internal reason API bookkeeping. - * - * Since we will mutate `totalState` in `shouldComponentUpdate`, and since - * there's no guarantee that returning true from `shouldComponentUpdate` - * guarantees that a component's update *actually* takes place (it could get - * rolled back by Fiber etc), then we should put all properties that we - * mutate directly on the totalState, so that when Fiber makes backup shallow - * backup copies of `totalState`, our changes can be rolled back correctly - * even when we mutate them. - */ -and totalState('state, 'retainedProps, 'action) = {. "reasonState": 'state}; - -let anyToUnit = _ => (); - -let anyToTrue = _ => true; - -let willReceivePropsDefault = ({state, _}) => state; - -let renderDefault = _self => string("RenderNotImplemented"); - -let initialStateDefault = () => (); - -let reducerDefault: - ('action, 'state) => update('state, 'retainedProps, 'action) = - (_action, _state) => NoUpdate; - -let convertPropsIfTheyreFromJs = (props, jsPropsToReason, debugName) => { - let props = Obj.magic(props); - switch (Js.Nullable.toOption(props##reasonProps), jsPropsToReason) { - | (Some(props), _) => props - | (None, Some(toReasonProps)) => Element(toReasonProps(. props)) - | (None, None) => - raise( - Invalid_argument( - "A JS component called the Reason component " - ++ debugName - ++ " which didn't implement the JS->Reason React props conversion.", - ), - ) - }; -}; - -let createClass = - (type reasonState, type retainedProps, type action, debugName): reactClass => - ReasonReactOptimizedCreateClass.createClass(. - [@warning "-27"] - [@bs] - { - /*** - * TODO: Null out fields that aren't overridden beyond defaults in - * `component`. React optimizes components that don't implement - * lifecycles! - */ - val displayName = debugName; - val mutable subscriptions = Js.null; - /*** - * TODO: Avoid allocating this every time we need it. Should be doable. - */ - pub self = (state, retainedProps) => { - handle: Obj.magic(this##handleMethod), - send: Obj.magic(this##sendMethod), - state, - retainedProps, - onUnmount: Obj.magic(this##onUnmountMethod), - }; - pub getInitialState = (): totalState('state, 'retainedProps, 'action) => { - let thisJs: - jsComponentThis(reasonState, element, retainedProps, action) = [%bs.raw - "this" - ]; - let convertedReasonProps = - convertPropsIfTheyreFromJs( - thisJs##props, - thisJs##jsPropsToReason, - debugName, - ); - let Element(component) = convertedReasonProps; - let initialReasonState = component.initialState(); - {"reasonState": Obj.magic(initialReasonState)}; - }; - pub componentDidMount = () => { - let thisJs: - jsComponentThis(reasonState, element, retainedProps, action) = [%bs.raw - "this" - ]; - let convertedReasonProps = - convertPropsIfTheyreFromJs( - thisJs##props, - thisJs##jsPropsToReason, - debugName, - ); - let Element(component) = convertedReasonProps; - let curTotalState = thisJs##state; - let curReasonState = curTotalState##reasonState; - let self = - this##self(curReasonState, Obj.magic(component.retainedProps)); - let self = Obj.magic(self); - if (component.didMount !== anyToUnit) { - component.didMount(self); - }; - }; - pub componentDidUpdate = (prevProps, prevState) => { - let thisJs: - jsComponentThis(reasonState, element, retainedProps, action) = [%bs.raw - "this" - ]; - let curState = thisJs##state; - let curReasonState = curState##reasonState; - let newJsProps = thisJs##props; - let newConvertedReasonProps = - convertPropsIfTheyreFromJs( - newJsProps, - thisJs##jsPropsToReason, - debugName, - ); - let Element(newComponent) = newConvertedReasonProps; - if (newComponent.didUpdate !== anyToUnit) { - let oldConvertedReasonProps = - prevProps === newJsProps - ? newConvertedReasonProps - : convertPropsIfTheyreFromJs( - prevProps, - thisJs##jsPropsToReason, - debugName, - ); - let Element(oldComponent) = oldConvertedReasonProps; - let prevReasonState = prevState##reasonState; - let prevReasonState = Obj.magic(prevReasonState); - let newSelf = - this##self( - curReasonState, - Obj.magic(newComponent.retainedProps), - ); - let newSelf = Obj.magic(newSelf); - /* bypass this##self call for small perf boost */ - let oldSelf = - Obj.magic({ - ...newSelf, - state: prevReasonState, - retainedProps: oldComponent.retainedProps, - }); - newComponent.didUpdate({oldSelf, newSelf}); - }; - }; - /* pub componentWillMount .. TODO (or not?) */ - pub componentWillUnmount = () => { - let thisJs: - jsComponentThis(reasonState, element, retainedProps, action) = [%bs.raw - "this" - ]; - let convertedReasonProps = - convertPropsIfTheyreFromJs( - thisJs##props, - thisJs##jsPropsToReason, - debugName, - ); - let Element(component) = convertedReasonProps; - let curState = thisJs##state; - let curReasonState = curState##reasonState; - if (component.willUnmount !== anyToUnit) { - let self = - this##self(curReasonState, Obj.magic(component.retainedProps)); - let self = Obj.magic(self); - component.willUnmount(self); - }; - switch (Js.Null.toOption(this##subscriptions)) { - | None => () - | Some(subs) => Js.Array.forEach(unsubscribe => unsubscribe(), subs) - }; - }; - /*** - * If we are even getting this far, we've already done all the logic for - * detecting unnecessary updates in shouldComponentUpdate. We know at - * this point that we need to rerender, and we've even *precomputed* the - * render result (subelements)! - */ - pub componentWillUpdate = (nextProps, nextState: totalState(_)) => { - let thisJs: - jsComponentThis(reasonState, element, retainedProps, action) = [%bs.raw - "this" - ]; - let newConvertedReasonProps = - convertPropsIfTheyreFromJs( - nextProps, - thisJs##jsPropsToReason, - debugName, - ); - let Element(newComponent) = newConvertedReasonProps; - if (newComponent.willUpdate !== anyToUnit) { - let oldJsProps = thisJs##props; - /* Avoid converting again the props that are just the same as curProps. */ - let oldConvertedReasonProps = - nextProps === oldJsProps - ? newConvertedReasonProps - : convertPropsIfTheyreFromJs( - oldJsProps, - thisJs##jsPropsToReason, - debugName, - ); - let Element(oldComponent) = oldConvertedReasonProps; - let curState = thisJs##state; - let curReasonState = curState##reasonState; - let curReasonState = Obj.magic(curReasonState); - let nextReasonState = nextState##reasonState; - let newSelf = - this##self( - nextReasonState, - Obj.magic(newComponent.retainedProps), - ); - let newSelf = Obj.magic(newSelf); - /* bypass this##self call for small perf boost */ - let oldSelf = - Obj.magic({ - ...newSelf, - state: curReasonState, - retainedProps: oldComponent.retainedProps, - }); - newComponent.willUpdate({oldSelf, newSelf}); - }; - }; - /*** - * One interesting part of the new Reason React API. There isn't a need - * for a separate `willReceiveProps` function. The primary `create` API - * is *always* receiving props. - */ - pub componentWillReceiveProps = nextProps => { - let thisJs: - jsComponentThis(reasonState, element, retainedProps, action) = [%bs.raw - "this" - ]; - let newConvertedReasonProps = - convertPropsIfTheyreFromJs( - nextProps, - thisJs##jsPropsToReason, - debugName, - ); - let Element(newComponent) = Obj.magic(newConvertedReasonProps); - if (newComponent.willReceiveProps !== willReceivePropsDefault) { - let oldJsProps = thisJs##props; - /* Avoid converting again the props that are just the same as curProps. */ - let oldConvertedReasonProps = - nextProps === oldJsProps - ? newConvertedReasonProps - : convertPropsIfTheyreFromJs( - oldJsProps, - thisJs##jsPropsToReason, - debugName, - ); - let Element(oldComponent) = oldConvertedReasonProps; - thisJs##setState( - (curTotalState, _) => { - let curReasonState = Obj.magic(curTotalState##reasonState); - let oldSelf = - Obj.magic( - this##self( - curReasonState, - Obj.magic(oldComponent.retainedProps), - ), - ); - let nextReasonState = - Obj.magic(newComponent.willReceiveProps(oldSelf)); - if (nextReasonState !== curTotalState) { - let nextTotalState: totalState(_) = { - "reasonState": nextReasonState, - }; - let nextTotalState = Obj.magic(nextTotalState); - nextTotalState; - } else { - curTotalState; - }; - }, - Js.Nullable.null, - ); - }; - }; - /*** - * shouldComponentUpdate is invoked any time props change, or new state - * updates occur. - * - * The easiest way to think about this method, is: - * - "Should component have its componentWillUpdate method called, - * followed by its render() method?", - * - * Therefore the component.shouldUpdate becomes a hook solely to perform - * performance optimizations through. - */ - pub shouldComponentUpdate = (nextJsProps, nextState, _) => { - let thisJs: - jsComponentThis(reasonState, element, retainedProps, action) = [%bs.raw - "this" - ]; - let curJsProps = thisJs##props; - - /*** - * Now, we inspect the next state that we are supposed to render, and ensure that - * - We have enough information to answer "should update?" - * - We have enough information to render() in the event that the answer is "true". - * - * If we can detect that props have changed update has occured, - * we ask the component's shouldUpdate if it would like to update - defaulting to true. - */ - let oldConvertedReasonProps = - convertPropsIfTheyreFromJs( - thisJs##props, - thisJs##jsPropsToReason, - debugName, - ); - /* Avoid converting again the props that are just the same as curProps. */ - let newConvertedReasonProps = - nextJsProps === curJsProps - ? oldConvertedReasonProps - : convertPropsIfTheyreFromJs( - nextJsProps, - thisJs##jsPropsToReason, - debugName, - ); - let Element(oldComponent) = oldConvertedReasonProps; - let Element(newComponent) = newConvertedReasonProps; - let nextReasonState = nextState##reasonState; - let newSelf = - this##self(nextReasonState, Obj.magic(newComponent.retainedProps)); - if (newComponent.shouldUpdate !== anyToTrue) { - let curState = thisJs##state; - let curReasonState = curState##reasonState; - let curReasonState = Obj.magic(curReasonState); - let newSelf = Obj.magic(newSelf); - /* bypass this##self call for small perf boost */ - let oldSelf = - Obj.magic({ - ...newSelf, - state: curReasonState, - retainedProps: oldComponent.retainedProps, - }); - newComponent.shouldUpdate({oldSelf, newSelf}); - } else { - true; - }; - }; - pub onUnmountMethod = subscription => - switch (Js.Null.toOption(this##subscriptions)) { - | None => this##subscriptions #= Js.Null.return([|subscription|]) - | Some(subs) => ignore(Js.Array.push(subscription, subs)) - }; - pub handleMethod = callback => { - let thisJs: - jsComponentThis(reasonState, element, retainedProps, action) = [%bs.raw - "this" - ]; - callbackPayload => { - let curState = thisJs##state; - let curReasonState = curState##reasonState; - let convertedReasonProps = - convertPropsIfTheyreFromJs( - thisJs##props, - thisJs##jsPropsToReason, - debugName, - ); - let Element(component) = convertedReasonProps; - callback( - callbackPayload, - Obj.magic( - this##self(curReasonState, Obj.magic(component.retainedProps)), - ), - ); - }; - }; - pub sendMethod = (action: 'action) => { - let thisJs: - jsComponentThis(reasonState, element, retainedProps, action) = [%bs.raw - "this" - ]; - let convertedReasonProps = - convertPropsIfTheyreFromJs( - thisJs##props, - thisJs##jsPropsToReason, - debugName, - ); - let Element(component) = convertedReasonProps; - if (component.reducer !== reducerDefault) { - let sideEffects = ref(ignore); - /* allow side-effects to be executed here */ - let partialStateApplication = component.reducer(Obj.magic(action)); - thisJs##setState( - (curTotalState, _) => { - let curReasonState = curTotalState##reasonState; - let reasonStateUpdate = - partialStateApplication(Obj.magic(curReasonState)); - if (reasonStateUpdate === NoUpdate) { - magicNull; - } else { - let reasonStateUpdate = Obj.magic(reasonStateUpdate); - let nextTotalState = - switch (reasonStateUpdate) { - | NoUpdate => curTotalState - | Update(nextReasonState) => { - "reasonState": nextReasonState, - } - | SideEffects(performSideEffects) => - sideEffects.contents = performSideEffects; - curTotalState; - | UpdateWithSideEffects(nextReasonState, performSideEffects) => - sideEffects.contents = performSideEffects; - {"reasonState": nextReasonState}; - }; - if (nextTotalState !== curTotalState) { - nextTotalState; - } else { - magicNull; - }; - }; - }, - Js.Nullable.return( - this##handleMethod(((), self) => sideEffects.contents(self)), - ), - ); - }; - }; - /*** - * In order to ensure we always operate on freshest props / state, and to - * support the API that "reduces" the next state along with the next - * rendering, with full acccess to named argument props in the closure, - * we always *pre* compute the render result. - */ - pub render = () => { - let thisJs: - jsComponentThis(reasonState, element, retainedProps, action) = [%bs.raw - "this" - ]; - let convertedReasonProps = - convertPropsIfTheyreFromJs( - thisJs##props, - thisJs##jsPropsToReason, - debugName, - ); - let Element(created) = Obj.magic(convertedReasonProps); - let component = created; - let curState = thisJs##state; - let curReasonState = Obj.magic(curState##reasonState); - let self = - Obj.magic( - this##self(curReasonState, Obj.magic(component.retainedProps)), - ); - component.render(self); - } - }, - ); - -let basicComponent = debugName => { - let componentTemplate = { - reactClassInternal: createClass(debugName), - debugName, - /* Keep here as a way to prove that the API may be implemented soundly */ - handedOffState: { - contents: None, - }, - didMount: anyToUnit, - willReceiveProps: willReceivePropsDefault, - didUpdate: anyToUnit, - willUnmount: anyToUnit, - willUpdate: anyToUnit, - /*** - * Called when component will certainly mount at some point - and may be - * called on the sever for server side React rendering. - */ - shouldUpdate: anyToTrue, - render: renderDefault, - initialState: initialStateDefault, - reducer: reducerDefault, - jsElementWrapped: None, - retainedProps: (), - }; - componentTemplate; -}; - -let statelessComponent = - (debugName): component(stateless, noRetainedProps, actionless) => - basicComponent(debugName); - -let statelessComponentWithRetainedProps = - (debugName) - : componentSpec( - stateless, - stateless, - 'retainedProps, - noRetainedProps, - actionless, - ) => - basicComponent(debugName); - -let reducerComponent = - (debugName) - : componentSpec( - 'state, - stateless, - noRetainedProps, - noRetainedProps, - 'action, - ) => - basicComponent(debugName); - -let reducerComponentWithRetainedProps = - (debugName) - : componentSpec( - 'state, - stateless, - 'retainedProps, - noRetainedProps, - 'action, - ) => - basicComponent(debugName); - -/*** - * Convenience for creating React elements before we have a better JSX transform. Hopefully this makes it - * usable to build some components while waiting to migrate the JSX transform to the next API. - * - * Constrain the component here instead of relying on the Element constructor which would lead to confusing - * error messages. - */ -let element = - ( - ~key: string=Obj.magic(Js.Nullable.undefined), - ~ref: Js.nullable(reactRef) => unit=Obj.magic(Js.Nullable.undefined), - component: component('state, 'retainedProps, 'action), - ) => { - let element = Element(component); - switch (component.jsElementWrapped) { - | Some(jsElementWrapped) => - jsElementWrapped( - ~key=Js.Nullable.return(key), - ~ref=Js.Nullable.return(ref), - ) - | None => - createElement( - component.reactClassInternal, - ~props={"key": key, "ref": ref, "reasonProps": element}, - [||], - ) - }; -}; - -let wrapReasonForJs = - ( - ~component, - jsPropsToReason: - jsPropsToReason('jsProps, 'state, 'retainedProps, 'action), - ) => { - let jsPropsToReason: - jsPropsToReason(jsProps, 'state, 'retainedProps, 'action) = - Obj.magic(jsPropsToReason) /* cast 'jsProps to jsProps */; - let uncurriedJsPropsToReason: - uncurriedJsPropsToReason(jsProps, 'state, 'retainedProps, 'action) = - (. jsProps) => jsPropsToReason(jsProps); - Obj.magic(component.reactClassInternal)##prototype##jsPropsToReason - #= Some(uncurriedJsPropsToReason); - component.reactClassInternal; -}; - -module WrapProps = { - /* We wrap the props for reason->reason components, as a marker that "these props were passed from another - reason component" */ - let wrapProps = - ( - ~reactClass, - ~props, - children, - ~key: Js.nullable(string), - ~ref: Js.nullable(Js.nullable(reactRef) => unit), - ) => { - let props = - Js.Obj.assign( - Js.Obj.assign(Js.Obj.empty(), Obj.magic(props)), - {"ref": ref, "key": key}, - ); - let varargs = - [|Obj.magic(reactClass), Obj.magic(props)|] - |> Js.Array.concat(Obj.magic(children)); - /* Use varargs under the hood */ - Obj.magic(createElementVerbatim)##apply(Js.Nullable.null, varargs); - }; - let dummyInteropComponent = basicComponent("interop"); - let wrapJsForReason = - (~reactClass, ~props, children) - : component(stateless, noRetainedProps, _) => { - let jsElementWrapped = Some(wrapProps(~reactClass, ~props, children)); - {...dummyInteropComponent, jsElementWrapped}; - }; -}; - -let wrapJsForReason = WrapProps.wrapJsForReason; - [@bs.module "react"] external fragment: 'a = "Fragment"; - -module Router = ReasonReactRouter; diff --git a/vendor/reason-react/ReasonReact.rei b/vendor/reason-react/ReasonReact.rei deleted file mode 100644 index d91f3db..0000000 --- a/vendor/reason-react/ReasonReact.rei +++ /dev/null @@ -1,229 +0,0 @@ -/*** - * This API assumes that JSX will desugar into: - * - * ReasonReact.element( - * Foo.make(~key, ~ref, ~attr1=val1, ~attrn=valn, [| |] - * ) - */ - -type reactClass; - -type reactElement = React.element; - -type reactRef; - -[@bs.val] external null: reactElement = "null"; - -external string: string => reactElement = "%identity"; - -external array: array(reactElement) => reactElement = "%identity"; - -external refToJsObj: reactRef => Js.t({..}) = "%identity"; - -/* This should _not_ be used directly, unless you're passing a class like this: - - switch (actionsClass) { - | Some(actions) => - ReasonReact.createElement( - actions, - ~props={ - "className": "hi" - }, - [|whatever|], - ) - } - - In every other case, you should be using the JSX - */ -[@bs.splice] [@bs.val] [@bs.module "react"] -external createElement: - (reactClass, ~props: Js.t({..})=?, array(reactElement)) => reactElement = - "createElement"; - -[@bs.splice] [@bs.module "react"] -external cloneElement: - (reactElement, ~props: Js.t({..})=?, array(reactElement)) => reactElement = - "cloneElement"; - -type renderNotImplemented = - | RenderNotImplemented; - -/*** - * A stateless component is a component with state of type unit. This cannot be - * abstract for now, because a stateless component's willReceiveProps needs to - * return the state, aka unit. We can provide a helper - * ReasonReact.statelessReturn that's of type `stateless`, but that's verbose - */ -type stateless = unit; - -type noRetainedProps; - -/*** An actionless component is a component with actions of type unit */ -type actionless = unit; - -/* Control how a state update is performed. - The state can be updated of left unchanged. - Side effects can be specified and are scheduled for later execution. - Note: when a side effect is scheduled, it's added to a queue of existing pending side effects. - All the side effects are performed in batch after all the state updates have been performed, - in the same order in which they were scheduled, just before shouldUpdate is called. */ -type update('state, 'retainedProps, 'action) = - /* Don't update the state. */ - | NoUpdate - /* Update the state with the given one. */ - | Update('state) - /* Perform side effects without updating state, and don't trigger a re-render. - Do not prevent a re-render either, if one was scheduled to happen. - The side effects function is invoked when all the updates have completed. */ - | SideEffects(self('state, 'retainedProps, 'action) => unit) - /* Update the state and perform side effects. - The side effects function is invoked when all the updates have completed. */ - | UpdateWithSideEffects( - 'state, - self('state, 'retainedProps, 'action) => unit, - ) -and self('state, 'retainedProps, 'action) = { - /*** - * Call a handler function. - * - * The callback is passed the payload and current state immediately. - * Note: the callback typically performs side effects, since it returns nothing. - */ - handle: - 'payload. - (('payload, self('state, 'retainedProps, 'action)) => unit, 'payload) => - unit, - - state: 'state, - retainedProps: 'retainedProps, - send: 'action => unit, - onUnmount: (unit => unit) => unit, -}; - -type reactClassInternal; - -/*** For internal use only */ -type jsElementWrapped; - -type oldNewSelf('state, 'retainedProps, 'action) = { - oldSelf: self('state, 'retainedProps, 'action), - newSelf: self('state, 'retainedProps, 'action), -}; - -type componentSpec( - 'state, - 'initialState, - 'retainedProps, - 'initialRetainedProps, - 'action, -) = { - debugName: string, - reactClassInternal, - /* Keep here as a way to prove that the API may be implemented soundly */ - mutable handedOffState: ref(option('state)), - /*** Callback invoked when the component receives new props or state. - * Note: this callback must not perform side effects. - */ - willReceiveProps: self('state, 'retainedProps, 'action) => 'state, - didMount: self('state, 'retainedProps, 'action) => unit, - didUpdate: oldNewSelf('state, 'retainedProps, 'action) => unit, - willUnmount: self('state, 'retainedProps, 'action) => unit, - willUpdate: oldNewSelf('state, 'retainedProps, 'action) => unit, - shouldUpdate: oldNewSelf('state, 'retainedProps, 'action) => bool, - render: self('state, 'retainedProps, 'action) => reactElement, - initialState: unit => 'initialState, - retainedProps: 'initialRetainedProps, - /*** Reducer callback. - * - * The callback is invoked by the reduce function contained in self. - * A state update is scheduled based on the action passed, and added to the queue of pending updates. - * The state received will be the resulting one after the pending updates have been executed. - * - * Note: this callback must not perform side effects. - * If side effects are required, they should be contained in a - * side-effectful function specified in the returned update. - */ - reducer: ('action, 'state) => update('state, 'retainedProps, 'action), - jsElementWrapped, -} -and component('state, 'retainedProps, 'action) = - componentSpec('state, 'state, 'retainedProps, 'retainedProps, 'action); - -/*** Create a stateless component: i.e. a component where state has type stateless. */ -let statelessComponent: - string => - componentSpec( - stateless, - stateless, - noRetainedProps, - noRetainedProps, - actionless, - ); - -let statelessComponentWithRetainedProps: - string => - componentSpec( - stateless, - stateless, - 'retainedProps, - noRetainedProps, - actionless, - ); - -let reducerComponent: - string => - componentSpec('state, stateless, noRetainedProps, noRetainedProps, 'action); - -let reducerComponentWithRetainedProps: - string => - componentSpec('state, stateless, 'retainedProps, noRetainedProps, 'action); - -let element: - ( - ~key: string=?, - ~ref: Js.nullable(reactRef) => unit=?, - component('state, 'retainedProps, 'action) - ) => - reactElement; - -type jsPropsToReason('jsProps, 'state, 'retainedProps, 'action) = - 'jsProps => component('state, 'retainedProps, 'action); - -/*** - * We *under* constrain the kind of component spec this accepts because we actually extend the *originally* - * defined component. It uses mutation on the original component, so that even if it is extended with - * {...component}, all extensions will also see the underlying js class. I can sleep at night because js - * interop is integrating with untyped, code and it is *possible* to create pure-ReasonReact apps without JS - * interop entirely. */ -let wrapReasonForJs: - ( - ~component: componentSpec( - 'state, - 'initialState, - 'retainedProps, - 'initialRetainedProps, - 'action, - ), - jsPropsToReason(_) - ) => - reactClass; - -[@deprecated - " -Were you using this because you needed to pass a children array reference to a DOM element? We now support children spread for DOM elements: `
...children
`. -Alternatively, if you're using this because the prop name contains a hyphen, please use `ReactDOMRe.createElementVariadic` instead." -] -let createDomElement: - (string, ~props: Js.t({..}), array(reactElement)) => reactElement; - -/** - * Wrap props into a JS component - * Use for interop when Reason components use JS components - */ -let wrapJsForReason: - (~reactClass: reactClass, ~props: 'a, 'b) => - component(stateless, noRetainedProps, actionless); - -[@bs.module "react"] external fragment: 'a = "Fragment"; - -module Router = ReasonReactRouter; diff --git a/vendor/reason-react/ReasonReactCompat.re b/vendor/reason-react/ReasonReactCompat.re deleted file mode 100644 index 1e647be..0000000 --- a/vendor/reason-react/ReasonReactCompat.re +++ /dev/null @@ -1,18 +0,0 @@ -external componentToReasonReactClass: - React.component('props) => ReasonReact.reactClass = - "%identity"; - -external reasonReactClassToComponent: - ReasonReact.reactClass => React.component('props) = - "%identity"; -let wrapReactForReasonReact = (component, props, children) => - ReasonReact.wrapJsForReason( - ~reactClass=componentToReasonReactClass(component), - ~props, - children, - ); - -let wrapReasonReactForReact = (~component, propsConverter) => - reasonReactClassToComponent( - ReasonReact.wrapReasonForJs(~component, propsConverter), - ); diff --git a/vendor/reason-react/ReasonReactCompat.rei b/vendor/reason-react/ReasonReactCompat.rei deleted file mode 100644 index a9e8000..0000000 --- a/vendor/reason-react/ReasonReactCompat.rei +++ /dev/null @@ -1,14 +0,0 @@ -let wrapReactForReasonReact: - (React.component('props), 'props, 'children) => - ReasonReact.component( - ReasonReact.stateless, - ReasonReact.noRetainedProps, - ReasonReact.actionless, - ); - -let wrapReasonReactForReact: - ( - ~component: ReasonReact.componentSpec('a, 'b, 'c, 'd, 'e), - ReasonReact.jsPropsToReason('props, 'g, 'h, 'i) - ) => - React.component('props); diff --git a/vendor/reason-react/ReasonReactOptimizedCreateClass.re b/vendor/reason-react/ReasonReactOptimizedCreateClass.re deleted file mode 100644 index bad302a..0000000 --- a/vendor/reason-react/ReasonReactOptimizedCreateClass.re +++ /dev/null @@ -1,893 +0,0 @@ -let _assign = Js.Obj.assign; - -let emptyObject = Js.Obj.empty(); - -%bs.raw -{| -/** - * Copyright 2013-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - * - */ - -// 'use strict'; - -// var _assign = require('object-assign'); - -// var emptyObject = require('emptyObject'); -// var _invariant = require('invariant'); - -// if (process.env.NODE_ENV !== 'production') { -// var warning = require('fbjs/lib/warning'); -// } - -var MIXINS_KEY = 'mixins'; - -// Helper function to allow the creation of anonymous functions which do not -// have .name set to the name of the variable being assigned to. -function identity(fn) { - return fn; -} - -var ReactPropTypeLocationNames; -// if (process.env.NODE_ENV !== 'production') { -// ReactPropTypeLocationNames = { -// prop: 'prop', -// context: 'context', -// childContext: 'child context' -// }; -// } else { - ReactPropTypeLocationNames = {}; -// } -|}; - -let factory = [%bs.raw - {| -function factory(ReactComponent, isValidElement, ReactNoopUpdateQueue) { - /** - * Policies that describe methods in `ReactClassInterface`. - */ - - var injectedMixins = []; - - /** - * Composite components are higher-level components that compose other composite - * or host components. - * - * To create a new type of `ReactClass`, pass a specification of - * your new class to `React.createClass`. The only requirement of your class - * specification is that you implement a `render` method. - * - * var MyComponent = React.createClass({ - * render: function() { - * return
Hello World
; - * } - * }); - * - * The class specification supports a specific protocol of methods that have - * special meaning (e.g. `render`). See `ReactClassInterface` for - * more the comprehensive protocol. Any other properties and methods in the - * class specification will be available on the prototype. - * - * @interface ReactClassInterface - * @internal - */ - var ReactClassInterface = { - /** - * An array of Mixin objects to include when defining your component. - * - * @type {array} - * @optional - */ - mixins: 'DEFINE_MANY', - - /** - * An object containing properties and methods that should be defined on - * the component's constructor instead of its prototype (static methods). - * - * @type {object} - * @optional - */ - statics: 'DEFINE_MANY', - - /** - * Definition of prop types for this component. - * - * @type {object} - * @optional - */ - propTypes: 'DEFINE_MANY', - - /** - * Definition of context types for this component. - * - * @type {object} - * @optional - */ - contextTypes: 'DEFINE_MANY', - - /** - * Definition of context types this component sets for its children. - * - * @type {object} - * @optional - */ - childContextTypes: 'DEFINE_MANY', - - // ==== Definition methods ==== - - /** - * Invoked when the component is mounted. Values in the mapping will be set on - * `this.props` if that prop is not specified (i.e. using an `in` check). - * - * This method is invoked before `getInitialState` and therefore cannot rely - * on `this.state` or use `this.setState`. - * - * @return {object} - * @optional - */ - getDefaultProps: 'DEFINE_MANY_MERGED', - - /** - * Invoked once before the component is mounted. The return value will be used - * as the initial value of `this.state`. - * - * getInitialState: function() { - * return { - * isOn: false, - * fooBaz: new BazFoo() - * } - * } - * - * @return {object} - * @optional - */ - getInitialState: 'DEFINE_MANY_MERGED', - - /** - * @return {object} - * @optional - */ - getChildContext: 'DEFINE_MANY_MERGED', - - /** - * Uses props from `this.props` and state from `this.state` to render the - * structure of the component. - * - * No guarantees are made about when or how often this method is invoked, so - * it must not have side effects. - * - * render: function() { - * var name = this.props.name; - * return
Hello, {name}!
; - * } - * - * @return {ReactComponent} - * @required - */ - render: 'DEFINE_ONCE', - - // ==== Delegate methods ==== - - /** - * Invoked when the component is initially created and about to be mounted. - * This may have side effects, but any external subscriptions or data created - * by this method must be cleaned up in `componentWillUnmount`. - * - * @optional - */ - componentWillMount: 'DEFINE_MANY', - - /** - * Invoked when the component has been mounted and has a DOM representation. - * However, there is no guarantee that the DOM node is in the document. - * - * Use this as an opportunity to operate on the DOM when the component has - * been mounted (initialized and rendered) for the first time. - * - * @param {DOMElement} rootNode DOM element representing the component. - * @optional - */ - componentDidMount: 'DEFINE_MANY', - - /** - * Invoked before the component receives new props. - * - * Use this as an opportunity to react to a prop transition by updating the - * state using `this.setState`. Current props are accessed via `this.props`. - * - * componentWillReceiveProps: function(nextProps, nextContext) { - * this.setState({ - * likesIncreasing: nextProps.likeCount > this.props.likeCount - * }); - * } - * - * NOTE: There is no equivalent `componentWillReceiveState`. An incoming prop - * transition may cause a state change, but the opposite is not true. If you - * need it, you are probably looking for `componentWillUpdate`. - * - * @param {object} nextProps - * @optional - */ - componentWillReceiveProps: 'DEFINE_MANY', - - /** - * Invoked while deciding if the component should be updated as a result of - * receiving new props, state and/or context. - * - * Use this as an opportunity to `return false` when you're certain that the - * transition to the new props/state/context will not require a component - * update. - * - * shouldComponentUpdate: function(nextProps, nextState, nextContext) { - * return !equal(nextProps, this.props) || - * !equal(nextState, this.state) || - * !equal(nextContext, this.context); - * } - * - * @param {object} nextProps - * @param {?object} nextState - * @param {?object} nextContext - * @return {boolean} True if the component should update. - * @optional - */ - shouldComponentUpdate: 'DEFINE_ONCE', - - /** - * Invoked when the component is about to update due to a transition from - * `this.props`, `this.state` and `this.context` to `nextProps`, `nextState` - * and `nextContext`. - * - * Use this as an opportunity to perform preparation before an update occurs. - * - * NOTE: You **cannot** use `this.setState()` in this method. - * - * @param {object} nextProps - * @param {?object} nextState - * @param {?object} nextContext - * @param {ReactReconcileTransaction} transaction - * @optional - */ - componentWillUpdate: 'DEFINE_MANY', - - /** - * Invoked when the component's DOM representation has been updated. - * - * Use this as an opportunity to operate on the DOM when the component has - * been updated. - * - * @param {object} prevProps - * @param {?object} prevState - * @param {?object} prevContext - * @param {DOMElement} rootNode DOM element representing the component. - * @optional - */ - componentDidUpdate: 'DEFINE_MANY', - - /** - * Invoked when the component is about to be removed from its parent and have - * its DOM representation destroyed. - * - * Use this as an opportunity to deallocate any external resources. - * - * NOTE: There is no `componentDidUnmount` since your component will have been - * destroyed by that point. - * - * @optional - */ - componentWillUnmount: 'DEFINE_MANY', - - // ==== Advanced methods ==== - - /** - * Updates the component's currently mounted DOM representation. - * - * By default, this implements React's rendering and reconciliation algorithm. - * Sophisticated clients may wish to override this. - * - * @param {ReactReconcileTransaction} transaction - * @internal - * @overridable - */ - updateComponent: 'OVERRIDE_BASE' - }; - - /** - * Mapping from class specification keys to special processing functions. - * - * Although these are declared like instance properties in the specification - * when defining classes using `React.createClass`, they are actually static - * and are accessible on the constructor instead of the prototype. Despite - * being static, they must be defined outside of the "statics" key under - * which all other static methods are defined. - */ - var RESERVED_SPEC_KEYS = { - displayName: function(Constructor, displayName) { - Constructor.displayName = displayName; - }, - mixins: function(Constructor, mixins) { - if (mixins) { - for (var i = 0; i < mixins.length; i++) { - mixSpecIntoComponent(Constructor, mixins[i]); - } - } - }, - childContextTypes: function(Constructor, childContextTypes) { - // if (process.env.NODE_ENV !== 'production') { - // validateTypeDef(Constructor, childContextTypes, 'childContext'); - // } - Constructor.childContextTypes = _assign( - {}, - Constructor.childContextTypes, - childContextTypes - ); - }, - contextTypes: function(Constructor, contextTypes) { - // if (process.env.NODE_ENV !== 'production') { - // validateTypeDef(Constructor, contextTypes, 'context'); - // } - Constructor.contextTypes = _assign( - {}, - Constructor.contextTypes, - contextTypes - ); - }, - /** - * Special case getDefaultProps which should move into statics but requires - * automatic merging. - */ - getDefaultProps: function(Constructor, getDefaultProps) { - if (Constructor.getDefaultProps) { - Constructor.getDefaultProps = createMergedResultFunction( - Constructor.getDefaultProps, - getDefaultProps - ); - } else { - Constructor.getDefaultProps = getDefaultProps; - } - }, - propTypes: function(Constructor, propTypes) { - // if (process.env.NODE_ENV !== 'production') { - // validateTypeDef(Constructor, propTypes, 'prop'); - // } - Constructor.propTypes = _assign({}, Constructor.propTypes, propTypes); - }, - statics: function(Constructor, statics) { - mixStaticSpecIntoComponent(Constructor, statics); - }, - autobind: function() {} - }; - - function validateTypeDef(Constructor, typeDef, location) { - for (var propName in typeDef) { - // if (typeDef.hasOwnProperty(propName)) { - // // use a warning instead of an _invariant so components - // // don't show up in prod but only in __DEV__ - // // if (process.env.NODE_ENV !== 'production') { - // // warning( - // // typeof typeDef[propName] === 'function', - // // '%s: %s type `%s` is invalid; it must be a function, usually from ' + - // // 'React.PropTypes.', - // // Constructor.displayName || 'ReactClass', - // // ReactPropTypeLocationNames[location], - // // propName - // // ); - // // } - // } - } - } - - function validateMethodOverride(isAlreadyDefined, name) { - var specPolicy = ReactClassInterface.hasOwnProperty(name) - ? ReactClassInterface[name] - : null; - - // Disallow overriding of base class methods unless explicitly allowed. - if (ReactClassMixin.hasOwnProperty(name)) { - // _invariant( - // specPolicy === 'OVERRIDE_BASE', - // 'ReactClassInterface: You are attempting to override ' + - // '`%s` from your class specification. Ensure that your method names ' + - // 'do not overlap with React methods.', - // name - // ); - } - - // Disallow defining methods more than once unless explicitly allowed. - if (isAlreadyDefined) { - // _invariant( - // specPolicy === 'DEFINE_MANY' || specPolicy === 'DEFINE_MANY_MERGED', - // 'ReactClassInterface: You are attempting to define ' + - // '`%s` on your component more than once. This conflict may be due ' + - // 'to a mixin.', - // name - // ); - } - } - - /** - * Mixin helper which handles policy validation and reserved - * specification keys when building React classes. - */ - function mixSpecIntoComponent(Constructor, spec) { - if (!spec) { - // if (process.env.NODE_ENV !== 'production') { - // var typeofSpec = typeof spec; - // var isMixinValid = typeofSpec === 'object' && spec !== null; - // - // if (process.env.NODE_ENV !== 'production') { - // warning( - // isMixinValid, - // "%s: You're attempting to include a mixin that is either null " + - // 'or not an object. Check the mixins included by the component, ' + - // 'as well as any mixins they include themselves. ' + - // 'Expected object but got %s.', - // Constructor.displayName || 'ReactClass', - // spec === null ? null : typeofSpec - // ); - // } - // } - - return; - } - - // _invariant( - // typeof spec !== 'function', - // "ReactClass: You're attempting to " + - // 'use a component class or function as a mixin. Instead, just use a ' + - // 'regular object.' - // ); - // _invariant( - // !isValidElement(spec), - // "ReactClass: You're attempting to " + - // 'use a component as a mixin. Instead, just use a regular object.' - // ); - - var proto = Constructor.prototype; - var autoBindPairs = proto.__reactAutoBindPairs; - - // By handling mixins before any other properties, we ensure the same - // chaining order is applied to methods with DEFINE_MANY policy, whether - // mixins are listed before or after these methods in the spec. - if (spec.hasOwnProperty(MIXINS_KEY)) { - RESERVED_SPEC_KEYS.mixins(Constructor, spec.mixins); - } - - for (var name in spec) { - if (!spec.hasOwnProperty(name)) { - continue; - } - - if (name === MIXINS_KEY) { - // We have already handled mixins in a special case above. - continue; - } - - var property = spec[name]; - var isAlreadyDefined = proto.hasOwnProperty(name); - validateMethodOverride(isAlreadyDefined, name); - - if (RESERVED_SPEC_KEYS.hasOwnProperty(name)) { - RESERVED_SPEC_KEYS[name](Constructor, property); - } else { - // Setup methods on prototype: - // The following member methods should not be automatically bound: - // 1. Expected ReactClass methods (in the "interface"). - // 2. Overridden methods (that were mixed in). - var isReactClassMethod = ReactClassInterface.hasOwnProperty(name); - var isFunction = typeof property === 'function'; - var shouldAutoBind = - isFunction && - !isReactClassMethod && - !isAlreadyDefined && - spec.autobind !== false; - - if (shouldAutoBind) { - autoBindPairs.push(name, property); - proto[name] = property; - } else { - if (isAlreadyDefined) { - var specPolicy = ReactClassInterface[name]; - - // These cases should already be caught by validateMethodOverride. - // _invariant( - // isReactClassMethod && - // (specPolicy === 'DEFINE_MANY_MERGED' || - // specPolicy === 'DEFINE_MANY'), - // 'ReactClass: Unexpected spec policy %s for key %s ' + - // 'when mixing in component specs.', - // specPolicy, - // name - // ); - - // For methods which are defined more than once, call the existing - // methods before calling the new property, merging if appropriate. - if (specPolicy === 'DEFINE_MANY_MERGED') { - proto[name] = createMergedResultFunction(proto[name], property); - } else if (specPolicy === 'DEFINE_MANY') { - proto[name] = createChainedFunction(proto[name], property); - } - } else { - proto[name] = property; - // if (process.env.NODE_ENV !== 'production') { - // // Add verbose displayName to the function, which helps when looking - // // at profiling tools. - // if (typeof property === 'function' && spec.displayName) { - // proto[name].displayName = spec.displayName + '_' + name; - // } - // } - } - } - } - } - } - - function mixStaticSpecIntoComponent(Constructor, statics) { - if (!statics) { - return; - } - for (var name in statics) { - var property = statics[name]; - if (!statics.hasOwnProperty(name)) { - continue; - } - - var isReserved = name in RESERVED_SPEC_KEYS; - // _invariant( - // !isReserved, - // 'ReactClass: You are attempting to define a reserved ' + - // 'property, `%s`, that shouldn\'t be on the "statics" key. Define it ' + - // 'as an instance property instead; it will still be accessible on the ' + - // 'constructor.', - // name - // ); - - var isInherited = name in Constructor; - // _invariant( - // !isInherited, - // 'ReactClass: You are attempting to define ' + - // '`%s` on your component more than once. This conflict may be ' + - // 'due to a mixin.', - // name - // ); - Constructor[name] = property; - } - } - - /** - * Merge two objects, but throw if both contain the same key. - * - * @param {object} one The first object, which is mutated. - * @param {object} two The second object - * @return {object} one after it has been mutated to contain everything in two. - */ - function mergeIntoWithNoDuplicateKeys(one, two) { - // _invariant( - // one && two && typeof one === 'object' && typeof two === 'object', - // 'mergeIntoWithNoDuplicateKeys(): Cannot merge non-objects.' - // ); - - for (var key in two) { - if (two.hasOwnProperty(key)) { - // _invariant( - // one[key] === undefined, - // 'mergeIntoWithNoDuplicateKeys(): ' + - // 'Tried to merge two objects with the same key: `%s`. This conflict ' + - // 'may be due to a mixin; in particular, this may be caused by two ' + - // 'getInitialState() or getDefaultProps() methods returning objects ' + - // 'with clashing keys.', - // key - // ); - one[key] = two[key]; - } - } - return one; - } - - /** - * Creates a function that invokes two functions and merges their return values. - * - * @param {function} one Function to invoke first. - * @param {function} two Function to invoke second. - * @return {function} Function that invokes the two argument functions. - * @private - */ - function createMergedResultFunction(one, two) { - return function mergedResult() { - var a = one.apply(this, arguments); - var b = two.apply(this, arguments); - if (a == null) { - return b; - } else if (b == null) { - return a; - } - var c = {}; - mergeIntoWithNoDuplicateKeys(c, a); - mergeIntoWithNoDuplicateKeys(c, b); - return c; - }; - } - - /** - * Creates a function that invokes two functions and ignores their return vales. - * - * @param {function} one Function to invoke first. - * @param {function} two Function to invoke second. - * @return {function} Function that invokes the two argument functions. - * @private - */ - function createChainedFunction(one, two) { - return function chainedFunction() { - one.apply(this, arguments); - two.apply(this, arguments); - }; - } - - /** - * Binds a method to the component. - * - * @param {object} component Component whose method is going to be bound. - * @param {function} method Method to be bound. - * @return {function} The bound method. - */ - function bindAutoBindMethod(component, method) { - var boundMethod = method.bind(component); - // if (process.env.NODE_ENV !== 'production') { - // boundMethod.__reactBoundContext = component; - // boundMethod.__reactBoundMethod = method; - // boundMethod.__reactBoundArguments = null; - // var componentName = component.constructor.displayName; - // var _bind = boundMethod.bind; - // boundMethod.bind = function(newThis) { - // for ( - // var _len = arguments.length, - // args = Array(_len > 1 ? _len - 1 : 0), - // _key = 1; - // _key < _len; - // _key++ - // ) { - // args[_key - 1] = arguments[_key]; - // } - // - // // User is trying to bind() an autobound method; we effectively will - // // ignore the value of "this" that the user is trying to use, so - // // let's warn. - // if (newThis !== component && newThis !== null) { - // if (process.env.NODE_ENV !== 'production') { - // warning( - // false, - // 'bind(): React component methods may only be bound to the ' + - // 'component instance. See %s', - // componentName - // ); - // } - // } else if (!args.length) { - // if (process.env.NODE_ENV !== 'production') { - // warning( - // false, - // 'bind(): You are binding a component method to the component. ' + - // 'React does this for you automatically in a high-performance ' + - // 'way, so you can safely remove this call. See %s', - // componentName - // ); - // } - // return boundMethod; - // } - // var reboundMethod = _bind.apply(boundMethod, arguments); - // reboundMethod.__reactBoundContext = component; - // reboundMethod.__reactBoundMethod = method; - // reboundMethod.__reactBoundArguments = args; - // return reboundMethod; - // }; - // } - return boundMethod; - } - - /** - * Binds all auto-bound methods in a component. - * - * @param {object} component Component whose method is going to be bound. - */ - function bindAutoBindMethods(component) { - var pairs = component.__reactAutoBindPairs; - for (var i = 0; i < pairs.length; i += 2) { - var autoBindKey = pairs[i]; - var method = pairs[i + 1]; - component[autoBindKey] = bindAutoBindMethod(component, method); - } - } - - var IsMountedPreMixin = { - componentDidMount: function() { - this.__isMounted = true; - } - }; - - var IsMountedPostMixin = { - componentWillUnmount: function() { - this.__isMounted = false; - } - }; - - /** - * Add more to the ReactClass base class. These are all legacy features and - * therefore not already part of the modern ReactComponent. - */ - var ReactClassMixin = { - /** - * TODO: This will be deprecated because state should always keep a consistent - * type signature and the only use case for this, is to avoid that. - */ - replaceState: function(newState, callback) { - this.updater.enqueueReplaceState(this, newState, callback); - }, - - /** - * Checks whether or not this composite component is mounted. - * @return {boolean} True if mounted, false otherwise. - * @protected - * @final - */ - isMounted: function() { - // if (process.env.NODE_ENV !== 'production') { - // warning( - // this.__didWarnIsMounted, - // '%s: isMounted is deprecated. Instead, make sure to clean up ' + - // 'subscriptions and pending requests in componentWillUnmount to ' + - // 'prevent memory leaks.', - // (this.constructor && this.constructor.displayName) || - // this.name || - // 'Component' - // ); - // this.__didWarnIsMounted = true; - // } - return !!this.__isMounted; - } - }; - - var ReactClassComponent = function() {}; - _assign( - ReactClassComponent.prototype, - ReactComponent.prototype, - ReactClassMixin - ); - - /** - * Creates a composite component class given a class specification. - * See https://facebook.github.io/react/docs/top-level-api.html#react.createclass - * - * @param {object} spec Class specification (which must define `render`). - * @return {function} Component constructor function. - * @public - */ - function createClass(spec) { - // To keep our warnings more understandable, we'll use a little hack here to - // ensure that Constructor.name !== 'Constructor'. This makes sure we don't - // unnecessarily identify a class without displayName as 'Constructor'. - var Constructor = identity(function(props, context, updater) { - // This constructor gets overridden by mocks. The argument is used - // by mocks to assert on what gets mounted. - - // if (process.env.NODE_ENV !== 'production') { - // warning( - // this instanceof Constructor, - // 'Something is calling a React component directly. Use a factory or ' + - // 'JSX instead. See: https://fb.me/react-legacyfactory' - // ); - // } - - // Wire up auto-binding - if (this.__reactAutoBindPairs.length) { - bindAutoBindMethods(this); - } - - this.props = props; - this.context = context; - this.refs = emptyObject; - this.updater = updater || ReactNoopUpdateQueue; - - this.state = null; - - // ReactClasses doesn't have constructors. Instead, they use the - // getInitialState and componentWillMount methods for initialization. - - var initialState = this.getInitialState ? this.getInitialState() : null; - // if (process.env.NODE_ENV !== 'production') { - // // We allow auto-mocks to proceed as if they're returning null. - // if ( - // initialState === undefined && - // this.getInitialState._isMockFunction - // ) { - // // This is probably bad practice. Consider warning here and - // // deprecating this convenience. - // initialState = null; - // } - // } - // _invariant( - // typeof initialState === 'object' && !Array.isArray(initialState), - // '%s.getInitialState(): must return an object or null', - // Constructor.displayName || 'ReactCompositeComponent' - // ); - - this.state = initialState; - }); - Constructor.prototype = new ReactClassComponent(); - Constructor.prototype.constructor = Constructor; - Constructor.prototype.__reactAutoBindPairs = []; - - injectedMixins.forEach(mixSpecIntoComponent.bind(null, Constructor)); - - mixSpecIntoComponent(Constructor, IsMountedPreMixin); - mixSpecIntoComponent(Constructor, spec); - mixSpecIntoComponent(Constructor, IsMountedPostMixin); - - // Initialize the defaultProps property after all mixins have been merged. - if (Constructor.getDefaultProps) { - Constructor.defaultProps = Constructor.getDefaultProps(); - } - - // if (process.env.NODE_ENV !== 'production') { - // // This is a tag to indicate that the use of these method names is ok, - // // since it's used with createClass. If it's not, then it's likely a - // // mistake so we'll warn you to use the static property, property - // // initializer or constructor respectively. - // if (Constructor.getDefaultProps) { - // Constructor.getDefaultProps.isReactClassApproved = {}; - // } - // if (Constructor.prototype.getInitialState) { - // Constructor.prototype.getInitialState.isReactClassApproved = {}; - // } - // } - - // _invariant( - // Constructor.prototype.render, - // 'createClass(...): Class specification must implement a `render` method.' - // ); - - // if (process.env.NODE_ENV !== 'production') { - // warning( - // !Constructor.prototype.componentShouldUpdate, - // '%s has a method called ' + - // 'componentShouldUpdate(). Did you mean shouldComponentUpdate()? ' + - // 'The name is phrased as a question because the function is ' + - // 'expected to return a value.', - // spec.displayName || 'A component' - // ); - // warning( - // !Constructor.prototype.componentWillRecieveProps, - // '%s has a method called ' + - // 'componentWillRecieveProps(). Did you mean componentWillReceiveProps()?', - // spec.displayName || 'A component' - // ); - // } - - // Reduce time spent doing lookups by setting these on the prototype. - for (var methodName in ReactClassInterface) { - if (!Constructor.prototype[methodName]) { - Constructor.prototype[methodName] = null; - } - } - - return Constructor; - } - - return createClass; -} -|} -]; - -[@bs.module "react"] external reactComponent: 'a = "Component"; - -[@bs.module "react"] external reactIsValidElement: bool = "isValidElement"; - -[@bs.module "react"] [@bs.new] -external newReactComponent: unit => {. "updater": 'a} = "Component"; - -let reactNoopUpdateQueue = newReactComponent()##updater; - -let createClass = - factory(. reactComponent, reactIsValidElement, reactNoopUpdateQueue);