Skip to content

Commit

Permalink
Major overhaul
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Brain authored and bluepnume committed Jan 10, 2019
1 parent 354f3e0 commit f45e45b
Show file tree
Hide file tree
Showing 116 changed files with 61,157 additions and 5,101 deletions.
3 changes: 0 additions & 3 deletions .babelrc

This file was deleted.

1 change: 1 addition & 0 deletions .flowconfig
Expand Up @@ -2,6 +2,7 @@
.*/node_modules/babel-plugin-flow-runtime
.*/node_modules/flow-runtime
.*/node_modules/npm
.*/node_modules/jsonlint
.*/dist/module
[include]
[libs]
Expand Down
2 changes: 1 addition & 1 deletion .travis.yml
@@ -1,4 +1,4 @@
language: node_js
node_js:
- "6"
- "8"
script: npm test
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -50,15 +50,15 @@ Render the component on the parent page:

<script src="script-where-my-login-component-is-defined.js"></script>
<script>
MyLoginComponent.render({
MyLoginComponent({

prefilledEmail: 'foo@bar.com',

onLogin: function(email) {
console.log('User logged in with email:', email);
}

}, '#container');
}).render('#container');
</script>
```

Expand Down
6 changes: 6 additions & 0 deletions babel.config.js
@@ -0,0 +1,6 @@
/* @flow */

// eslint-disable-next-line import/no-commonjs
module.exports = {
extends: 'grumbler-scripts/config/.babelrc-node'
};
4 changes: 2 additions & 2 deletions demo/advanced/props/index.htm
Expand Up @@ -20,7 +20,7 @@ <h3>Log in on xyz.com</h3>

// Render the component

MyLoginZoidComponent.render({
MyLoginZoidComponent({

prefilledEmail: 'foo@bar.com',

Expand All @@ -29,7 +29,7 @@ <h3>Log in on xyz.com</h3>
document.querySelector('#result').innerText = email + ' logged in!';
}

}, '#container');
}).render('#container');

</script>

Expand Down
2 changes: 1 addition & 1 deletion demo/advanced/props/login.htm
Expand Up @@ -60,7 +60,7 @@
// Since we had a successful login, call-back the parent page to let them know which user logged in:

window.xprops.onLogin(email);
window.xchild.close();
window.xprops.close();

}, 2000);
});
Expand Down
2 changes: 1 addition & 1 deletion demo/advanced/props/login.js
Expand Up @@ -7,7 +7,7 @@ window.MyLoginZoidComponent = zoid.create({

// The url that will be loaded in the iframe or popup, when someone includes my component on their page

url: zoid.getCurrentScriptDir() + '/login.htm',
url: './login.htm',

// The properties they can (or must) pass down to my component

Expand Down
2 changes: 1 addition & 1 deletion demo/advanced/react-end-to-end/login.js
Expand Up @@ -7,5 +7,5 @@ window.MyLoginZoidComponent = zoid.create({

// The url that will be loaded in the iframe or popup, when someone includes my component on their page

url: zoid.getCurrentScriptDir() + '/login.htm'
url: './login.htm'
});
4 changes: 2 additions & 2 deletions demo/advanced/remote/index.htm
Expand Up @@ -20,11 +20,11 @@ <h3>Log in on xyz.com</h3>
<div id="loginContainer"></div>

<script>
MyLoginButtonComponent.render({
MyLoginButtonComponent({

loginContainer: '#loginContainer'

}, '#container');
}).render('#container');
</script>

</body>
5 changes: 3 additions & 2 deletions demo/advanced/remote/login-button.htm
Expand Up @@ -24,7 +24,7 @@

// document.querySelector('#openLoginButton').style.display = 'none';

MyLoginZoidComponent.renderTo(window.parent, {
MyLoginZoidComponent({

prefilledEmail: 'foo@bar.com',

Expand All @@ -34,7 +34,8 @@
}

}, window.xprops.loginContainer);
});

}).renderTo(window.parent);

</script>

Expand Down
2 changes: 1 addition & 1 deletion demo/advanced/remote/login.htm
Expand Up @@ -60,7 +60,7 @@
// Since we had a successful login, call-back the parent page to let them know which user logged in:

window.xprops.onLogin(email);
window.xchild.close();
window.xprops.close();

}, 2000);
});
Expand Down
2 changes: 1 addition & 1 deletion demo/advanced/remote/login.js
Expand Up @@ -7,5 +7,5 @@ window.MyLoginZoidComponent = zoid.create({

// The url that will be loaded in the iframe or popup, when someone includes my component on their page

url: zoid.getCurrentScriptDir() + '/login.htm'
url: './login.htm'
});
4 changes: 2 additions & 2 deletions demo/basic/iframe/index.htm
Expand Up @@ -20,7 +20,7 @@ <h3>Log in on xyz.com</h3>

// Render the component

MyLoginZoidComponent.render({
MyLoginZoidComponent({

prefilledEmail: 'foo@bar.com',

Expand All @@ -29,7 +29,7 @@ <h3>Log in on xyz.com</h3>
document.querySelector('#result').innerText = email + ' logged in!';
}

}, '#container');
}).render('#container');

</script>

Expand Down
2 changes: 1 addition & 1 deletion demo/basic/iframe/login.htm
Expand Up @@ -60,7 +60,7 @@
// Since we had a successful login, call-back the parent page to let them know which user logged in:

window.xprops.onLogin(email);
window.xchild.close();
window.xprops.close();

}, 2000);
});
Expand Down
2 changes: 1 addition & 1 deletion demo/basic/iframe/login.js
Expand Up @@ -7,5 +7,5 @@ window.MyLoginZoidComponent = zoid.create({

// The url that will be loaded in the iframe or popup, when someone includes my component on their page

url: zoid.getCurrentScriptDir() + '/login.htm'
url: './login.htm'
});
4 changes: 2 additions & 2 deletions demo/basic/lightbox/index.htm
Expand Up @@ -20,7 +20,7 @@ <h3>Log in on xyz.com</h3>

// Render the component

MyLoginZoidComponent.render({
MyLoginZoidComponent({

prefilledEmail: 'foo@bar.com',

Expand All @@ -29,7 +29,7 @@ <h3>Log in on xyz.com</h3>
document.querySelector('#result').innerText = email + ' logged in!';
}

}, '#container');
}).render('#container');

</script>

Expand Down
2 changes: 1 addition & 1 deletion demo/basic/lightbox/login.htm
Expand Up @@ -60,7 +60,7 @@
// Since we had a successful login, call-back the parent page to let them know which user logged in:

window.xprops.onLogin(email);
window.xchild.close();
window.xprops.close();

}, 2000);
});
Expand Down
4 changes: 2 additions & 2 deletions demo/basic/popup/index.htm
Expand Up @@ -28,15 +28,15 @@ <h3>Log in on xyz.com</h3>

// Render the component

MyLoginZoidComponent.render({
MyLoginZoidComponent({

prefilledEmail: 'foo@bar.com',

onLogin: function(email) {
console.log('User logged in with email:', email);
document.querySelector('#result').innerText = email + ' logged in!';
}
});
}).render('body');
});

</script>
Expand Down
2 changes: 1 addition & 1 deletion demo/basic/popup/login.htm
Expand Up @@ -60,7 +60,7 @@
// Since we had a successful login, call-back the parent page to let them know which user logged in:

window.xprops.onLogin(email);
window.xchild.close();
window.xprops.close();

}, 2000);
});
Expand Down
4 changes: 1 addition & 3 deletions demo/basic/popup/login.js
Expand Up @@ -110,8 +110,6 @@ window.MyLoginZoidComponent = zoid.create({
#${ id } .${ CLASS.ZOID }-close:after {
transform: rotate(-45deg);
}
`
)
);
`));
}
});
6 changes: 1 addition & 5 deletions src/lib/fn.js → demo/common/common.js
@@ -1,9 +1,5 @@
/* @flow */

export function getCurrentScriptDir() : string {
// eslint-disable-next-line no-console
console.warn(`Do not use zoid.getCurrentScriptDir() in production -- browser support is limited`);

function getCurrentScriptDir() {
// eslint-disable-next-line compat/compat
if (document.currentScript) {
// eslint-disable-next-line compat/compat
Expand Down
2 changes: 1 addition & 1 deletion demo/frameworks/angular/index.htm
Expand Up @@ -6,7 +6,7 @@

<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.5.8/angular.js"></script>

<script src="../../../dist/zoid.js"></script>
<script src="../../../dist/zoid.frameworks.js"></script>
<script src="./login.js"></script>

<script>
Expand Down
2 changes: 1 addition & 1 deletion demo/frameworks/angular/login.htm
Expand Up @@ -60,7 +60,7 @@
// Since we had a successful login, call-back the parent page to let them know which user logged in:

window.xprops.onLogin(email);
window.xchild.close();
window.xprops.close();

}, 2000);
});
Expand Down
2 changes: 1 addition & 1 deletion demo/frameworks/angular/login.js
Expand Up @@ -7,5 +7,5 @@ window.MyLoginZoidComponent = zoid.create({

// The url that will be loaded in the iframe or popup, when someone includes my component on their page

url: zoid.getCurrentScriptDir() + '/login.htm'
url: './login.htm'
});
3 changes: 1 addition & 2 deletions demo/frameworks/angular2/index.htm
Expand Up @@ -3,7 +3,6 @@
<head>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-material-design/4.0.2/bootstrap-material-design.css" />
<link rel="stylesheet" href="../../common/index.css" />
<script src="https://npmcdn.com/core-js@2.4.1/client/shim.min.js"></script>
<script src="https://npmcdn.com/zone.js@0.8.12?main=browser"></script>
<script src="https://npmcdn.com/reflect-metadata@0.1.10"></script>
<script src="https://npmcdn.com/rxjs@5.4.1/bundles/Rx.min.js"></script>
Expand All @@ -12,7 +11,7 @@
<script src="https://npmcdn.com/@angular/compiler@4.2.3/bundles/compiler.umd.js"></script>
<script src="https://npmcdn.com/@angular/platform-browser@4.2.3/bundles/platform-browser.umd.js"></script>
<script src="https://npmcdn.com/@angular/platform-browser-dynamic@4.2.3/bundles/platform-browser-dynamic.umd.js"></script>
<script src="../../../dist/zoid.js"></script>
<script src="../../../dist/zoid.frameworks.js"></script>
<script src="./login.js"></script>
</head>

Expand Down
2 changes: 1 addition & 1 deletion demo/frameworks/angular2/login.htm
Expand Up @@ -60,7 +60,7 @@
// Since we had a successful login, call-back the parent page to let them know which user logged in:

window.xprops.onLogin(email);
window.xchild.close();
window.xprops.close();

}, 2000);
});
Expand Down
2 changes: 1 addition & 1 deletion demo/frameworks/angular2/login.js
Expand Up @@ -7,5 +7,5 @@ window.MyLoginZoidComponent = zoid.create({

// The url that will be loaded in the iframe or popup, when someone includes my component on their page

url: zoid.getCurrentScriptDir() + '/login.htm'
url: './login.htm'
});
2 changes: 1 addition & 1 deletion demo/frameworks/angular2_TypeScript/index.htm
Expand Up @@ -13,7 +13,7 @@
<script src="https://unpkg.com/reflect-metadata@0.1.3/Reflect.js"></script>
<script src="https://unpkg.com/systemjs@0.19.31/dist/system.js"></script>
<script src="config.js"></script>
<script src="../../../dist/zoid.js"></script>
<script src="../../../dist/zoid.frameworks.js"></script>
<script src="./login.js"></script>
<script>
System.import('app')
Expand Down
2 changes: 1 addition & 1 deletion demo/frameworks/angular2_TypeScript/login.htm
Expand Up @@ -60,7 +60,7 @@
// Since we had a successful login, call-back the parent page to let them know which user logged in:

window.xprops.onLogin(email);
window.xchild.close();
window.xprops.close();

}, 2000);
});
Expand Down
2 changes: 1 addition & 1 deletion demo/frameworks/angular2_TypeScript/login.js
Expand Up @@ -7,7 +7,7 @@ window.MyLoginZoidComponent = zoid.create({

// The url that will be loaded in the iframe or popup, when someone includes my component on their page

url: zoid.getCurrentScriptDir() + '/login.htm',
url: './login.htm',

props: {

Expand Down

0 comments on commit f45e45b

Please sign in to comment.