Skip to content

Commit 3e00fc4

Browse files
authored
Remove DOM and implementation code (#123)
- The DOM modules have been moved to react-basic-dom - The React.Basic implementation has been moved to react-basic-classic - The React.Basic.Compat implementation has been moved to react-basic-compat (deprecated)
1 parent 102f417 commit 3e00fc4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

89 files changed

+1089
-31916
lines changed

.editorconfig

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
root = true
2+
3+
[*]
4+
indent_style = space
5+
indent_size = 2
6+
charset = utf-8
7+
trim_trailing_whitespace = true
8+
insert_final_newline = false
9+
10+
[Makefile]
11+
indent_style = tab

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@
77
/.purs*
88
/.psa*
99
/.vscode/
10+
/.spago/

.prettierrc

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"trailingComma": "none"
3+
}

.travis.yml

+8-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
dist: trusty
22
sudo: required
33
language: node_js
4-
node_js: 10
4+
node_js:
5+
- node
6+
- "lts/*"
7+
8+
cache: npm
59

610
install:
7-
- npm install
11+
- npm ci
12+
- npx bower install
813

914
script:
10-
- npx bower install
11-
- npm run build
15+
- npx pulp build

DEPENDENCIES

-22
This file was deleted.

Makefile

-12
This file was deleted.

README.md

+33-22
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,51 @@
11
# purescript-react-basic
22

