diff --git a/package-lock.json b/package-lock.json index e5e9032..f63f2f8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8,16 +8,28 @@ "name": "@rescript/react", "version": "0.13.0", "license": "MIT", + "dependencies": { + "@rescript/webapi": "^0.1.0-experimental-82a7689" + }, "devDependencies": { "react": "^18.2.0", "react-dom": "^18.2.0", - "rescript": "^11.0.0" + "rescript": "^12.0.0-alpha.5" }, "peerDependencies": { "react": ">=18.0.0", "react-dom": ">=18.0.0" } }, + "node_modules/@rescript/webapi": { + "version": "0.1.0-experimental-82a7689", + "resolved": "https://registry.npmjs.org/@rescript/webapi/-/webapi-0.1.0-experimental-82a7689.tgz", + "integrity": "sha512-9pptKyqTFS9w0BPKt3VlwpXSFrH4dFhvMncfUGgdlwq66fmrPTo57e0sdkatZp6SNdXmrdX1FYmcHDYoqzRNVg==", + "license": "MIT", + "dependencies": { + "rescript": "^12.0.0-alpha.5" + } + }, "node_modules/js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", @@ -59,18 +71,20 @@ } }, "node_modules/rescript": { - "version": "11.0.0", - "resolved": "https://registry.npmjs.org/rescript/-/rescript-11.0.0.tgz", - "integrity": "sha512-uIUwDZZmDUb7ymGkBiiGioxMg8hXh1mze/2k/qhYQcZGgi7PrLHQIW9AksM7gb9WnpjCAvFsA8U2VgC0nA468w==", - "dev": true, + "version": "12.0.0-alpha.5", + "resolved": "https://registry.npmjs.org/rescript/-/rescript-12.0.0-alpha.5.tgz", + "integrity": "sha512-s2GGg9fkoiDBiP0uuJ1RRG5NBq+SkGqxMEmt32q9tTJoueL7bfU/9Jj3UgSwFFNdehuns1taAOvP2DV4IE+R9A==", "hasInstallScript": true, + "license": "SEE LICENSE IN LICENSE", "bin": { - "bsc": "bsc", + "bsc": "cli/bsc", "bstracing": "lib/bstracing", - "rescript": "rescript" + "rescript": "cli/rescript", + "rescript-tools": "cli/rescript-tools", + "rewatch": "cli/rewatch" }, "engines": { - "node": ">=10" + "node": ">=18" } }, "node_modules/scheduler": { @@ -84,6 +98,14 @@ } }, "dependencies": { + "@rescript/webapi": { + "version": "0.1.0-experimental-82a7689", + "resolved": "https://registry.npmjs.org/@rescript/webapi/-/webapi-0.1.0-experimental-82a7689.tgz", + "integrity": "sha512-9pptKyqTFS9w0BPKt3VlwpXSFrH4dFhvMncfUGgdlwq66fmrPTo57e0sdkatZp6SNdXmrdX1FYmcHDYoqzRNVg==", + "requires": { + "rescript": "^12.0.0-alpha.5" + } + }, "js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", @@ -119,10 +141,9 @@ } }, "rescript": { - "version": "11.0.0", - "resolved": "https://registry.npmjs.org/rescript/-/rescript-11.0.0.tgz", - "integrity": "sha512-uIUwDZZmDUb7ymGkBiiGioxMg8hXh1mze/2k/qhYQcZGgi7PrLHQIW9AksM7gb9WnpjCAvFsA8U2VgC0nA468w==", - "dev": true + "version": "12.0.0-alpha.5", + "resolved": "https://registry.npmjs.org/rescript/-/rescript-12.0.0-alpha.5.tgz", + "integrity": "sha512-s2GGg9fkoiDBiP0uuJ1RRG5NBq+SkGqxMEmt32q9tTJoueL7bfU/9Jj3UgSwFFNdehuns1taAOvP2DV4IE+R9A==" }, "scheduler": { "version": "0.23.0", diff --git a/package.json b/package.json index e82f7f1..173ccdf 100644 --- a/package.json +++ b/package.json @@ -30,10 +30,13 @@ "devDependencies": { "react": "^18.2.0", "react-dom": "^18.2.0", - "rescript": "^11.0.0" + "rescript": "^12.0.0-alpha.5" }, "peerDependencies": { "react": ">=18.0.0", "react-dom": ">=18.0.0" + }, + "dependencies": { + "@rescript/webapi": "^0.1.0-experimental-82a7689" } } diff --git a/rescript.json b/rescript.json index c13a738..a9a82af 100644 --- a/rescript.json +++ b/rescript.json @@ -5,8 +5,11 @@ "mode": "classic" }, "sources": [{ "dir": "src", "subdirs": true }], - "package-specs": [{ "module": "commonjs", "in-source": true }], + "package-specs": [{ "module": "esmodule", "in-source": true }], "suffix": ".bs.js", + "bs-dependencies": [ + "@rescript/webapi" + ], "bs-dev-dependencies": [], "bsc-flags": [], "uncurried": false diff --git a/src/React.bs.js b/src/React.bs.js index 08a9db0..b944027 100644 --- a/src/React.bs.js +++ b/src/React.bs.js @@ -1,37 +1,35 @@ // Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; -var Curry = require("rescript/lib/js/curry.js"); -var React = require("react"); +import * as React from "react"; -var Ref = {}; +let Ref = {}; -var Children = {}; +let Children = {}; -var Context = {}; +let Context = {}; -var Fragment = {}; +let Fragment = {}; -var StrictMode = {}; +let StrictMode = {}; -var Suspense = {}; +let Suspense = {}; function lazy_(load) { - return React.lazy(async function (param) { - return { - default: await Curry._1(load, undefined) - }; - }); + return React.lazy(async () => ({ + default: await load() + })); } -var Uncurried = {}; - -exports.Ref = Ref; -exports.Children = Children; -exports.Context = Context; -exports.Fragment = Fragment; -exports.StrictMode = StrictMode; -exports.Suspense = Suspense; -exports.lazy_ = lazy_; -exports.Uncurried = Uncurried; +let Uncurried = {}; + +export { + Ref, + Children, + Context, + Fragment, + StrictMode, + Suspense, + lazy_, + Uncurried, +} /* react Not a pure module */ diff --git a/src/ReactDOM.bs.js b/src/ReactDOM.bs.js index b65084d..1576e0b 100644 --- a/src/ReactDOM.bs.js +++ b/src/ReactDOM.bs.js @@ -1,21 +1,22 @@ // Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; -var Root = {}; +let Root = {}; -var Client = { +let Client = { Root: Root }; -var Ref = {}; +let Ref = {}; -var Props = {}; +let Props = {}; -var Style; +let Style; -exports.Client = Client; -exports.Ref = Ref; -exports.Props = Props; -exports.Style = Style; +export { + Client, + Ref, + Props, + Style, +} /* No side effect */ diff --git a/src/ReactDOM.res b/src/ReactDOM.res index 72bce53..7853681 100644 --- a/src/ReactDOM.res +++ b/src/ReactDOM.res @@ -6,14 +6,17 @@ calls and add the appropriate `require("react-dom")` in the file calling this `render` */ // Helper so that ReactDOM itself doesn't bring any runtime + +open WebAPI + @val @return(nullable) -external querySelector: string => option = "document.querySelector" +external querySelector: string => option = "document.querySelector" @module("react-dom") @deprecated( "ReactDOM.render is no longer supported in React 18. Use ReactDOM.Client.createRoot instead." ) -external render: (React.element, Dom.element) => unit = "render" +external render: (React.element, DOMAPI.element) => unit = "render" module Client = { module Root = { @@ -25,28 +28,28 @@ module Client = { } @module("react-dom/client") - external createRoot: Dom.element => Root.t = "createRoot" + external createRoot: DOMAPI.element => Root.t = "createRoot" @module("react-dom/client") - external hydrateRoot: (Dom.element, React.element) => Root.t = "hydrateRoot" + external hydrateRoot: (DOMAPI.element, React.element) => Root.t = "hydrateRoot" } @module("react-dom") @deprecated( "ReactDOM.hydrate is no longer supported in React 18. Use ReactDOM.Client.hydrateRoot instead." ) -external hydrate: (React.element, Dom.element) => unit = "hydrate" +external hydrate: (React.element, DOMAPI.element) => unit = "hydrate" @module("react-dom") -external createPortal: (React.element, Dom.element) => React.element = "createPortal" +external createPortal: (React.element, DOMAPI.element) => React.element = "createPortal" @module("react-dom") @deprecated( "ReactDOM.unmountComponentAtNode is no longer supported in React 18. Use ReactDOM.Client.Root.unmount instead." ) -external unmountComponentAtNode: Dom.element => unit = "unmountComponentAtNode" +external unmountComponentAtNode: DOMAPI.element => unit = "unmountComponentAtNode" -external domElementToObj: Dom.element => {..} = "%identity" +external domElementToObj: DOMAPI.element => {..} = "%identity" type style = ReactDOMStyle.t @@ -54,8 +57,8 @@ type domRef = JsxDOM.domRef module Ref = { type t = domRef - type currentDomRef = React.ref> - type callbackDomRef = Js.nullable => unit + type currentDomRef = React.ref> + type callbackDomRef = Js.nullable => unit external domRef: currentDomRef => domRef = "%identity" external callbackDomRef: callbackDomRef => domRef = "%identity" @@ -77,7 +80,7 @@ module Props = { @optional key: string, @optional - ref: Js.nullable => unit, + ref: Js.nullable => unit, /* accessibility */ /* https://www.w3.org/TR/wai-aria-1.1/ */ /* https://accessibilityresources.org/ is a great resource for these */ diff --git a/src/ReactDOMStyle.bs.js b/src/ReactDOMStyle.bs.js index 18702c8..f7f5e14 100644 --- a/src/ReactDOMStyle.bs.js +++ b/src/ReactDOMStyle.bs.js @@ -1,12 +1,13 @@ // Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; function unsafeAddProp(style, key, value) { - var dict = {}; + let dict = {}; dict[key] = value; return Object.assign({}, style, dict); } -exports.unsafeAddProp = unsafeAddProp; +export { + unsafeAddProp, +} /* No side effect */ diff --git a/src/ReactEvent.bs.js b/src/ReactEvent.bs.js index 179cde2..5303ddd 100644 --- a/src/ReactEvent.bs.js +++ b/src/ReactEvent.bs.js @@ -1,53 +1,54 @@ // Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; -var Synthetic = {}; +let Synthetic = {}; -var Clipboard = {}; +let Clipboard = {}; -var Composition = {}; +let Composition = {}; -var Keyboard = {}; +let Keyboard = {}; -var Focus = {}; +let Focus = {}; -var Form = {}; +let Form = {}; -var Mouse = {}; +let Mouse = {}; -var Pointer = {}; +let Pointer = {}; -var $$Selection = {}; +let Selection = {}; -var $$Touch = {}; +let Touch = {}; -var UI = {}; +let UI = {}; -var Wheel = {}; +let Wheel = {}; -var Media = {}; +let Media = {}; -var $$Image = {}; +let Image = {}; -var $$Animation = {}; +let Animation = {}; -var Transition = {}; +let Transition = {}; -exports.Synthetic = Synthetic; -exports.Clipboard = Clipboard; -exports.Composition = Composition; -exports.Keyboard = Keyboard; -exports.Focus = Focus; -exports.Form = Form; -exports.Mouse = Mouse; -exports.Pointer = Pointer; -exports.$$Selection = $$Selection; -exports.$$Touch = $$Touch; -exports.UI = UI; -exports.Wheel = Wheel; -exports.Media = Media; -exports.$$Image = $$Image; -exports.$$Animation = $$Animation; -exports.Transition = Transition; +export { + Synthetic, + Clipboard, + Composition, + Keyboard, + Focus, + Form, + Mouse, + Pointer, + Selection, + Touch, + UI, + Wheel, + Media, + Image, + Animation, + Transition, +} /* No side effect */ diff --git a/src/ReactEvent.res b/src/ReactEvent.res index 2d927a1..1ee6efb 100644 --- a/src/ReactEvent.res +++ b/src/ReactEvent.res @@ -5,40 +5,43 @@ module MakeEventWithType = ( type t }, ) => { + open WebAPI + @get external bubbles: Type.t => bool = "bubbles" @get external cancelable: Type.t => bool = "cancelable" @get - external currentTarget: Type.t => {..} = "currentTarget" /* Should return Dom.eventTarget */ + external currentTarget: Type.t => DOMAPI.node = "currentTarget" @get external defaultPrevented: Type.t => bool = "defaultPrevented" @get external eventPhase: Type.t => int = "eventPhase" @get external isTrusted: Type.t => bool = "isTrusted" - @get external nativeEvent: Type.t => {..} = "nativeEvent" /* Should return Dom.event */ + @get external nativeEvent: Type.t => EventAPI.event = "nativeEvent" @send external preventDefault: Type.t => unit = "preventDefault" @send external isDefaultPrevented: Type.t => bool = "isDefaultPrevented" @send external stopPropagation: Type.t => unit = "stopPropagation" @send external isPropagationStopped: Type.t => bool = "isPropagationStopped" - @get external target: Type.t => {..} = "target" /* Should return Dom.eventTarget */ + @get external target: Type.t => DOMAPI.node = "target" @get external timeStamp: Type.t => float = "timeStamp" @get external type_: Type.t => string = "type" @send external persist: Type.t => unit = "persist" } +open WebAPI + module Synthetic = { type tag = JsxEvent.Synthetic.tag type t = synthetic @get external bubbles: synthetic<'a> => bool = "bubbles" @get external cancelable: synthetic<'a> => bool = "cancelable" @get - external currentTarget: synthetic<'a> => {..} = - "currentTarget" /* Should return Dom.eventTarget */ + external currentTarget: synthetic<'a> => DOMAPI.node = "currentTarget" @get external defaultPrevented: synthetic<'a> => bool = "defaultPrevented" @get external eventPhase: synthetic<'a> => int = "eventPhase" @get external isTrusted: synthetic<'a> => bool = "isTrusted" @get - external nativeEvent: synthetic<'a> => {..} = "nativeEvent" /* Should return Dom.event */ + external nativeEvent: synthetic<'a> => EventAPI.event = "nativeEvent" @send external preventDefault: synthetic<'a> => unit = "preventDefault" @send @@ -47,7 +50,7 @@ module Synthetic = { external stopPropagation: synthetic<'a> => unit = "stopPropagation" @send external isPropagationStopped: synthetic<'a> => bool = "isPropagationStopped" - @get external target: synthetic<'a> => {..} = "target" /* Should return Dom.eventTarget */ + @get external target: synthetic<'a> => DOMAPI.node = "target" @get external timeStamp: synthetic<'a> => float = "timeStamp" @get external type_: synthetic<'a> => string = "type" @send external persist: synthetic<'a> => unit = "persist" @@ -62,7 +65,7 @@ module Clipboard = { include MakeEventWithType({ type t = t }) - @get external clipboardData: t => {..} = "clipboardData" /* Should return Dom.dataTransfer */ + @get external clipboardData: t => WebAPI.UIEventsAPI.dataTransfer = "clipboardData" } module Composition = { @@ -103,7 +106,7 @@ module Focus = { type t = t }) @get @return(nullable) - external relatedTarget: t => option<{..}> = "relatedTarget" /* Should return Dom.eventTarget */ + external relatedTarget: t => option = "relatedTarget" } module Form = { @@ -134,7 +137,7 @@ module Mouse = { @get external pageX: t => int = "pageX" @get external pageY: t => int = "pageY" @get @return(nullable) - external relatedTarget: t => option<{..}> = "relatedTarget" /* Should return Dom.eventTarget */ + external relatedTarget: t => option = "relatedTarget" @get external screenX: t => int = "screenX" @get external screenY: t => int = "screenY" @get external shiftKey: t => bool = "shiftKey" @@ -149,7 +152,7 @@ module Pointer = { // UIEvent @get external detail: t => int = "detail" - @get external view: t => Dom.window = "view" /* Should return DOMAbstractView/WindowProxy */ + @get external view: t => DOMAPI.window = "view" // MouseEvent @get external screenX: t => int = "screenX" @@ -172,7 +175,7 @@ module Pointer = { @get external buttons: t => int = "buttons" @get @return(nullable) - external relatedTarget: t => option<{..}> = "relatedTarget" /* Should return Dom.eventTarget */ + external relatedTarget: t => option = "relatedTarget" // PointerEvent @get external pointerId: t => Dom.eventPointerId = "pointerId" @@ -202,14 +205,14 @@ module Touch = { type t = t }) @get external altKey: t => bool = "altKey" - @get external changedTouches: t => {..} = "changedTouches" /* Should return Dom.touchList */ + @get external changedTouches: t => UIEventsAPI.touchList = "changedTouches" @get external ctrlKey: t => bool = "ctrlKey" @send external getModifierState: (t, string) => bool = "getModifierState" @get external metaKey: t => bool = "metaKey" @get external shiftKey: t => bool = "shiftKey" - @get external targetTouches: t => {..} = "targetTouches" /* Should return Dom.touchList */ - @get external touches: t => {..} = "touches" /* Should return Dom.touchList */ + @get external targetTouches: t => UIEventsAPI.touchList = "targetTouches" + @get external touches: t => UIEventsAPI.touchList = "touches" } module UI = { @@ -219,7 +222,7 @@ module UI = { type t = t }) @get external detail: t => int = "detail" - @get external view: t => Dom.window = "view" /* Should return DOMAbstractView/WindowProxy */ + @get external view: t => DOMAPI.window = "view" } module Wheel = { diff --git a/src/ReactEvent.resi b/src/ReactEvent.resi index 61b5d4b..eb9132c 100644 --- a/src/ReactEvent.resi +++ b/src/ReactEvent.resi @@ -38,19 +38,21 @@ */ type synthetic<'a> = JsxEvent.synthetic<'a> +open WebAPI + module Synthetic: { type tag = JsxEvent.Synthetic.tag type t = synthetic @get external bubbles: synthetic<'a> => bool = "bubbles" @get external cancelable: synthetic<'a> => bool = "cancelable" @get - external currentTarget: synthetic<'a> => {..} = "currentTarget" + external currentTarget: synthetic<'a> => DOMAPI.node = "currentTarget" @get external defaultPrevented: synthetic<'a> => bool = "defaultPrevented" @get external eventPhase: synthetic<'a> => int = "eventPhase" @get external isTrusted: synthetic<'a> => bool = "isTrusted" @get - external nativeEvent: synthetic<'a> => {..} = "nativeEvent" + external nativeEvent: synthetic<'a> => EventAPI.event = "nativeEvent" @send external preventDefault: synthetic<'a> => unit = "preventDefault" @send @@ -59,7 +61,7 @@ module Synthetic: { external stopPropagation: synthetic<'a> => unit = "stopPropagation" @send external isPropagationStopped: synthetic<'a> => bool = "isPropagationStopped" - @get external target: synthetic<'a> => {..} = "target" + @get external target: synthetic<'a> => DOMAPI.node = "target" @get external timeStamp: synthetic<'a> => float = "timeStamp" @get external type_: synthetic<'a> => string = "type" @send external persist: synthetic<'a> => unit = "persist" @@ -73,20 +75,20 @@ module Clipboard: { type t = synthetic @get external bubbles: t => bool = "bubbles" @get external cancelable: t => bool = "cancelable" - @get external currentTarget: t => {..} = "currentTarget" + @get external currentTarget: t => DOMAPI.node = "currentTarget" @get external defaultPrevented: t => bool = "defaultPrevented" @get external eventPhase: t => int = "eventPhase" @get external isTrusted: t => bool = "isTrusted" - @get external nativeEvent: t => {..} = "nativeEvent" + @get external nativeEvent: t => EventAPI.event = "nativeEvent" @send external preventDefault: t => unit = "preventDefault" @send external isDefaultPrevented: t => bool = "isDefaultPrevented" @send external stopPropagation: t => unit = "stopPropagation" @send external isPropagationStopped: t => bool = "isPropagationStopped" - @get external target: t => {..} = "target" + @get external target: t => DOMAPI.node = "target" @get external timeStamp: t => float = "timeStamp" @get external type_: t => string = "type" @send external persist: t => unit = "persist" - @get external clipboardData: t => {..} = "clipboardData" /* Should return Dom.dataTransfer */ + @get external clipboardData: t => WebAPI.UIEventsAPI.dataTransfer = "clipboardData" } module Composition: { @@ -94,16 +96,16 @@ module Composition: { type t = synthetic @get external bubbles: t => bool = "bubbles" @get external cancelable: t => bool = "cancelable" - @get external currentTarget: t => {..} = "currentTarget" + @get external currentTarget: t => DOMAPI.node = "currentTarget" @get external defaultPrevented: t => bool = "defaultPrevented" @get external eventPhase: t => int = "eventPhase" @get external isTrusted: t => bool = "isTrusted" - @get external nativeEvent: t => {..} = "nativeEvent" + @get external nativeEvent: t => EventAPI.event = "nativeEvent" @send external preventDefault: t => unit = "preventDefault" @send external isDefaultPrevented: t => bool = "isDefaultPrevented" @send external stopPropagation: t => unit = "stopPropagation" @send external isPropagationStopped: t => bool = "isPropagationStopped" - @get external target: t => {..} = "target" + @get external target: t => DOMAPI.node = "target" @get external timeStamp: t => float = "timeStamp" @get external type_: t => string = "type" @send external persist: t => unit = "persist" @@ -115,16 +117,16 @@ module Keyboard: { type t = synthetic @get external bubbles: t => bool = "bubbles" @get external cancelable: t => bool = "cancelable" - @get external currentTarget: t => {..} = "currentTarget" + @get external currentTarget: t => DOMAPI.node = "currentTarget" @get external defaultPrevented: t => bool = "defaultPrevented" @get external eventPhase: t => int = "eventPhase" @get external isTrusted: t => bool = "isTrusted" - @get external nativeEvent: t => {..} = "nativeEvent" + @get external nativeEvent: t => EventAPI.event = "nativeEvent" @send external preventDefault: t => unit = "preventDefault" @send external isDefaultPrevented: t => bool = "isDefaultPrevented" @send external stopPropagation: t => unit = "stopPropagation" @send external isPropagationStopped: t => bool = "isPropagationStopped" - @get external target: t => {..} = "target" + @get external target: t => DOMAPI.node = "target" @get external timeStamp: t => float = "timeStamp" @get external type_: t => string = "type" @send external persist: t => unit = "persist" @@ -149,21 +151,21 @@ module Focus: { type t = synthetic @get external bubbles: t => bool = "bubbles" @get external cancelable: t => bool = "cancelable" - @get external currentTarget: t => {..} = "currentTarget" + @get external currentTarget: t => DOMAPI.node = "currentTarget" @get external defaultPrevented: t => bool = "defaultPrevented" @get external eventPhase: t => int = "eventPhase" @get external isTrusted: t => bool = "isTrusted" - @get external nativeEvent: t => {..} = "nativeEvent" + @get external nativeEvent: t => EventAPI.event = "nativeEvent" @send external preventDefault: t => unit = "preventDefault" @send external isDefaultPrevented: t => bool = "isDefaultPrevented" @send external stopPropagation: t => unit = "stopPropagation" @send external isPropagationStopped: t => bool = "isPropagationStopped" - @get external target: t => {..} = "target" + @get external target: t => DOMAPI.node = "target" @get external timeStamp: t => float = "timeStamp" @get external type_: t => string = "type" @send external persist: t => unit = "persist" @get @return(nullable) - external relatedTarget: t => option<{..}> = "relatedTarget" /* Should return Dom.eventTarget */ + external relatedTarget: t => option = "relatedTarget" } module Form: { @@ -171,16 +173,16 @@ module Form: { type t = synthetic @get external bubbles: t => bool = "bubbles" @get external cancelable: t => bool = "cancelable" - @get external currentTarget: t => {..} = "currentTarget" + @get external currentTarget: t => DOMAPI.node = "currentTarget" @get external defaultPrevented: t => bool = "defaultPrevented" @get external eventPhase: t => int = "eventPhase" @get external isTrusted: t => bool = "isTrusted" - @get external nativeEvent: t => {..} = "nativeEvent" + @get external nativeEvent: t => EventAPI.event = "nativeEvent" @send external preventDefault: t => unit = "preventDefault" @send external isDefaultPrevented: t => bool = "isDefaultPrevented" @send external stopPropagation: t => unit = "stopPropagation" @send external isPropagationStopped: t => bool = "isPropagationStopped" - @get external target: t => {..} = "target" + @get external target: t => DOMAPI.node = "target" @get external timeStamp: t => float = "timeStamp" @get external type_: t => string = "type" @send external persist: t => unit = "persist" @@ -191,16 +193,16 @@ module Mouse: { type t = synthetic @get external bubbles: t => bool = "bubbles" @get external cancelable: t => bool = "cancelable" - @get external currentTarget: t => {..} = "currentTarget" + @get external currentTarget: t => DOMAPI.node = "currentTarget" @get external defaultPrevented: t => bool = "defaultPrevented" @get external eventPhase: t => int = "eventPhase" @get external isTrusted: t => bool = "isTrusted" - @get external nativeEvent: t => {..} = "nativeEvent" + @get external nativeEvent: t => EventAPI.event = "nativeEvent" @send external preventDefault: t => unit = "preventDefault" @send external isDefaultPrevented: t => bool = "isDefaultPrevented" @send external stopPropagation: t => unit = "stopPropagation" @send external isPropagationStopped: t => bool = "isPropagationStopped" - @get external target: t => {..} = "target" + @get external target: t => DOMAPI.node = "target" @get external timeStamp: t => float = "timeStamp" @get external type_: t => string = "type" @send external persist: t => unit = "persist" @@ -218,7 +220,7 @@ module Mouse: { @get external pageX: t => int = "pageX" @get external pageY: t => int = "pageY" @get @return(nullable) - external relatedTarget: t => option<{..}> = "relatedTarget" /* Should return Dom.eventTarget */ + external relatedTarget: t => option = "relatedTarget" @get external screenX: t => int = "screenX" @get external screenY: t => int = "screenY" @get external shiftKey: t => bool = "shiftKey" @@ -230,8 +232,8 @@ module Pointer: { // Event @get external type_: t => string = "type" - @get external target: t => {..} = "target" - @get external currentTarget: t => {..} = "currentTarget" + @get external target: t => DOMAPI.node = "target" + @get external currentTarget: t => DOMAPI.node = "currentTarget" @get external eventPhase: t => int = "eventPhase" @@ -245,14 +247,14 @@ module Pointer: { @get external timeStamp: t => float = "timeStamp" // SyntheticEvent - @get external nativeEvent: t => {..} = "nativeEvent" + @get external nativeEvent: t => EventAPI.event = "nativeEvent" @send external isDefaultPrevented: t => bool = "isDefaultPrevented" @send external isPropagationStopped: t => bool = "isPropagationStopped" @send external persist: t => unit = "persist" // UIEvent @get external detail: t => int = "detail" - @get external view: t => Dom.window = "view" /* Should return DOMAbstractView/WindowProxy */ + @get external view: t => DOMAPI.window = "view" // MouseEvent @get external screenX: t => int = "screenX" @@ -275,7 +277,7 @@ module Pointer: { @get external buttons: t => int = "buttons" @get @return(nullable) - external relatedTarget: t => option<{..}> = "relatedTarget" /* Should return Dom.eventTarget */ + external relatedTarget: t => option = "relatedTarget" // PointerEvent @get external pointerId: t => Dom.eventPointerId = "pointerId" @@ -295,16 +297,16 @@ module Selection: { type t = synthetic @get external bubbles: t => bool = "bubbles" @get external cancelable: t => bool = "cancelable" - @get external currentTarget: t => {..} = "currentTarget" + @get external currentTarget: t => DOMAPI.node = "currentTarget" @get external defaultPrevented: t => bool = "defaultPrevented" @get external eventPhase: t => int = "eventPhase" @get external isTrusted: t => bool = "isTrusted" - @get external nativeEvent: t => {..} = "nativeEvent" + @get external nativeEvent: t => EventAPI.event = "nativeEvent" @send external preventDefault: t => unit = "preventDefault" @send external isDefaultPrevented: t => bool = "isDefaultPrevented" @send external stopPropagation: t => unit = "stopPropagation" @send external isPropagationStopped: t => bool = "isPropagationStopped" - @get external target: t => {..} = "target" + @get external target: t => DOMAPI.node = "target" @get external timeStamp: t => float = "timeStamp" @get external type_: t => string = "type" @send external persist: t => unit = "persist" @@ -315,28 +317,28 @@ module Touch: { type t = synthetic @get external bubbles: t => bool = "bubbles" @get external cancelable: t => bool = "cancelable" - @get external currentTarget: t => {..} = "currentTarget" + @get external currentTarget: t => DOMAPI.node = "currentTarget" @get external defaultPrevented: t => bool = "defaultPrevented" @get external eventPhase: t => int = "eventPhase" @get external isTrusted: t => bool = "isTrusted" - @get external nativeEvent: t => {..} = "nativeEvent" + @get external nativeEvent: t => EventAPI.event = "nativeEvent" @send external preventDefault: t => unit = "preventDefault" @send external isDefaultPrevented: t => bool = "isDefaultPrevented" @send external stopPropagation: t => unit = "stopPropagation" @send external isPropagationStopped: t => bool = "isPropagationStopped" - @get external target: t => {..} = "target" + @get external target: t => DOMAPI.node = "target" @get external timeStamp: t => float = "timeStamp" @get external type_: t => string = "type" @send external persist: t => unit = "persist" @get external altKey: t => bool = "altKey" - @get external changedTouches: t => {..} = "changedTouches" /* Should return Dom.touchList */ + @get external changedTouches: t => UIEventsAPI.touchList = "changedTouches" @get external ctrlKey: t => bool = "ctrlKey" @send external getModifierState: (t, string) => bool = "getModifierState" @get external metaKey: t => bool = "metaKey" @get external shiftKey: t => bool = "shiftKey" - @get external targetTouches: t => {..} = "targetTouches" /* Should return Dom.touchList */ - @get external touches: t => {..} = "touches" /* Should return Dom.touchList */ + @get external targetTouches: t => UIEventsAPI.touchList = "targetTouches" + @get external touches: t => UIEventsAPI.touchList = "touches" } module UI: { @@ -344,21 +346,21 @@ module UI: { type t = synthetic @get external bubbles: t => bool = "bubbles" @get external cancelable: t => bool = "cancelable" - @get external currentTarget: t => {..} = "currentTarget" + @get external currentTarget: t => DOMAPI.node = "currentTarget" @get external defaultPrevented: t => bool = "defaultPrevented" @get external eventPhase: t => int = "eventPhase" @get external isTrusted: t => bool = "isTrusted" - @get external nativeEvent: t => {..} = "nativeEvent" + @get external nativeEvent: t => EventAPI.event = "nativeEvent" @send external preventDefault: t => unit = "preventDefault" @send external isDefaultPrevented: t => bool = "isDefaultPrevented" @send external stopPropagation: t => unit = "stopPropagation" @send external isPropagationStopped: t => bool = "isPropagationStopped" - @get external target: t => {..} = "target" + @get external target: t => DOMAPI.node = "target" @get external timeStamp: t => float = "timeStamp" @get external type_: t => string = "type" @send external persist: t => unit = "persist" @get external detail: t => int = "detail" - @get external view: t => Dom.window = "view" /* Should return DOMAbstractView/WindowProxy */ + @get external view: t => DOMAPI.window = "view" } module Wheel: { @@ -366,16 +368,16 @@ module Wheel: { type t = synthetic @get external bubbles: t => bool = "bubbles" @get external cancelable: t => bool = "cancelable" - @get external currentTarget: t => {..} = "currentTarget" + @get external currentTarget: t => DOMAPI.node = "currentTarget" @get external defaultPrevented: t => bool = "defaultPrevented" @get external eventPhase: t => int = "eventPhase" @get external isTrusted: t => bool = "isTrusted" - @get external nativeEvent: t => {..} = "nativeEvent" + @get external nativeEvent: t => EventAPI.event = "nativeEvent" @send external preventDefault: t => unit = "preventDefault" @send external isDefaultPrevented: t => bool = "isDefaultPrevented" @send external stopPropagation: t => unit = "stopPropagation" @send external isPropagationStopped: t => bool = "isPropagationStopped" - @get external target: t => {..} = "target" + @get external target: t => DOMAPI.node = "target" @get external timeStamp: t => float = "timeStamp" @get external type_: t => string = "type" @send external persist: t => unit = "persist" @@ -390,16 +392,16 @@ module Media: { type t = synthetic @get external bubbles: t => bool = "bubbles" @get external cancelable: t => bool = "cancelable" - @get external currentTarget: t => {..} = "currentTarget" + @get external currentTarget: t => DOMAPI.node = "currentTarget" @get external defaultPrevented: t => bool = "defaultPrevented" @get external eventPhase: t => int = "eventPhase" @get external isTrusted: t => bool = "isTrusted" - @get external nativeEvent: t => {..} = "nativeEvent" + @get external nativeEvent: t => EventAPI.event = "nativeEvent" @send external preventDefault: t => unit = "preventDefault" @send external isDefaultPrevented: t => bool = "isDefaultPrevented" @send external stopPropagation: t => unit = "stopPropagation" @send external isPropagationStopped: t => bool = "isPropagationStopped" - @get external target: t => {..} = "target" + @get external target: t => DOMAPI.node = "target" @get external timeStamp: t => float = "timeStamp" @get external type_: t => string = "type" @send external persist: t => unit = "persist" @@ -410,16 +412,16 @@ module Image: { type t = synthetic @get external bubbles: t => bool = "bubbles" @get external cancelable: t => bool = "cancelable" - @get external currentTarget: t => {..} = "currentTarget" + @get external currentTarget: t => DOMAPI.node = "currentTarget" @get external defaultPrevented: t => bool = "defaultPrevented" @get external eventPhase: t => int = "eventPhase" @get external isTrusted: t => bool = "isTrusted" - @get external nativeEvent: t => {..} = "nativeEvent" + @get external nativeEvent: t => EventAPI.event = "nativeEvent" @send external preventDefault: t => unit = "preventDefault" @send external isDefaultPrevented: t => bool = "isDefaultPrevented" @send external stopPropagation: t => unit = "stopPropagation" @send external isPropagationStopped: t => bool = "isPropagationStopped" - @get external target: t => {..} = "target" + @get external target: t => DOMAPI.node = "target" @get external timeStamp: t => float = "timeStamp" @get external type_: t => string = "type" @send external persist: t => unit = "persist" @@ -430,16 +432,16 @@ module Animation: { type t = synthetic @get external bubbles: t => bool = "bubbles" @get external cancelable: t => bool = "cancelable" - @get external currentTarget: t => {..} = "currentTarget" + @get external currentTarget: t => DOMAPI.node = "currentTarget" @get external defaultPrevented: t => bool = "defaultPrevented" @get external eventPhase: t => int = "eventPhase" @get external isTrusted: t => bool = "isTrusted" - @get external nativeEvent: t => {..} = "nativeEvent" + @get external nativeEvent: t => EventAPI.event = "nativeEvent" @send external preventDefault: t => unit = "preventDefault" @send external isDefaultPrevented: t => bool = "isDefaultPrevented" @send external stopPropagation: t => unit = "stopPropagation" @send external isPropagationStopped: t => bool = "isPropagationStopped" - @get external target: t => {..} = "target" + @get external target: t => DOMAPI.node = "target" @get external timeStamp: t => float = "timeStamp" @get external type_: t => string = "type" @send external persist: t => unit = "persist" @@ -453,16 +455,16 @@ module Transition: { type t = synthetic @get external bubbles: t => bool = "bubbles" @get external cancelable: t => bool = "cancelable" - @get external currentTarget: t => {..} = "currentTarget" + @get external currentTarget: t => DOMAPI.node = "currentTarget" @get external defaultPrevented: t => bool = "defaultPrevented" @get external eventPhase: t => int = "eventPhase" @get external isTrusted: t => bool = "isTrusted" - @get external nativeEvent: t => {..} = "nativeEvent" + @get external nativeEvent: t => EventAPI.event = "nativeEvent" @send external preventDefault: t => unit = "preventDefault" @send external isDefaultPrevented: t => bool = "isDefaultPrevented" @send external stopPropagation: t => unit = "stopPropagation" @send external isPropagationStopped: t => bool = "isPropagationStopped" - @get external target: t => {..} = "target" + @get external target: t => DOMAPI.node = "target" @get external timeStamp: t => float = "timeStamp" @get external type_: t => string = "type" @send external persist: t => unit = "persist" diff --git a/src/ReactTestUtils.bs.js b/src/ReactTestUtils.bs.js index 9913094..faad66c 100644 --- a/src/ReactTestUtils.bs.js +++ b/src/ReactTestUtils.bs.js @@ -1,42 +1,38 @@ // Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; -var Curry = require("rescript/lib/js/curry.js"); -var Caml_option = require("rescript/lib/js/caml_option.js"); -var TestUtils = require("react-dom/test-utils"); +import * as Primitive_option from "rescript/lib/es6/Primitive_option.js"; +import * as TestUtils from "react-dom/test-utils"; function act(func) { - var reactFunc = function () { - Curry._1(func, undefined); + let reactFunc = () => { + func(); }; TestUtils.act(reactFunc); } function actAsync(func) { - return TestUtils.act(function () { - return Curry._1(func, undefined); - }); + return TestUtils.act(() => func()); } function changeWithValue(element, value) { - var $$event = { + let event = { target: { value: value } }; - TestUtils.Simulate.change(element, $$event); + TestUtils.Simulate.change(element, event); } function changeWithChecked(element, value) { - var $$event = { + let event = { target: { checked: value } }; - TestUtils.Simulate.change(element, $$event); + TestUtils.Simulate.change(element, event); } -var Simulate = { +let Simulate = { changeWithValue: changeWithValue, changeWithChecked: changeWithChecked }; @@ -50,18 +46,14 @@ function findByAllSelector(element, selector) { } function findBySelectorAndTextContent(element, selector, content) { - return Caml_option.undefined_to_opt(Array.from(element.querySelectorAll(selector)).find(function (node) { - return node.textContent === content; - })); + return Primitive_option.fromUndefined(Array.from(element.querySelectorAll(selector)).find(node => node.textContent === content)); } function findBySelectorAndPartialTextContent(element, selector, content) { - return Caml_option.undefined_to_opt(Array.from(element.querySelectorAll(selector)).find(function (node) { - return node.textContent.includes(content); - })); + return Primitive_option.fromUndefined(Array.from(element.querySelectorAll(selector)).find(node => node.textContent.includes(content))); } -var DOM = { +let DOM = { findBySelector: findBySelector, findByAllSelector: findByAllSelector, findBySelectorAndTextContent: findBySelectorAndTextContent, @@ -69,38 +61,40 @@ var DOM = { }; function prepareContainer(container, param) { - var containerElement = document.createElement("div"); - var body = document.body; + let containerElement = document.createElement("div"); + let body = document.body; if (body !== undefined) { - Caml_option.valFromOption(body).appendChild(containerElement); + Primitive_option.valFromOption(body).appendChild(containerElement); } - container.contents = Caml_option.some(containerElement); + container.contents = Primitive_option.some(containerElement); } function cleanupContainer(container, param) { - var contents = container.contents; + let contents = container.contents; if (contents !== undefined) { - Caml_option.valFromOption(contents).remove(); + Primitive_option.valFromOption(contents).remove(); } container.contents = undefined; } function getContainer(container) { - var contents = container.contents; + let contents = container.contents; if (contents !== undefined) { - return Caml_option.valFromOption(contents); + return Primitive_option.valFromOption(contents); } throw { - RE_EXN_ID: "Not_found", - Error: new Error() - }; + RE_EXN_ID: "Not_found", + Error: new Error() + }; } -exports.act = act; -exports.actAsync = actAsync; -exports.Simulate = Simulate; -exports.DOM = DOM; -exports.prepareContainer = prepareContainer; -exports.cleanupContainer = cleanupContainer; -exports.getContainer = getContainer; +export { + act, + actAsync, + Simulate, + DOM, + prepareContainer, + cleanupContainer, + getContainer, +} /* react-dom/test-utils Not a pure module */ diff --git a/src/RescriptReactErrorBoundary.bs.js b/src/RescriptReactErrorBoundary.bs.js index fe5f73e..a491d09 100644 --- a/src/RescriptReactErrorBoundary.bs.js +++ b/src/RescriptReactErrorBoundary.bs.js @@ -1,11 +1,10 @@ // Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; -var React = require("react"); +import * as React from "react"; -var noOp = (function (_x) {}); +let noOp = (function (_x) {}); -var reactComponentClass = React.Component; +let reactComponentClass = React.Component; noOp(reactComponentClass); @@ -27,7 +26,9 @@ var ErrorBoundary = (function (Component) { })(reactComponentClass); ; -var make = ErrorBoundary; +let make = ErrorBoundary; -exports.make = make; +export { + make, +} /* reactComponentClass Not a pure module */ diff --git a/src/RescriptReactRouter.bs.js b/src/RescriptReactRouter.bs.js index a86a821..64ca9bb 100644 --- a/src/RescriptReactRouter.bs.js +++ b/src/RescriptReactRouter.bs.js @@ -1,40 +1,36 @@ // Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; -var Curry = require("rescript/lib/js/curry.js"); -var React = require("react"); -var Js_array = require("rescript/lib/js/js_array.js"); -var Js_string = require("rescript/lib/js/js_string.js"); -var Caml_option = require("rescript/lib/js/caml_option.js"); +import * as React from "react"; +import * as Js_array from "rescript/lib/es6/Js_array.js"; +import * as Js_string from "rescript/lib/es6/Js_string.js"; +import * as Primitive_option from "rescript/lib/es6/Primitive_option.js"; function safeMakeEvent(eventName) { if (typeof Event === "function") { return new Event(eventName); } - var $$event = document.createEvent("Event"); - $$event.initEvent(eventName, true, true); - return $$event; + let event = document.createEvent("Event"); + event.initEvent(eventName, true, true); + return event; } function pathParse(str) { switch (str) { case "" : case "/" : - return /* [] */0; + return /* [] */0; default: - var raw = Js_string.sliceToEnd(1, str); - var match = raw[raw.length - 1 | 0]; - var raw$1 = match === "/" ? Js_string.slice(0, -1, raw) : raw; - var match$1 = Js_string.splitAtMost("?", 2, raw$1); - var raw$2 = match$1.length !== 2 ? raw$1 : match$1[0]; - var a = Js_array.filter((function (item) { - return item.length !== 0; - }), Js_string.split("/", raw$2)); - var _i = a.length - 1 | 0; - var _res = /* [] */0; - while(true) { - var res = _res; - var i = _i; + let raw = Js_string.sliceToEnd(1, str); + let match = raw[raw.length - 1 | 0]; + let raw$1 = match === "/" ? Js_string.slice(0, -1, raw) : raw; + let match$1 = Js_string.splitAtMost("?", 2, raw$1); + let raw$2 = match$1.length !== 2 ? raw$1 : match$1[0]; + let a = Js_array.filter(item => item.length !== 0, Js_string.split("/", raw$2)); + let _i = a.length - 1 | 0; + let _res = /* [] */0; + while (true) { + let res = _res; + let i = _i; if (i < 0) { return res; } @@ -43,32 +39,32 @@ function pathParse(str) { tl: res }; _i = i - 1 | 0; - continue ; + continue; }; } } function path(serverUrlString, param) { - var match = globalThis.window; + let match = globalThis.window; if (serverUrlString !== undefined) { return pathParse(serverUrlString); } else if (match !== undefined) { - return pathParse(Caml_option.valFromOption(match).location.pathname); + return pathParse(Primitive_option.valFromOption(match).location.pathname); } else { return /* [] */0; } } -function hash(param) { - var $$window = globalThis.window; - if ($$window === undefined) { +function hash() { + let window = globalThis.window; + if (window === undefined) { return ""; } - var raw = Caml_option.valFromOption($$window).location.hash; + let raw = Primitive_option.valFromOption(window).location.hash; switch (raw) { case "" : case "#" : - return ""; + return ""; default: return Js_string.sliceToEnd(1, raw); } @@ -78,9 +74,9 @@ function searchParse(str) { switch (str) { case "" : case "?" : - return ""; + return ""; default: - var match = Js_string.splitAtMost("?", 2, str); + let match = Js_string.splitAtMost("?", 2, str); if (match.length !== 2) { return ""; } else { @@ -90,34 +86,34 @@ function searchParse(str) { } function search(serverUrlString, param) { - var match = globalThis.window; + let match = globalThis.window; if (serverUrlString !== undefined) { return searchParse(serverUrlString); } else if (match !== undefined) { - return searchParse(Caml_option.valFromOption(match).location.search); + return searchParse(Primitive_option.valFromOption(match).location.search); } else { return ""; } } function push(path) { - var match = globalThis.history; - var match$1 = globalThis.window; + let match = globalThis.history; + let match$1 = globalThis.window; if (match !== undefined && match$1 !== undefined) { - Caml_option.valFromOption(match).pushState(null, "", path); - Caml_option.valFromOption(match$1).dispatchEvent(safeMakeEvent("popstate")); - return ; + Primitive_option.valFromOption(match).pushState(null, "", path); + Primitive_option.valFromOption(match$1).dispatchEvent(safeMakeEvent("popstate")); + return; } } function replace(path) { - var match = globalThis.history; - var match$1 = globalThis.window; + let match = globalThis.history; + let match$1 = globalThis.window; if (match !== undefined && match$1 !== undefined) { - Caml_option.valFromOption(match).replaceState(null, "", path); - Caml_option.valFromOption(match$1).dispatchEvent(safeMakeEvent("popstate")); - return ; + Primitive_option.valFromOption(match).replaceState(null, "", path); + Primitive_option.valFromOption(match$1).dispatchEvent(safeMakeEvent("popstate")); + return; } } @@ -126,17 +122,13 @@ function urlNotEqual(a, b) { if (a.hash !== b.hash || a.search !== b.search) { return true; } else { - var _aList = a.path; - var _bList = b.path; - while(true) { - var bList = _bList; - var aList = _aList; + let _aList = a.path; + let _bList = b.path; + while (true) { + let bList = _bList; + let aList = _aList; if (!aList) { - if (bList) { - return true; - } else { - return false; - } + return bList; } if (!bList) { return true; @@ -146,77 +138,67 @@ function urlNotEqual(a, b) { } _bList = bList.tl; _aList = aList.tl; - continue ; + continue; }; } } function url(serverUrlString, param) { return { - path: path(serverUrlString, undefined), - hash: hash(), - search: search(serverUrlString, undefined) - }; + path: path(serverUrlString, undefined), + hash: hash(), + search: search(serverUrlString, undefined) + }; } function watchUrl(callback) { - var $$window = globalThis.window; - if ($$window === undefined) { - return function (param) { - - }; + let window = globalThis.window; + if (window === undefined) { + return () => {}; } - var watcherID = function (param) { - Curry._1(callback, url(undefined, undefined)); - }; - Caml_option.valFromOption($$window).addEventListener("popstate", watcherID); + let watcherID = () => callback(url(undefined, undefined)); + Primitive_option.valFromOption(window).addEventListener("popstate", watcherID); return watcherID; } function unwatchUrl(watcherID) { - var $$window = globalThis.window; - if ($$window !== undefined) { - Caml_option.valFromOption($$window).removeEventListener("popstate", watcherID); - return ; + let window = globalThis.window; + if (window !== undefined) { + Primitive_option.valFromOption(window).removeEventListener("popstate", watcherID); + return; } } function useUrl(serverUrl, param) { - var match = React.useState(function (param) { - if (serverUrl !== undefined) { - return serverUrl; - } else { - return url(undefined, undefined); - } - }); - var setUrl = match[1]; - var url$1 = match[0]; - React.useEffect((function (param) { - var watcherId = watchUrl(function (url) { - Curry._1(setUrl, (function (param) { - return url; - })); - }); - var newUrl = url(undefined, undefined); - if (urlNotEqual(newUrl, url$1)) { - Curry._1(setUrl, (function (param) { - return newUrl; - })); - } - return (function (param) { - unwatchUrl(watcherId); - }); - }), []); + let match = React.useState(() => { + if (serverUrl !== undefined) { + return serverUrl; + } else { + return url(undefined, undefined); + } + }); + let setUrl = match[1]; + let url$1 = match[0]; + React.useEffect(() => { + let watcherId = watchUrl(url => setUrl(param => url)); + let newUrl = url(undefined, undefined); + if (urlNotEqual(newUrl, url$1)) { + setUrl(param => newUrl); + } + return () => unwatchUrl(watcherId); + }, []); return url$1; } -var dangerouslyGetInitialUrl = url; +let dangerouslyGetInitialUrl = url; -exports.push = push; -exports.replace = replace; -exports.watchUrl = watchUrl; -exports.unwatchUrl = unwatchUrl; -exports.dangerouslyGetInitialUrl = dangerouslyGetInitialUrl; -exports.useUrl = useUrl; +export { + push, + replace, + watchUrl, + unwatchUrl, + dangerouslyGetInitialUrl, + useUrl, +} /* react Not a pure module */ diff --git a/src/RescriptReactRouter.res b/src/RescriptReactRouter.res index e960d0c..8afa34e 100644 --- a/src/RescriptReactRouter.res +++ b/src/RescriptReactRouter.res @@ -55,7 +55,7 @@ let arrayToList = a => { if i < 0 { res } else { - tolist(i - 1, list{Array.unsafe_get(a, i), ...res}) + tolist(i - 1, list{Array.getUnsafe(a, i), ...res}) } tolist(Array.length(a) - 1, list{}) } diff --git a/src/v3/ReactDOMStyle_V3.bs.js b/src/v3/ReactDOMStyle_V3.bs.js index 18702c8..f7f5e14 100644 --- a/src/v3/ReactDOMStyle_V3.bs.js +++ b/src/v3/ReactDOMStyle_V3.bs.js @@ -1,12 +1,13 @@ // Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; function unsafeAddProp(style, key, value) { - var dict = {}; + let dict = {}; dict[key] = value; return Object.assign({}, style, dict); } -exports.unsafeAddProp = unsafeAddProp; +export { + unsafeAddProp, +} /* No side effect */ diff --git a/src/v3/ReactDOM_V3.bs.js b/src/v3/ReactDOM_V3.bs.js index e2bdd8a..b1e6cf1 100644 --- a/src/v3/ReactDOM_V3.bs.js +++ b/src/v3/ReactDOM_V3.bs.js @@ -1,17 +1,18 @@ // Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; -var Experimental = {}; +let Experimental = {}; -var Ref = {}; +let Ref = {}; -var Props = {}; +let Props = {}; -var Style; +let Style; -exports.Experimental = Experimental; -exports.Ref = Ref; -exports.Props = Props; -exports.Style = Style; +export { + Experimental, + Ref, + Props, + Style, +} /* No side effect */ diff --git a/src/v3/ReactEvent_V3.bs.js b/src/v3/ReactEvent_V3.bs.js index 179cde2..5303ddd 100644 --- a/src/v3/ReactEvent_V3.bs.js +++ b/src/v3/ReactEvent_V3.bs.js @@ -1,53 +1,54 @@ // Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; -var Synthetic = {}; +let Synthetic = {}; -var Clipboard = {}; +let Clipboard = {}; -var Composition = {}; +let Composition = {}; -var Keyboard = {}; +let Keyboard = {}; -var Focus = {}; +let Focus = {}; -var Form = {}; +let Form = {}; -var Mouse = {}; +let Mouse = {}; -var Pointer = {}; +let Pointer = {}; -var $$Selection = {}; +let Selection = {}; -var $$Touch = {}; +let Touch = {}; -var UI = {}; +let UI = {}; -var Wheel = {}; +let Wheel = {}; -var Media = {}; +let Media = {}; -var $$Image = {}; +let Image = {}; -var $$Animation = {}; +let Animation = {}; -var Transition = {}; +let Transition = {}; -exports.Synthetic = Synthetic; -exports.Clipboard = Clipboard; -exports.Composition = Composition; -exports.Keyboard = Keyboard; -exports.Focus = Focus; -exports.Form = Form; -exports.Mouse = Mouse; -exports.Pointer = Pointer; -exports.$$Selection = $$Selection; -exports.$$Touch = $$Touch; -exports.UI = UI; -exports.Wheel = Wheel; -exports.Media = Media; -exports.$$Image = $$Image; -exports.$$Animation = $$Animation; -exports.Transition = Transition; +export { + Synthetic, + Clipboard, + Composition, + Keyboard, + Focus, + Form, + Mouse, + Pointer, + Selection, + Touch, + UI, + Wheel, + Media, + Image, + Animation, + Transition, +} /* No side effect */ diff --git a/src/v3/ReactV3.bs.js b/src/v3/ReactV3.bs.js index e083669..b7a54ec 100644 --- a/src/v3/ReactV3.bs.js +++ b/src/v3/ReactV3.bs.js @@ -1,21 +1,22 @@ // Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; -var React_V3 = require("./React_V3.bs.js"); -var ReactDOM_V3 = require("./ReactDOM_V3.bs.js"); -var ReactEvent_V3 = require("./ReactEvent_V3.bs.js"); -var ReactDOMStyle_V3 = require("./ReactDOMStyle_V3.bs.js"); +import * as React_V3 from "./React_V3.bs.js"; +import * as ReactDOM_V3 from "./ReactDOM_V3.bs.js"; +import * as ReactEvent_V3 from "./ReactEvent_V3.bs.js"; +import * as ReactDOMStyle_V3 from "./ReactDOMStyle_V3.bs.js"; -var React = React_V3; +let React = React_V3; -var ReactDOM = ReactDOM_V3; +let ReactDOM = ReactDOM_V3; -var ReactDOMStyle = ReactDOMStyle_V3; +let ReactDOMStyle = ReactDOMStyle_V3; -var ReactEvent = ReactEvent_V3; +let ReactEvent = ReactEvent_V3; -exports.React = React; -exports.ReactDOM = ReactDOM; -exports.ReactDOMStyle = ReactDOMStyle; -exports.ReactEvent = ReactEvent; +export { + React, + ReactDOM, + ReactDOMStyle, + ReactEvent, +} /* No side effect */ diff --git a/src/v3/React_V3.bs.js b/src/v3/React_V3.bs.js index a858df8..11aa114 100644 --- a/src/v3/React_V3.bs.js +++ b/src/v3/React_V3.bs.js @@ -1,26 +1,27 @@ // Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; -var Ref = {}; +let Ref = {}; -var Children = {}; +let Children = {}; -var Context = {}; +let Context = {}; -var Fragment = {}; +let Fragment = {}; -var StrictMode = {}; +let StrictMode = {}; -var Suspense = {}; +let Suspense = {}; -var Uncurried = {}; +let Uncurried = {}; -exports.Ref = Ref; -exports.Children = Children; -exports.Context = Context; -exports.Fragment = Fragment; -exports.StrictMode = StrictMode; -exports.Suspense = Suspense; -exports.Uncurried = Uncurried; +export { + Ref, + Children, + Context, + Fragment, + StrictMode, + Suspense, + Uncurried, +} /* No side effect */