Skip to content
This repository has been archived by the owner on Oct 30, 2022. It is now read-only.

Commit

Permalink
Rename to MithrilToReact
Browse files Browse the repository at this point in the history
  • Loading branch information
ArthurClemens committed May 26, 2017
1 parent 57a110a commit 7135abc
Show file tree
Hide file tree
Showing 18 changed files with 117,518 additions and 68 deletions.
7 changes: 6 additions & 1 deletion .eslintrc
Expand Up @@ -5,6 +5,9 @@
"es6": true
},
"extends": "eslint:recommended",
"plugins": [
"react"
],
"parserOptions": {
"sourceType": "module",
"ecmaVersion": 6,
Expand All @@ -30,6 +33,8 @@
"error",
"always"
],
"no-console": 1
"no-console": 1,
"react/jsx-uses-react": "error",
"react/jsx-uses-vars": "error"
}
}
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -25,6 +25,7 @@
"eslint": "^3.19.0",
"eslint-config-airbnb-base": "^11.2.0",
"eslint-plugin-import": "^2.2.0",
"eslint-plugin-react": "^7.0.1",
"fs-promise": "^2.0.3",
"lerna": "2.0.0-beta.38",
"mithril-jest": "^0.1.7",
Expand Down
2 changes: 1 addition & 1 deletion packages/polythene-react-base/dist/polythene-react-base.js

Large diffs are not rendered by default.

Large diffs are not rendered by default.