3-
[![Build Status](https://travis-ci.org/lumihq/purescript-react-basic.svg?branch=master)](https://travis-ci.org/lumihq/purescript-react-basic)
3+
[![Build Status](https://travis-ci.org/lumihq/purescript-react-basic.svg?branch=main)](https://travis-ci.org/lumihq/purescript-react-basic)
44

5-
This package implements an opinionated set of bindings over [React](https://reactjs.org), optimizing for correctness and simplifying basic use cases.
5+
There's a brief section on getting started below. For a more complete guide, check out the React Basic [docs](https://react-basic-starter.github.io/)! (work in progress)
66

7-
_A note about React hooks: Hooks are arriving in stable React soon. The API presented here is the more traditional `setState`+lifecycles style React's had for a long time. If you'd like to experiment with the hooks API in react-basic, have a look at [react-basic-hooks](https://github.com/spicydonuts/purescript-react-basic-hooks). It can be installed and used along side this library, but don't forget it's a preview release!_
7+
## Getting Started
88

9-
## Features
9+
This library contains the core types and tools used by the rest of the React Basic ecosystem. To use React Basic in your applications you'll also need to choose one or more _implementations_ as well as a target environment!
1010

11-
- All React DOM elements and attributes are supported (soon, events are a work in progress).
12-
- An intuitive API for specifying props - simple records, no arrays of key value pairs.
13-
- Attributes are optional, but type-checked. It is a type error to specify `href` as an integer, for example.
14-
- Both `setState` and an action/update pattern for local component state, inspired by [ReasonReact](https://reasonml.github.io/reason-react/).
15-
- React lifecycles are available, but not in your way when you don't need them.
11+
_Note: The Hooks and Classic implementations can both be used in the same project_
1612

17-
## Getting Started
13+
Implementations:
14+
15+
- [`react-basic-hooks`](https://github.com/spicydonuts/purescript-react-basic-hooks)
16+
- PureScript types for building components using React hooks, as well as creating custom hooks.
17+
- [`react-basic-classic`](https://github.com/lumihq/purescript-react-basic-classic) _(this implementation was previously included in the `React.Basic` module)_
18+
- PureScript types for the more traditional class-based React API. Very similar to the Reason-React API.
19+
20+
Environments:
21+
22+
- [`react-basic-dom`](https://github.com/lumihq/purescript-react-basic-dom)
23+
- [`react-basic-native`](https://github.com/f-f/purescript-react-basic-native)
24+
25+
For example, to use the `react-basic` hooks implementation for web development in a `spago` app:
26+
27+
```sh
28+
npm i -S react react-dom
29+
spago install react-basic react-basic-dom react-basic-hooks
30+
```
1831

19-
You can install this package using Bower:
32+
Or using `bower`:
2033

2134
```sh
22-
bower install --save purescript-react-basic
35+
npm i -S react react-dom
36+
bower i -S purescript-react-basic purescript-react-basic-dom purescript-react-basic-hooks
2337
```
2438

25-
Or clone/fork the [starter project](https://github.com/lumihq/react-basic-starter).
39+
## Upgrading from React Basic v14
2640

27-
See [the documentation](https://pursuit.purescript.org/packages/purescript-react-basic/docs/React.Basic) for an overview of the API or take a look at these examples:
41+
The `React.Basic.DOM` modules have been moved to [`react-basic-dom`](https://github.com/lumihq/purescript-react-basic-dom). This doesn't require any code changes, but you will need to add this dependency to your projects.
2842

29-
- [A counter](./examples/counter/src/Counter.purs)
30-
- [A controlled input](./examples/controlled-input/src/ControlledInput.purs)
31-
- [Components](./examples/component/src/ToggleButton.purs) in [components](./examples/component/src/Container.purs)
32-
- [Using action/update](./examples/actions/src/Actions.purs)
43+
The component implementation previously in `React.Basic` has been extracted to [`react-basic-classic`](https://github.com/lumihq/purescript-react-basic-classic), which now provides the `React.Basic.Classic` module. Just install that library and find/replace `^import\sReact\.Basic\s` with `import React.Basic.Classic`.
3344

34-
## Migrating from v7 to v8
45+
If you were using the `React.Basic.Compat` module, that module has been moved to [`react-basic-compat`](https://github.com/lumihq/purescript-react-basic-compat).
3546

36-
v8 removes the required `update` function from the component spec and replaces `send self Action` with the `self.setState` API. Existing components using `update` can create a `send` function using the `runUpdate` function added in v8. See [the actions example](./examples/actions/src/Actions.purs) for an example of this. Alternatively, [this comment](https://github.com/lumihq/purescript-react-basic/pull/73#issuecomment-456486249) shows a few other possible upgrade paths.
47+
If you were using [`react-basic-hooks`](https://github.com/spicydonuts/purescript-react-basic-hooks) exclusively everything should work as-is.
3748

38-
## Migrating from v2/v3
49+
## Where did the examples folder go?
3950

40-
`React.Basic.Compat` is a new (but deprecated) module. It matches most of the old API and types (except `setStateThen` and `isFirstMount`) to make upgrading easier and more gradual. You can find `^import\sReact\.Basic\b` and replace with `import React.Basic.Compat`, upgrade the package version, and proceed from there one component at a time (or only new components). See the documentation link above for more info on the new API.
51+
Because this library no longer contains a specific implementation and the example structure contained a fair bit of boilerplate, they've been removed in favor of a consolidated documentation site (linked above). This is still a work in progress but you can refer to the [v14 examples](https://github.com/lumihq/purescript-react-basic/tree/v14.0.0/examples) in the meantime.

bower.json

+3-12
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,8 @@
1212
"url": "https://github.com/lumihq/purescript-react-basic.git"
1313
},
1414
"dependencies": {
15-
"purescript-aff": "^5.0.2",
16-
"purescript-console": "^4.1.0",
17-
"purescript-effect": "^2.0.0",
18-
"purescript-exceptions": "^4.0.0",
19-
"purescript-functions": "^4.0.0",
20-
"purescript-nullable": "^4.1.0",
21-
"purescript-record": ">=1.0.0 <3.0.0",
22-
"purescript-unsafe-coerce": "^4.0.0",
23-
"purescript-web-dom": ">=1.0.0 <4.0.0",
24-
"purescript-web-html": ">=1.0.0 <3.0.0",
25-
"purescript-web-events": ">=1.0.0 <3.0.0",
26-
"purescript-foreign-object": "^2.0.3"
15+
"purescript-effect": "^2.0.1",
16+
"purescript-record": "^2.0.2",
17+
"purescript-prelude": "^4.1.1"
2718
}
2819
}

codegen/.gitignore

-2
This file was deleted.

codegen/consts.js

-155
This file was deleted.

0 commit comments

Comments
 (0)