Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

WIP: Repo split #171

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -258,3 +258,4 @@ packages/
.idea/
*.sln.iml
*.orig
.ionide/
6 changes: 6 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
### 6.0.0-beta-001

- Add `forwardRef` to `IReactExports` (by @Luiz-Monad)
- Remove `react-dom` API from this package
- Add npm dependency metadata to work with Femto (by @Zaid-Ajaj)

### 5.2.6

- Fix #167: Add `withKey` argument to `FunctionComponent.Of`
Expand Down
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

59 changes: 32 additions & 27 deletions src/Fable.React.fsproj
Original file line number Diff line number Diff line change
@@ -1,30 +1,35 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Version>5.2.6</Version>
<PackageVersion>5.2.6</PackageVersion>
<TargetFrameworks>netstandard2.0</TargetFrameworks>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<!-- <DefineConstants>$(DefineConstants);FABLE_COMPILER</DefineConstants> -->
</PropertyGroup>
<ItemGroup>
<Compile Include="Fable.React.fs" />
<Compile Include="Fable.ReactDom.fs" />
<Compile Include="Fable.React.Hooks.fs" />
<Compile Include="Fable.React.Props.fs" />
<Compile Include="Fable.React.Extensions.fs" />
<Compile Include="Fable.React.Helpers.fs" />
<Compile Include="Fable.React.Standard.fs" />
<Compile Include="Fable.React.FunctionComponent.fs" />
<Compile Include="Fable.React.ReactiveComponents.fs" />
<Compile Include="Fable.React.Isomorphic.fs" />
<Compile Include="Fable.ReactServer.fs" />
</ItemGroup>
<ItemGroup>
<Content Include="*.fsproj; *.fs" PackagePath="fable\" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Fable.Core" Version="3.0.0" />
<PackageReference Include="Fable.Browser.Dom" Version="1.0.0" />
</ItemGroup>
<PropertyGroup>
<Version>6.0.0</Version>
<PackageVersion>6.0.0-beta-001</PackageVersion>
<TargetFrameworks>netstandard2.0</TargetFrameworks>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<!-- <DefineConstants>$(DefineConstants);FABLE_COMPILER</DefineConstants> -->
</PropertyGroup>
<ItemGroup>
<Compile Include="Fable.React.fs" />
<Compile Include="Fable.ReactDom.fs" />
<Compile Include="Fable.React.Hooks.fs" />
<Compile Include="Fable.React.Props.fs" />
<Compile Include="Fable.React.Extensions.fs" />
<Compile Include="Fable.React.Helpers.fs" />
<Compile Include="Fable.React.Standard.fs" />
<Compile Include="Fable.React.FunctionComponent.fs" />
<Compile Include="Fable.React.ReactiveComponents.fs" />
<Compile Include="Fable.React.Isomorphic.fs" />
<Compile Include="Fable.ReactServer.fs" />
</ItemGroup>
<PropertyGroup>
<NpmDependencies>
<NpmPackage Name="react" Version=">= 16.8.0" />
</NpmDependencies>
</PropertyGroup>
<ItemGroup>
<Content Include="*.fsproj; *.fs" PackagePath="fable\" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Fable.Core" Version="3.0.0" />
<PackageReference Include="Fable.Browser.Dom" Version="1.0.0" />
</ItemGroup>
</Project>
41 changes: 7 additions & 34 deletions src/Fable.ReactDom.fs
Original file line number Diff line number Diff line change
@@ -1,42 +1,15 @@
namespace Fable.React

open Fable.Core
open Fable.React
open Browser.Types

type IReactDom =
/// Render a React element into the DOM in the supplied container.
/// If the React element was previously rendered into container, this will perform an update on it and only mutate the DOM as necessary to reflect the latest React element.
/// If the optional callback is provided, it will be executed after the component is rendered or updated.
abstract render: element: ReactElement * container: Element * ?callback: (unit->unit) -> unit

/// Same as render(), but is used to hydrate a container whose HTML contents were rendered by ReactDOMServer. React will attempt to attach event listeners to the existing markup.
abstract hydrate: element: ReactElement * container: Element * ?callback: (unit->unit) -> unit

/// Remove a mounted React component from the DOM and clean up its event handlers and state. If no component was mounted in the container, calling this function does nothing. Returns true if a component was unmounted and false if there was no component to unmount.
abstract unmountComponentAtNode: container: Element -> bool

/// Creates a portal. Portals provide a way to render children into a DOM node that exists outside the hierarchy of the DOM component.
abstract createPortal: child: ReactElement * container: Element -> ReactElement

type IReactDomServer =
/// Render a React element to its initial HTML. This should only be used on the server. React will return an HTML string. You can use this method to generate HTML on the server and send the markup down on the initial request for faster page loads and to allow search engines to crawl your pages for SEO purposes.
/// If you call ReactDOM.render() on a node that already has this server-rendered markup, React will preserve it and only attach event handlers, allowing you to have a very performant first-load experience.
abstract renderToString: element: ReactElement -> string

/// Similar to renderToString, except this doesn't create extra DOM attributes such as data-reactid, that React uses internally. This is useful if you want to use React as a simple static page generator, as stripping away the extra attributes can save lots of bytes.
abstract renderToStaticMarkup: element: ReactElement -> string
open System

[<AutoOpen>]
module ReactDomBindings =
#if FABLE_REPL_LIB
[<Global("ReactDOM")>]
#else
[<Import("*", "react-dom")>]
#endif
let ReactDom: IReactDom = jsNative

[<Obsolete("This binding has been moved to Fable.React.Dom package. Please install the new package.")>]
let ReactDom: obj = jsNative

#if !FABLE_REPL_LIB
[<Import("default", "react-dom/server")>]
let ReactDomServer: IReactDomServer = jsNative
#endif
[<Obsolete("This binding has been moved to Fable.React.Dom package. Please install the new package.")>]
let ReactDomServer: obj = jsNative
#endif