diff --git a/.eslintignore b/.eslintignore index 95d81af2..a0147878 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,3 +1,4 @@ test/lib demo -dist \ No newline at end of file +dist +test/.eslintrc.js diff --git a/.flowconfig b/.flowconfig index 3a1d569f..64a6f66f 100644 --- a/.flowconfig +++ b/.flowconfig @@ -3,6 +3,7 @@ .*/node_modules/flow-runtime .*/node_modules/npm .*/node_modules/jsonlint +.*/node_modules/resolve .*/dist/module [include] [libs] @@ -12,7 +13,4 @@ node_modules/post-robot/src/declarations.js node_modules/grumbler-scripts/declarations.js [options] module.name_mapper='^src\(.*\)$' -> '/src/\1' -experimental.const_params=false -esproposal.export_star_as=enable -esproposal.decorators=ignore -include_warnings=true +experimental.const_params=false \ No newline at end of file diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml new file mode 100644 index 00000000..fa6c78d8 --- /dev/null +++ b/.github/workflows/node.js.yml @@ -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 \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index 5bce9ce0..9a784305 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 diff --git a/README.md b/README.md index 8ecbd310..4080f77e 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,16 @@ -

+

zoid

---- +[![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: @@ -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 diff --git a/SECURITY.md b/SECURITY.md index ed4322a4..272ffa9f 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -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. diff --git a/babel.config.js b/babel.config.js index 2e0a208b..c44b8e7d 100644 --- a/babel.config.js +++ b/babel.config.js @@ -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' + ] }; diff --git a/demo/advanced/react-end-to-end/index.htm b/demo/advanced/react-end-to-end/index.htm index e04e5ebf..ead8eac7 100644 --- a/demo/advanced/react-end-to-end/index.htm +++ b/demo/advanced/react-end-to-end/index.htm @@ -4,8 +4,8 @@ - - + + @@ -17,38 +17,33 @@ - + + @@ -16,70 +16,89 @@ + diff --git a/demo/frameworks/angular2/index.htm b/demo/frameworks/angular2/index.htm index 6168cc91..4fcdcbd1 100644 --- a/demo/frameworks/angular2/index.htm +++ b/demo/frameworks/angular2/index.htm @@ -5,12 +5,12 @@ - - - - - - + + + + + + @@ -20,13 +20,22 @@ - + \ No newline at end of file diff --git a/demo/frameworks/vue3/index.htm b/demo/frameworks/vue3/index.htm new file mode 100644 index 00000000..e2660bdf --- /dev/null +++ b/demo/frameworks/vue3/index.htm @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + +
+ +
+ + + + \ No newline at end of file diff --git a/demo/frameworks/vue3/login.htm b/demo/frameworks/vue3/login.htm new file mode 100644 index 00000000..f64b85e1 --- /dev/null +++ b/demo/frameworks/vue3/login.htm @@ -0,0 +1,70 @@ + + + + + + + + + + + + + + + + + +
+
+
+ +
+ + + + + + + + \ No newline at end of file diff --git a/demo/frameworks/vue3/login.js b/demo/frameworks/vue3/login.js new file mode 100644 index 00000000..891e42b6 --- /dev/null +++ b/demo/frameworks/vue3/login.js @@ -0,0 +1,12 @@ + +window.MyLoginZoidComponent = zoid.create({ + + // The html tag used to render my component + + tag: 'my-login-component', + + // The url that will be loaded in the iframe or popup, when someone includes my component on their page + + url: new URL('login.htm', window.location.href).href +}); + diff --git a/demo/index.htm b/demo/index.htm index 8d04eb2b..2fcdc9d4 100644 --- a/demo/index.htm +++ b/demo/index.htm @@ -34,7 +34,6 @@

basic demos

framework demos