10 changes: 4 additions & 6 deletions packages/polythene-react-base/dist/polythene-react-base.mjs
Expand Up @@ -62,7 +62,7 @@ const StateComponent = {
h(StateComponent, { subject: "airco"});
*/

var MatchingMithril = function MatchingMithril(component) {
var MithrilToReact = function MithrilToReact(component) {
return function (_Component) {
_inherits(_class, _Component);

Expand All @@ -71,7 +71,7 @@ var MatchingMithril = function MatchingMithril(component) {

var _this = _possibleConstructorReturn(this, (_class.__proto__ || Object.getPrototypeOf(_class)).call(this, props));

_this.state = _extends({}, component, { state: component.state || {} });
_this.state = _extends({}, component, { state: {} });
_this.state.oninit && _this.state.oninit(_this.state);
return _this;
}
Expand All @@ -96,8 +96,6 @@ var MatchingMithril = function MatchingMithril(component) {
}(Component);
};

var _this = undefined;

var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };

function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
Expand All @@ -107,7 +105,7 @@ var renderer = function renderer() {
args[_key] = arguments[_key];
}

return _typeof(args[0]) === "object" ? h.call.apply(h, [_this, MatchingMithril(args[0])].concat(_toConsumableArray(args.slice(1)))) : h.call.apply(h, [_this].concat(args));
return _typeof(args[0]) === "object" ? h.call.apply(h, [null, MithrilToReact(args[0])].concat(_toConsumableArray(args.slice(1)))) : h.call.apply(h, [null].concat(args));
};

renderer.trust = function (html) {
Expand Down Expand Up @@ -337,4 +335,4 @@ var Toggle = function (_Component) {
return Toggle;
}(Component);

export { keys, renderer, statefulComponent, viewComponent, Toggle, MatchingMithril };
export { keys, renderer, statefulComponent, viewComponent, Toggle, MithrilToReact };
Expand Up @@ -35,7 +35,7 @@ h(StateComponent, { subject: "airco"});

import { Component } from "react";

export const MatchingMithril = component => (
export const MithrilToReact = component => (

class extends Component {

Expand All @@ -44,7 +44,7 @@ export const MatchingMithril = component => (
this.state = Object.assign(
{},
component,
{ state: component.state || {} }
{ state: {} }
);
this.state.oninit && this.state.oninit(this.state);
}
Expand Down
2 changes: 1 addition & 1 deletion packages/polythene-react-base/src/index.js
Expand Up @@ -3,4 +3,4 @@ export { renderer } from "./renderer";
export { statefulComponent } from "./statefulComponent";
export { viewComponent } from "./viewComponent";
export { Toggle } from "./Toggle";
export { MatchingMithril } from "./MatchingMithril";
export { MithrilToReact } from "./MithrilToReact";
6 changes: 3 additions & 3 deletions packages/polythene-react-base/src/renderer.js
@@ -1,10 +1,10 @@
import h from "react-hyperscript";
import { MatchingMithril } from "./MatchingMithril";
import { MithrilToReact } from "./MithrilToReact";

export const renderer = (...args) =>
typeof args[0] === "object"
? h.call(this, MatchingMithril(args[0]), ...args.slice(1))
: h.call(this, ...args);
? h.call(null, MithrilToReact(args[0]), ...args.slice(1))
: h.call(null, ...args);

renderer.trust = (html, element = "div") => {
if (html == null) html = "";
Expand Down
112 changes: 112 additions & 0 deletions packages/polythene-react-base/yarn.lock
@@ -0,0 +1,112 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1


asap@~2.0.3:
version "2.0.5"
resolved "https://registry.yarnpkg.com/asap/-/asap-2.0.5.tgz#522765b50c3510490e52d7dcfe085ef9ba96958f"

core-js@^1.0.0:
version "1.2.7"
resolved "https://registry.yarnpkg.com/core-js/-/core-js-1.2.7.tgz#652294c14651db28fa93bd2d5ff2983a4f08c636"

encoding@^0.1.11:
version "0.1.12"
resolved "https://registry.yarnpkg.com/encoding/-/encoding-0.1.12.tgz#538b66f3ee62cd1ab51ec323829d1f9480c74beb"
dependencies:
iconv-lite "~0.4.13"

fbjs@^0.8.9:
version "0.8.12"
resolved "https://registry.yarnpkg.com/fbjs/-/fbjs-0.8.12.tgz#10b5d92f76d45575fd63a217d4ea02bea2f8ed04"
dependencies:
core-js "^1.0.0"
isomorphic-fetch "^2.1.1"
loose-envify "^1.0.0"
object-assign "^4.1.0"
promise "^7.1.1"
setimmediate "^1.0.5"
ua-parser-js "^0.7.9"

iconv-lite@~0.4.13:
version "0.4.17"
resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.17.tgz#4fdaa3b38acbc2c031b045d0edcdfe1ecab18c8d"

is-stream@^1.0.1:
version "1.1.0"
resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44"

isomorphic-fetch@^2.1.1:
version "2.2.1"
resolved "https://registry.yarnpkg.com/isomorphic-fetch/-/isomorphic-fetch-2.2.1.tgz#611ae1acf14f5e81f729507472819fe9733558a9"
dependencies:
node-fetch "^1.0.1"
whatwg-fetch ">=0.10.0"

js-tokens@^3.0.0:
version "3.0.1"
resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-3.0.1.tgz#08e9f132484a2c45a30907e9dc4d5567b7f114d7"

loose-envify@^1.0.0, loose-envify@^1.1.0, loose-envify@^1.3.1:
version "1.3.1"
resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.3.1.tgz#d1a8ad33fa9ce0e713d65fdd0ac8b748d478c848"
dependencies:
js-tokens "^3.0.0"

node-fetch@^1.0.1:
version "1.7.0"
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-1.7.0.tgz#3ff6c56544f9b7fb00682338bb55ee6f54a8a0ef"
dependencies:
encoding "^0.1.11"
is-stream "^1.0.1"

object-assign@^4.1.0:
version "4.1.1"
resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863"

promise@^7.1.1:
version "7.1.1"
resolved "https://registry.yarnpkg.com/promise/-/promise-7.1.1.tgz#489654c692616b8aa55b0724fa809bb7db49c5bf"
dependencies:
asap "~2.0.3"

prop-types@^15.5.7, prop-types@~15.5.7:
version "15.5.10"
resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.5.10.tgz#2797dfc3126182e3a95e3dfbb2e893ddd7456154"
dependencies:
fbjs "^0.8.9"
loose-envify "^1.3.1"

react-dom@^15.5.4:
version "15.5.4"
resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-15.5.4.tgz#ba0c28786fd52ed7e4f2135fe0288d462aef93da"
dependencies:
fbjs "^0.8.9"
loose-envify "^1.1.0"
object-assign "^4.1.0"
prop-types "~15.5.7"

react-hyperscript@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/react-hyperscript/-/react-hyperscript-3.0.0.tgz#3c16010b33175de6bc01fd1ebad0a16a9a6dc9ab"

react@^15.5.4:
version "15.5.4"
resolved "https://registry.yarnpkg.com/react/-/react-15.5.4.tgz#fa83eb01506ab237cdc1c8c3b1cea8de012bf047"
dependencies:
fbjs "^0.8.9"
loose-envify "^1.1.0"
object-assign "^4.1.0"
prop-types "^15.5.7"

setimmediate@^1.0.5:
version "1.0.5"
resolved "https://registry.yarnpkg.com/setimmediate/-/setimmediate-1.0.5.tgz#290cbb232e306942d7d7ea9b83732ab7856f8285"

ua-parser-js@^0.7.9:
version "0.7.12"
resolved "https://registry.yarnpkg.com/ua-parser-js/-/ua-parser-js-0.7.12.tgz#04c81a99bdd5dc52263ea29d24c6bf8d4818a4bb"

whatwg-fetch@>=0.10.0:
version "2.0.3"
resolved "https://registry.yarnpkg.com/whatwg-fetch/-/whatwg-fetch-2.0.3.tgz#9c84ec2dcf68187ff00bc64e1274b442176e1c84"
14 changes: 14 additions & 0 deletions packages/polythene-selection-control/selection-control.md
@@ -0,0 +1,14 @@
# Selection control

Base functionality for:

* [Checkbox](../polythene-checkbox)
* [Radio button](../polythene-radio-button)
* [Switch](../polythene-switch)



## CSS classes

See: `src/classes.js`

0 comments on commit 7135abc

Please sign in to comment.