Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-habitat

Package Overview
Dependencies
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-habitat - npm Package Compare versions

Comparing version 0.3.0 to 0.3.1

CHANGELOG.md

3

package.json
{
"name": "react-habitat",
"version": "0.3.0",
"version": "0.3.1",
"description": "A React DOM Bootstrapper designed to harmonise a hybrid application",

@@ -66,2 +66,3 @@ "main": "./lib/index.js",

"LICENCE.md",
"CHANGELOG.md",
"index.d.ts",

@@ -68,0 +69,0 @@ "readme.md",

@@ -20,9 +20,9 @@ ![Deloitte Digital](https://raw.githubusercontent.com/DeloitteDigital/DDBreakpoints/master/docs/deloittedigital-logo-white.png)

- [Getting Started](#getting-started)
- [Passing props/properties to your components](#3-passing-properties-props-to-your-components)
- [Passing data back again](#4-passing-values-back-again)
- [Passing props/properties to your components](#passing-properties-props-to-your-components)
- [Passing data back again](#passing-values-back-again)
- [Options and Methods](#options-and-methods)
- [Contribute](#want-to-contribute)
- [Change log](#change-log)
- [License information](#license-bsd-3-clause)
- [Examples](https://github.com/DeloitteDigitalAPAC/react-habitat/tree/master/examples)
- [Change log](https://github.com/DeloitteDigitalAPAC/react-habitat/blob/master/CHANGELOG.md)

@@ -205,3 +205,3 @@

#### 3. Passing properties *(props)* to your components
### Passing properties *(props)* to your components

@@ -213,9 +213,20 @@ Resolving and registering components alone is not all that special, but passing data to it via html attributes is pretty useful. This allows the backend to

- [data-props](#data-props) Use this for mapping in a JSON string.
- [data-prop-](#data-prop-) Use this for mapping in strings, booleans, null, array or JSON to a single prop.
- [data-n-prop-](#data-n-prop-) Use this for mapping in numbers and floats to a single prop.
- [data-r-prop-](#data-r-prop-) Use this for mapping in a reference to an object that already exists on the global scope (window).
- [data-props](#data-props) Maps JSON to props.
- [data-prop-](#data-prop-) (Prefix) Maps in strings, booleans, null, array or JSON to a prop.
- [data-n-prop-](#data-n-prop-) (Prefix) Maps in numbers and floats to a prop.
- [data-r-prop-](#data-r-prop-) (Prefix) Maps in a reference to an object that exists on the global scope (window) to a prop.
##### data-props
**PLEASE NOTE:**
The last three options are attribute *prefixes*. This allow's you to define the property the name.
Property names will be *automatically converted* from hyphens to camel case.
For example
`data-prop-title` would expose `title` on the props object inside the component.
`data-prop-my-title` would expose `myTitle` on the props object inside the component.
#### data-props
Set component props via a JSON string on the `data-props` attribute.

@@ -229,3 +240,3 @@

##### data-prop-
#### data-prop-

@@ -238,7 +249,4 @@ Set an component prop via prefixing attributes with `data-prop-`.

There are **two important things** to note when setting these attribute type properties:
Please note: *JSON*, *booleans* & *null* are automatically parsed. Eg `data-prop-my-bool="true"` would expose the value of `true`, NOT the string representation `"true"`.
1. Hyphenated property names are converted to *camelCase*. Eg. `data-prop-my-title` would expose `myTitle` as a property in the component.
2. *JSON*, *booleans* & *null* are automatically parsed. Eg `data-prop-my-bool="true"` would expose the value of `true`, NOT the string representation `"true"`.
Simple Example

@@ -292,18 +300,14 @@

##### data-n-prop-
#### data-n-prop-
Set an component prop with type [number] via prefixing attributes with `data-n-prop-`.
This is handy if you know that a property is always going to be a number or float.
For example `data-n-prop-temperature="33.3"` would expose the float value of 33.3 and not the string representation '33.3'.
See [data-prop-](#data-prop-) above for notes on defining property names.
This is handy if you know that a property is always going to be a number or float.
##### data-r-prop-
#### data-r-prop-
Referenced a global variable in your component prop via prefixing attributes with `data-r-prop-`.
This is handy if you need to share properties between habitats or you need to set JSON onto the page.
For Example

@@ -319,5 +323,5 @@

See [data-prop-](#data-prop-) above for notes on defining property names.
This is handy if you need to share properties between habitats or you need to set JSON onto the page.
#### 4. Passing values back again
## Passing values back again

@@ -357,2 +361,8 @@ It can be handy to pass values back again, particularly for inputs so the backend frameworks can see any changes or read data.

### Replace original node
By default only `<inputs />` are left in the DOM when a React Habitat is created.
To keep a generic element in the DOM, set the `data-habitat-no-replace="true"` attribute.
### Changing the habitat query selector

@@ -410,22 +420,2 @@

## Change log
### [0.3.0]
- Added 'data-n-prop' to parse in number type properties
- Added 'data-r-prop' to parse in reference type properties
- 'null' values will now parse in as a null object
- Added safe logging
- Warnings and Errors now only apply when NODE_ENV is not 'production'
- Updated warning messages & added more details links
- Non empty React Habitat component elements now log's a warning instead of throwing errors
- Fixed issue with parsing empty object's and array's as strings. [#3](https://github.com/DeloitteDigitalAPAC/react-habitat/issues/3)
- Updated framework module exports so commonJS no longer needs ugly '.default' [#4](https://github.com/DeloitteDigitalAPAC/react-habitat/issues/4)
- Added examples
### [0.2.1]
- Deprecated 'registerComponent' should now use 'register'
- Deprecated 'registerComponents' should now use 'registerAll'
## Who is Deloitte Digital?

@@ -432,0 +422,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc