@teamthread/elm-web-components
Advanced tools
Comparing version
// adapted from https://github.com/PixelsCommander/ReactiveElements | ||
var camelize = function camelize(str) { | ||
// adapted from https://stackoverflow.com/questions/2970525/converting-any-string-into-camel-case#2970667 | ||
return str.toLowerCase().replace(/[-_]+/g, ' ').replace(/[^\w\s]/g, '').replace(/ (.)/g, function (firstChar) { | ||
return firstChar.toUpperCase(); | ||
}).replace(/ /g, ''); | ||
}; | ||
var getProps = function getProps(el) { | ||
@@ -7,3 +14,3 @@ var props = {}; | ||
var attribute = el.attributes[i]; | ||
var name = attribute.name; | ||
var name = camelize(attribute.name); | ||
props[name] = attribute.value; | ||
@@ -10,0 +17,0 @@ } |
{ | ||
"name": "@teamthread/elm-web-components", | ||
"version": "0.3.0", | ||
"version": "0.4.0", | ||
"description": "Run your Elm apps through web components.", | ||
@@ -9,3 +9,5 @@ "main": "lib/index.js", | ||
"build": "babel src/index.js -d lib", | ||
"example": "webpack-dev-server --config example/webpack.config.js" | ||
"example": "webpack-dev-server --config example/webpack.config.js", | ||
"elm-lint": "elm-format example/ --validate", | ||
"elm-lint-fix": "elm-format example/ --yes" | ||
}, | ||
@@ -24,11 +26,12 @@ "keywords": [], | ||
"devDependencies": { | ||
"@babel/cli": "^7.0.0-beta.40", | ||
"@babel/core": "^7.0.0-beta.40", | ||
"@babel/preset-env": "^7.0.0-beta.40", | ||
"elm": "0.18.0", | ||
"elm-format": "^0.7.0-exp", | ||
"elm-webpack-loader": "4.3.1", | ||
"prettier": "1.10.2", | ||
"webpack": "3.6.0", | ||
"webpack-dev-server": "2.9.1", | ||
"@babel/cli": "^7.0.0-beta.40", | ||
"@babel/core": "^7.0.0-beta.40", | ||
"@babel/preset-env": "^7.0.0-beta.40" | ||
"webpack-dev-server": "2.9.1" | ||
} | ||
} |
@@ -5,2 +5,4 @@ # elm-web-components | ||
*Only supports Elm 0.18. Update for 0.19 is in the works...* | ||
## Install | ||
@@ -104,2 +106,4 @@ | ||
Will pass through two flags: `someCustomProp` and `name`. Note that currently if a static flag and a passed attribute have the same name, the static flag takes priority. | ||
## `onDetached` (new in 0.3.0) | ||
@@ -130,2 +134,7 @@ | ||
**v0.4.0** [22 Aug 2018] | ||
* Breaking change: we now convert kebab case properties into camelCase. So `<foo-bar first-name="Jack" />` will be given to Elm as `firstName: "Jack"`. | ||
**v0.3.0** [3 May 2018] | ||
@@ -132,0 +141,0 @@ |
6528
15.58%40
17.65%145
6.62%9
12.5%