Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
115 commits
Select commit Hold shift + click to select a range
92d2fdb
Allow zoid to work in script-namespace mode
Sep 30, 2020
be01e6e
Dist
Sep 30, 2020
8d5c6b3
9.0.59
Sep 30, 2020
1b0b24e
Decouple cleaning zoid instance, and cleaning component instances
Sep 30, 2020
cba9bb5
Dist
Sep 30, 2020
cf323be
9.0.60
Sep 30, 2020
6ae489c
Upgrade flow
Oct 2, 2020
2f7c145
Dist
Oct 2, 2020
af6de36
9.0.61
Oct 2, 2020
a3a7ae7
Remove zoid types from globals
Oct 4, 2020
946169c
Dist
Oct 4, 2020
9b5ddee
9.0.62
Oct 4, 2020
833dc2b
closes #328 - update travis file to remove node_modules folder before…
anthonykhoa Oct 9, 2020
7114b35
closes #326 - add test/eslintrc.js file to estlintignore (#327)
anthonykhoa Oct 9, 2020
8b3208f
closes #291 - make sure process exists before checking process.env an…
anthonykhoa Oct 9, 2020
3012b1c
Upgrade react in end-to-end example
Oct 14, 2020
3303fa0
Fix demo urls
Oct 14, 2020
da598d3
Use improved onElementClose helper
Nov 29, 2020
9addf71
Pass errors through destroy
Dec 9, 2020
2c016f0
Lock flow-bin version
Dec 9, 2020
47a8cad
Dist
Dec 9, 2020
3281f76
9.0.63
Dec 9, 2020
3870ce7
Fix typo (#339)
akshay-8d66 Apr 14, 2021
7002869
Test fixes
Apr 22, 2021
ddd2ac7
Dist
May 3, 2021
cafa3c4
9.0.64
May 3, 2021
418e609
updating false value check for props (#343)
shrutikapoor08 May 3, 2021
ef7cb49
Dist
May 3, 2021
e62d02c
9.0.65
May 3, 2021
09f9b4c
render within shadow DOM test added (#346)
gabrielo91 Jun 4, 2021
68bf604
Add codecov and badges (#348)
amyegan Jun 4, 2021
bb41444
Vue driver support for kebab-case (#351)
leogedler Jun 15, 2021
a958a9a
Dist
Jun 15, 2021
ff99be1
9.0.66
Jun 15, 2021
b9e6a14
Specify type of deserialized child exports
Jun 23, 2021
8e66be5
Add support for exports
Jun 23, 2021
c2fa6a5
Dist
Jun 23, 2021
45508d7
9.0.67
Jun 23, 2021
3a6fad7
Check types correctly in tests
Jun 25, 2021
8ca2873
Dist
Jun 25, 2021
ef9de37
9.0.68
Jun 25, 2021
f005ef0
Enforce that queryValue always returns a string
Jun 25, 2021
bdb0974
Dist
Jun 25, 2021
082c00a
9.0.69
Jun 25, 2021
9c5640d
Upgrade flow to 155
Jul 15, 2021
34dcc0a
Dist
Jul 15, 2021
5038438
9.0.70
Jul 15, 2021
e8c286a
Automatically re-render when container element removed and immediatel…
Jul 16, 2021
e21405a
Allow url method to be set, and props to be passed as body params
Jul 22, 2021
0fa0d59
Dist
Jul 22, 2021
c3ece21
9.0.71
Jul 22, 2021
c0a6ff7
Fixing broken demos for basic popup and missing script demo (#358)
sioked Aug 12, 2021
064f61b
Vue driver logic for prop name replacement (style prop). (#357)
leogedler Aug 12, 2021
fa44e68
Dist
Aug 12, 2021
bdbbe8c
9.0.72
Aug 12, 2021
09a9c83
Fix case where default context was not respected for renderTo popup case
Aug 12, 2021
a355546
Dist
Aug 12, 2021
61f5353
9.0.73
Aug 12, 2021
4d179e1
allowing dimensions to be passed as function (#370)
aditya27marri Aug 30, 2021
229bac9
Dist
Aug 30, 2021
3587cc9
9.0.74
Aug 30, 2021
d53ece8
New drivers for Vue3 and Angular5+ (#365)
andregardi Sep 7, 2021
3440195
Dist
gregjopa Sep 7, 2021
43bffbb
9.0.75
gregjopa Sep 7, 2021
2dbdee3
Fix test coverage for children
Sep 9, 2021
b3efa30
Add missing items to api docs
Sep 9, 2021
0ee978a
Add support for children components
Sep 9, 2021
f1ad09b
Dist
Sep 9, 2021
9d3dbab
9.0.76
Sep 9, 2021
e4816d2
Restructure api docs
Sep 9, 2021
812b941
Test for prop inheriting from parent
Sep 10, 2021
06974fa
Test and cleanup fixes
Sep 10, 2021
559f2b5
Avoid loading zoid multiple times in tests
Sep 10, 2021
579e3ba
Add more comprehensive custom window close test cases
Sep 10, 2021
4c0ae56
Add xprops.getSiblings
Sep 10, 2021
f8eeb3e
Create node.js.yml
Sep 10, 2021
06976da
Wait for full render before attempting to get siblings in tests
Sep 10, 2021
68b9055
Allow exports to be declared as an object
Sep 11, 2021
7754651
Dist
Sep 16, 2021
84ba1ad
9.0.77
Sep 16, 2021
41fcb1e
Dist
Sep 17, 2021
5dd3970
9.0.78
Sep 17, 2021
725846e
Try/catch for cross domain global access
Sep 21, 2021
f88113a
Dist
Sep 21, 2021
24949fb
9.0.79
Sep 21, 2021
c890107
Refactor and clean up initial child payload serialization
Sep 22, 2021
d1c19e1
Multi-domain child support (#372)
Sep 24, 2021
ebaeb1c
Dist
Sep 24, 2021
89d3ee1
9.0.80
Sep 24, 2021
a4c1564
fix: specify dimensions in iframe demo (#375)
crookedneighbor Oct 20, 2021
89342cc
Pass container to prop definitions when available (#376)
Oct 28, 2021
4cc5707
Dist
Oct 28, 2021
ab1d3c3
9.0.81
Oct 28, 2021
03222ea
Revert "Pass container to prop definitions when available (#376)" (#378)
gregjopa Nov 2, 2021
9645c8e
Dist
gregjopa Nov 2, 2021
1e74033
9.0.82
gregjopa Nov 2, 2021
88e972d
chore: add tests related to zoid prop usage in the wild (#379)
westeezy Nov 2, 2021
cf62648
Add more props tests
Nov 30, 2021
044028f
Add more tests for multiple decorate and updateProps cases
bluepnume Nov 30, 2021
4bc46b3
Add tests to ensure decorate is called after alias/value/default
bluepnume Nov 30, 2021
79ab54a
Add tests to ensure passed prop is passed to default and value functions
bluepnume Nov 30, 2021
2c3aac7
Support passing container to component prop helper functions (#382)
Dec 7, 2021
9edb65a
Dist
bluepnume Dec 7, 2021
a11b2e3
9.0.83
bluepnume Dec 7, 2021
a6ddc0d
Dist
bluepnume Dec 7, 2021
6674172
9.0.84
bluepnume Dec 7, 2021
4fba82c
Revert "Support passing container to component prop helper functions …
bluepnume Dec 13, 2021
55424e3
Add more prop tests
bluepnume Dec 13, 2021
3624f50
Fix github actions job
bluepnume Dec 13, 2021
917322e
Dist
bluepnume Dec 13, 2021
6d1f0e6
9.0.85
bluepnume Dec 13, 2021
83e2357
Fix flow check
bluepnume Jan 12, 2022
29be230
Support passing container to component prop helper functions (#382) (…
Jan 12, 2022
60078b1
Dist
bluepnume Jan 12, 2022
e6fdbd2
9.0.86
bluepnume Jan 12, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
test/lib
demo
dist
dist
test/.eslintrc.js
6 changes: 2 additions & 4 deletions .flowconfig
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
.*/node_modules/flow-runtime
.*/node_modules/npm
.*/node_modules/jsonlint
.*/node_modules/resolve
.*/dist/module
[include]
[libs]
Expand All @@ -12,7 +13,4 @@ node_modules/post-robot/src/declarations.js
node_modules/grumbler-scripts/declarations.js
[options]
module.name_mapper='^src\(.*\)$' -> '<PROJECT_ROOT>/src/\1'
experimental.const_params=false
esproposal.export_star_as=enable
esproposal.decorators=ignore
include_warnings=true
experimental.const_params=false
37 changes: 37 additions & 0 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# This workflow will do a clean install of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions

name: Node.js CI

on:
# run on push but only for the master branch
push:
branches:
- master
# run for every pull request
pull_request: {}
jobs:
main:
runs-on: ubuntu-latest
steps:
- name: ⬇️ Checkout repo
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: ⎔ Setup node
uses: actions/setup-node@v2
with:
node-version: '14'
registry-url: 'https://registry.npmjs.org'

- name: 📥 Download deps
uses: bahmutov/npm-install@v1
with:
useLockFile: false

- name: ▶️ Run flow-typed script
run: npm run flow-typed

- name: ▶️ Run test script
run: npm run test
7 changes: 6 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
language: node_js
node_js:
- "lts/*"
- 'lts/*'
before_install:
- rm -rf node_modules
- npm install -g codecov
script: npm test
after_success:
- codecov
14 changes: 12 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
<p align="center"><img width="45%" src="https://cdn.rawgit.com/krakenjs/zoid/master/zoid.png"></p>
<p align="center"><img width="45%" alt="zoid" src="https://cdn.rawgit.com/krakenjs/zoid/master/zoid.png"></p>

----
[![build status][build-badge]][build]
[![code coverage][coverage-badge]][coverage]
[![npm version][version-badge]][package]

[build-badge]: https://img.shields.io/github/workflow/status/krakenjs/zoid/build?logo=github&style=flat-square
[build]: https://github.com/krakenjs/zoid/actions?query=workflow%3Abuild
[coverage-badge]: https://img.shields.io/codecov/c/github/krakenjs/zoid.svg?style=flat-square
[coverage]: https://codecov.io/github/krakenjs/zoid/
[version-badge]: https://img.shields.io/npm/v/zoid.svg?style=flat-square
[package]: https://www.npmjs.com/package/zoid

A cross-domain component toolkit, supporting:

Expand All @@ -13,7 +23,7 @@ It's 'data-down, actions up' style components, but 100% cross-domain using ifram

-----

### [API Docs](./docs/api.md)
### [API Docs](./docs/api/index.md)

Public options and methods supported by zoid

Expand Down
2 changes: 1 addition & 1 deletion SECURITY.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Security Policy
## How is Zoid secure?
Zoid uses [Post Robot](https://github.com/krakenjs/post-robot) to do [post messaging](https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage) between multiple domains.
Zoid helps secure messaging through iframe sanboxing, domain validation, and data protection.
Zoid helps secure messaging through iframe sandboxing, domain validation, and data protection.
- __Iframe sandboxing__ is a default browser feature that blocks others from accessing the data of your iframe instance.
- __Domain Validation__ checks the domain of the connection made to the Zoid child component, if requested. If domains don’t match accepted domains the connect fails. This is to stop access to secure components.
- __Data Protection__ is the way Zoid manages checking domains of where the data was sent from to help protect against malicious data being injected through events.
Expand Down
6 changes: 5 additions & 1 deletion babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,9 @@

// eslint-disable-next-line import/no-commonjs
module.exports = {
extends: 'grumbler-scripts/config/.babelrc-node'
extends: 'grumbler-scripts/config/.babelrc-node',

ignore: [
'test/lib'
]
};
51 changes: 23 additions & 28 deletions demo/advanced/react-end-to-end/index.htm
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
<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://cdnjs.cloudflare.com/ajax/libs/react/15.3.2/react.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.3.2/react-dom.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/16.13.1/umd/react.development.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react-dom/16.13.1/umd/react-dom.development.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.8.38/browser.js"></script>

<script src="../../../dist/zoid.frameworks.js"></script>
Expand All @@ -17,38 +17,33 @@

<script type="text/babel">

let MyLoginReactZoidComponent = MyLoginZoidComponent.driver('react', {
let LoginZoidReactComponent = LoginZoidComponent.driver('react', {
React: window.React,
ReactDOM: window.ReactDOM
});

let App = React.createClass({
function App() {
const [ loggedIn, setLoggedIn ] = React.useState(false);
const [ email, setEmail ] = React.useState('foo@bar.com');

getInitialState() {
return {
prefilledEmail: 'foo@bar.com'
};
},

render() {

let onLogin = (email) =>
this.setState({ email, loggedIn: true });

return (
<div>
<h3>Log in on xyz.com</h3>

{ this.state.loggedIn

? <p>User logged in with email: { this.state.email }</p>

: <MyLoginReactZoidComponent prefilledEmail={ this.state.prefilledEmail } onLogin={ onLogin } />
}
</div>
);
let onLogin = (email) => {
setEmail(email);
setLoggedIn(true);
}
});

return (
<div>
<h3>Log in on xyz.com</h3>

{ loggedIn
? <p>User logged in with email: { email }</p>
: <LoginZoidReactComponent
prefilledEmail={ email }
onLogin={ onLogin } />
}
</div>
);
}

ReactDOM.render(<App />, document.querySelector('#container'));

Expand Down
147 changes: 83 additions & 64 deletions demo/advanced/react-end-to-end/login.htm
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
<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/login.css" />

<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.3.2/react.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.3.2/react-dom.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/16.13.1/umd/react.development.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react-dom/16.13.1/umd/react-dom.development.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.8.38/browser.js"></script>

<script src="../../../dist/zoid.frameworks.js"></script>
Expand All @@ -16,70 +16,89 @@

<script type="text/babel">

let MyLoginComponent = React.createClass({

getInitialState() {
return { displayForm: true, displaySpinner: false, email: this.props.prefilledEmail };
},

render() {

let login = () => {
this.setState({ displayForm: false, displaySpinner: true });

setTimeout(() => {
this.setState({ displaySpinner: false });
this.props.onLogin(this.state.email);
}, 2000);
};

return (
<form>
{
this.state.displayForm && <div>

<input
placeholder='email'
defaultValue={ this.state.email }
onChange={
event => this.setState({ email: event.target.value })
}>
</input>

<br/>

<input
placeholder='password' type='password'
onChange={
event => this.setState({ password: event.target.value })
}>
</input>

<br/>

<button
className='btn btn-primary'
onClick={ login }>
Log In
</button>

</div>
}

{
this.state.displaySpinner && <div>
<svg id='spinner' className='spinner' width='65px' height='65px' viewBox='0 0 66 66' xmlns='http://www.w3.org/2000/svg'>
<circle className='path' fill='none' strokeWidth='6' strokeLinecap='round' cx='33' cy='33' r='30'></circle>
</svg>
</div>
}
</form>
);
}
});
function Login({ onLogin, prefilledEmail }) {
let [ email, setEmail ] = React.useState(prefilledEmail);
let [ password, setPassword ] = React.useState('');
let [ displaySpinner, setDisplaySpinner ] = React.useState(false);

let login = () => {
setDisplaySpinner(true)

setTimeout(() => {
onLogin(email);
}, 2000);
};

return (
<form>
{
displaySpinner
? (
<div>
<svg id='spinner' className='spinner' width='65px' height='65px' viewBox='0 0 66 66' xmlns='http://www.w3.org/2000/svg'>
<circle className='path' fill='none' strokeWidth='6' strokeLinecap='round' cx='33' cy='33' r='30'></circle>
</svg>
</div>
)
: (
<div>

<input
placeholder='email'
value={ email }
onChange={
event => setEmail(event.target.value)
}>
</input>

<br/>

<input
placeholder='password' type='password'
value={ password }
onChange={
event => setPassword(event.target.value)
}>
</input>

<br/>

<button
className='btn btn-primary'
onClick={ login }>
Log In
</button>

</div>
)
}
</form>
);
}

function useXProps() {
const [ xprops, setXProps ] = React.useState(window.xprops);
React.useEffect(() => {
window.xprops.onProps(props => {
setXProps({ ...props })
});
}, []);
return xprops;
}

function App() {
const { prefilledEmail, onLogin } = useXProps();

return (
<Login
prefilledEmail={ prefilledEmail }
onLogin={ onLogin }
/>
);
}

ReactDOM.render(
<MyLoginComponent { ...window.xprops } />,
<App />,
document.querySelector('#container')
);

Expand Down
2 changes: 1 addition & 1 deletion demo/advanced/react-end-to-end/login.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

window.MyLoginZoidComponent = zoid.create({
window.LoginZoidComponent = zoid.create({

// The html tag used to render my component

Expand Down
2 changes: 1 addition & 1 deletion demo/advanced/remote-popup/login-button.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ window.MyLoginButtonComponent = zoid.create({

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

url: './login-button.htm',
url: new URL('login-button.htm', window.location.href).href,

// The size of the component on their page

Expand Down
2 changes: 1 addition & 1 deletion demo/advanced/remote/login-button.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ window.MyLoginButtonComponent = zoid.create({

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

url: './login-button.htm',
url: new URL('login-button.htm', window.location.href).href,

// The size of the component on their page

Expand Down
4 changes: 4 additions & 0 deletions demo/basic/iframe/login.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@

window.MyLoginZoidComponent = zoid.create({
dimensions: {
width: '300px',
height: '150px',
},

// The html tag used to render my component

Expand Down
2 changes: 1 addition & 1 deletion demo/basic/popup/index.htm
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<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="../../../node_modules/jsx-pragmatic/dist/jsx-pragmatic.js"></script>
<script src="https://unpkg.com/jsx-pragmatic@2.0.20/dist/jsx-pragmatic.js"></script>
<script src="../../../dist/zoid.js"></script>
<script src="./login.js"></script>
</head>
Expand Down
Loading