@whoisxavier/display-temple 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,18 @@
1
+ engines:
2
+ tslint:
3
+ enabled: true
4
+ duplication:
5
+ enabled: true
6
+ config:
7
+ languages:
8
+ - javascript
9
+ fixme:
10
+ enabled: true
11
+ ratings:
12
+ paths:
13
+ - src/**
14
+ exclude_paths:
15
+ - doc/**/*
16
+ - dist/**/*
17
+ - test/**/*
18
+ - vendor/**/*
package/.esdoc.json ADDED
@@ -0,0 +1,8 @@
1
+ {
2
+ "source": "./src",
3
+ "destination": "./docs",
4
+ "plugins": [
5
+ { "name": "esdoc-standard-plugin" },
6
+ { "name": "esdoc-ecmascript-proposal-plugin", "option": { "all": true } }
7
+ ]
8
+ }
@@ -0,0 +1,30 @@
1
+ name: Test and publish to NPM
2
+ on:
3
+ push:
4
+ # Sequence of patterns matched against refs/tags
5
+ tags:
6
+ - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
7
+ jobs:
8
+ build:
9
+ runs-on: ubuntu-latest
10
+ steps:
11
+ - uses: actions/checkout@v2
12
+ # Setup .npmrc file to publish to npm
13
+ - uses: actions/setup-node@v2
14
+ with:
15
+ node-version: '16.x'
16
+ registry-url: 'https://registry.npmjs.org'
17
+ - run: npm install
18
+ - run: npm run build
19
+ - run: npm publish
20
+ working-directory: dist
21
+ env:
22
+ NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
23
+ # Use action slack
24
+ - uses: 8398a7/action-slack@v3
25
+ with:
26
+ status: ${{ job.status }}
27
+ fields: repo,message,commit,author,action,eventName,ref,job,took,workflow # selectable (default: repo,message)
28
+ env:
29
+ SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} # required
30
+ if: always() # Pick up events even if the job fails or is canceled.
package/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2016 MediaMonks B.V.
2
+
3
+ Permission is hereby granted, free of charge, to any person
4
+ obtaining a copy of this software and associated documentation
5
+ files (the "Software"), to deal in the Software without
6
+ restriction, including without limitation the rights to use,
7
+ copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the
9
+ Software is furnished to do so, subject to the following
10
+ conditions:
11
+
12
+ The above copyright notice and this permission notice shall be
13
+ included in all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
17
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
19
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
20
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22
+ OTHER DEALINGS IN THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,183 @@
1
+ # Display Temple
2
+
3
+ [![npm](https://img.shields.io/npm/v/@whoisxavier/display-temple.svg?style=flat)](https://www.npmjs.com/package/@whoisxavier/display-temple)
4
+ [![npm](https://img.shields.io/npm/dt/@whoisxavier/display-temple.svg?style=flat)](https://www.npmjs.com/package/@whoisxavier/display-temple)
5
+
6
+ Display Advertising Temple by **x-code.studio** - Create display ads units for various vendors.
7
+
8
+ ## Getting Started
9
+
10
+ Refer to the documentation for getting started with display advertising development.
11
+
12
+ ## Installation
13
+
14
+ #### yarn
15
+ ```sh
16
+ yarn add @whoisxavier/display-temple
17
+ ```
18
+
19
+ #### npm
20
+ ```sh
21
+ npm i -S @whoisxavier/display-temple
22
+ ```
23
+
24
+
25
+
26
+ ## Building
27
+
28
+ In order to build seng-boilerplate, ensure that you have [Git](http://git-scm.com/downloads)
29
+ and [Node.js](http://nodejs.org/) installed.
30
+
31
+ Clone a copy of the repo:
32
+ ```sh
33
+ git clone https://github.com/xaviergdiez/display-temple.git
34
+ ```
35
+
36
+ Change to the display-temple directory:
37
+ ```sh
38
+ cd display-temple
39
+ ```
40
+
41
+ Install dev dependencies:
42
+ ```sh
43
+ yarn
44
+ ```
45
+
46
+ Use one of the following main scripts:
47
+ ```sh
48
+ npm run build # build this project
49
+ npm run dev # run compilers in watch mode, both for babel and typescript
50
+ npm run test # run the unit tests incl coverage
51
+ npm run test:dev # run the unit tests in watch mode
52
+ npm run lint # run eslint and tslint on this project
53
+ npm run doc # generate typedoc documentation
54
+ ```
55
+
56
+ When installing this module, it adds a pre-commit hook, that runs lint and prettier commands
57
+ before committing, so you can be sure that everything checks out.
58
+
59
+
60
+ ## Contribute
61
+
62
+ View [CONTRIBUTING.md](./CONTRIBUTING.md)
63
+
64
+
65
+ ## Changelog
66
+
67
+ View [CHANGELOG.md](./CHANGELOG.md)
68
+
69
+
70
+ ## Authors
71
+
72
+ View [AUTHORS.md](./AUTHORS.md)
73
+
74
+
75
+ ## LICENSE
76
+
77
+ [MIT](./LICENSE) © x-code.studio
78
+
79
+ Based on the original work by MediaMonks (MIT License)
80
+
81
+
82
+ ## About this boilerplate
83
+
84
+ **Remove this section when cloning this boilerplate to a real project!**
85
+
86
+ ### Folders
87
+
88
+ This boilerplate contains the following folders:
89
+ * **/coverage** - Contains the generated test code coverage, is sent to Code
90
+ Climate and Coveral.io.
91
+ * **/docs** - Contains the generated documentation by typedoc.
92
+ * **/lib** - Contains the built code from `src/lib`, will be published to npm.
93
+ * **/node_modules** - Contains the node modules generated by running `yarn`.
94
+ * **/src** - Contains the source code.
95
+ * **/test** - Contains the tests.
96
+ * **/vendor** - Can contain 3rd party code used in this project, when not
97
+ available on npm.
98
+
99
+ ### Files
100
+
101
+ This boilerplate contains the following files:
102
+ * **.babelrc** - Contains babel configuration.
103
+ * **.codeclimate.yml** - The Code Climate configuration for this project.
104
+ * **.editorconfig** - Defines general formatting rules.
105
+ * **.eslintignore** - Lists patterns that should be ignored when running eslint.
106
+ * **.eslintrc.js** - Contains eslint configuration.
107
+ * **.gitignore** - These files should not end up in git.
108
+ * **.npmignore** - These files should not end up in npm.
109
+ * **.nvmrc** - Contains nodejs version to build this project with.
110
+ * **.nycrc** - Contains nyc code coverage configuration.
111
+ * **.prettierignore** - Lists patterns that should be ignored when running prettier.
112
+ * **.prettierrc** - Contains prettier formatting configuration.
113
+ * **.travis.yml** - Configuration for Travis CI.
114
+ * **AUTHORS.md** - Contains a list of all the authors that worked on this module.
115
+ * **CONTRIBUTING.md** - Contains information on how to contribute on this project.
116
+ * **index.d.ts** - The built Typescript definitions, referenced in the package.json.
117
+ Will be published to npm.
118
+ * **index.d.ts** - The built Typescript index, referenced in the package.json.
119
+ Will be published to npm.
120
+ * **LICENSE** - Our license file.
121
+ * **package.json** - To list the npm package information, all the dependencies,
122
+ and contains all the scripts that can be run.
123
+ * **README.MD** - This file, remove the about section when cloning this boilerplate.
124
+ * **tsconfig.build.json** - The TypeScript configuration file for building definitions.
125
+ * **tsconfig.json** - The TypeScript configuration file for this project.
126
+ * **tslint.json** - The linting rules for our TypeScript code.
127
+ * **yarn.lock** - Yarn lockfile to freeze module versions.
128
+
129
+ ### Travis
130
+
131
+ This project uses [Travis](https://travis-ci.org) to build, test and
132
+ publish its code to npm. Travis is free for public Github repositories.
133
+
134
+ It runs on all commits, shows the build status for pull requests, and
135
+ publishes to npm when a new tag/release is created.
136
+
137
+ Travis only runs the `npm test` script, so have configured that script
138
+ to run everything we want Travis to check. Besides the unit tests, we
139
+ also run our validations and linters.
140
+
141
+ The travis configuration is placed in a `.travis.yml` file, consisting
142
+ of multiple sections.
143
+
144
+ 1. Defines the `node_js` [language](https://docs.travis-ci.com/user/languages/javascript-with-nodejs),
145
+ and tells travis on which node versions to run the process.
146
+ 2. Before running, it needs to install some global dependencies, and
147
+ when it processes some coverage results.
148
+ 3. It can do a [npm deploy](https://docs.travis-ci.com/user/deployment/npm),
149
+ telling it to keep the generated artifacts and only publish when run
150
+ on node 8 and when a tag was committed. It also contains the email
151
+ address and api key of the npm user.
152
+ 4. Code Climate has a [travis plugin](https://docs.travis-ci.com/user/code-climate/)
153
+ that automatically uploads the code coverage results.
154
+
155
+ Because we want to keep the npm api key secret, we add the token to the Travis Repo settings
156
+ where it will be stored secure:
157
+ https://docs.travis-ci.com/user/environment-variables/#Defining-Variables-in-Repository-Settings
158
+
159
+ Before we can do this, we must make sure that the repository is added
160
+ to Travis, because Travis needs the repository owner/name info to make
161
+ sure the encrypted values only work for that repository.
162
+
163
+ 1. Then make sure you are logged in to your npm account with the
164
+ [adduser](https://docs.npmjs.com/cli/adduser) command:
165
+
166
+ ```sh
167
+ $ npm adduser
168
+ ```
169
+
170
+ To verify that you are logged in correctly you can check:
171
+
172
+ ```sh
173
+ $ npm whoami
174
+ ```
175
+
176
+ 3. Now we need to [create a new token](https://docs.npmjs.com/getting-started/working_with_tokens):
177
+
178
+ ```sh
179
+ npm token create
180
+ ```
181
+
182
+ Copy the token value from the output to the Travis Environment Variable settings, and
183
+ add it with the name `NPM_TOKEN`.
@@ -0,0 +1,19 @@
1
+ const json = require('./package.json');
2
+ const glob = require('glob');
3
+ const fs = require('fs-extra');
4
+ const path = require('path');
5
+
6
+ // options is optional
7
+ glob("./src/**/*.*", {}, function (er, files) {
8
+ Promise.all(files.map(function(file, index){
9
+
10
+ const dest = file.replace('./src/', './dist/');
11
+
12
+ return fs.copy(file, dest)
13
+ .then(() => console.log('success!', dest))
14
+ .catch(err => console.error(err))
15
+ // // fs.createReadStream('test.log').pipe(fs.createWriteStream('newLog.log'));
16
+ })).then(result => {
17
+ fs.copy('README.md', './dist/README.md');
18
+ })
19
+ });
@@ -0,0 +1,8 @@
1
+ const json = require('./package.json');
2
+ const fs = require('fs-extra');
3
+
4
+ const distPackage = Object.assign({}, json);
5
+ distPackage.scripts = {};
6
+ distPackage.devDependencies = {};
7
+
8
+ fs.writeFile('./dist/package.json', JSON.stringify(distPackage), { encoding: 'utf8' });
@@ -0,0 +1,23 @@
1
+ class Animation {
2
+ constructor ()
3
+ {
4
+ this.timeline = gsap.timeline();
5
+
6
+ // do some animation stuff
7
+ this.timeline.to('')
8
+ }
9
+
10
+ ctaRollOver(){
11
+ const ctaRollOver = gsap.timeline();
12
+
13
+ // do some animation stuff
14
+ ctaRollOver.to('')
15
+ }
16
+
17
+ play(){
18
+ this.timeline.play();
19
+ }
20
+ }
21
+
22
+ export default Animation;
23
+
@@ -0,0 +1,25 @@
1
+ class Banner {
2
+
3
+ /**
4
+ *
5
+ * @param {HTMLElement} container
6
+ * @param {Animation} animation
7
+ */
8
+ constructor (container, animation)
9
+ {
10
+ this.animation = animation;
11
+ }
12
+
13
+ // function is called by INIT from studio.events.StudioEvent.INIT
14
+ async init(){
15
+
16
+ // this function already inlines svg img tags
17
+
18
+ }
19
+
20
+ start(){
21
+ this.animation.play();
22
+ }
23
+ }
24
+
25
+ export default Banner;
@@ -0,0 +1,10 @@
1
+ import config from "richmediarc";
2
+ import Banner from './Banner';
3
+ import Animation from './Animation';
4
+
5
+ const banner = new Banner(
6
+ document.querySelector('body'),
7
+ new Animation()
8
+ );
9
+
10
+ banner.start();
@@ -0,0 +1,41 @@
1
+ import FrameAnimation from '../../src/animation/FrameAnimation';
2
+
3
+ class Animation extends FrameAnimation {
4
+ /**
5
+ * @param {gsap.core.Timeline} timeline
6
+ */
7
+ frame0In(timeline){
8
+ timeline.to()
9
+ }
10
+
11
+ /**
12
+ * @param {gsap.core.Timeline} timeline
13
+ */
14
+ frame0(timeline){
15
+ timeline.to()
16
+ }
17
+
18
+ /**
19
+ * @param {gsap.core.Timeline} timeline
20
+ */
21
+ frame0Out(timeline){
22
+ timeline.to()
23
+ }
24
+
25
+ /**
26
+ * @param {gsap.core.Timeline} timeline
27
+ */
28
+ frame1(timeline){
29
+ timeline.to()
30
+ }
31
+
32
+ /**
33
+ * @param {gsap.core.Timeline} timeline
34
+ */
35
+ frame2(timeline){
36
+ timeline.to()
37
+ }
38
+
39
+ }
40
+
41
+ export default Animation;
@@ -0,0 +1,39 @@
1
+ import config from "richmediarc";
2
+ import untilEnablerIsInitialized from '@mediamonks/temple/util/doubleclick/untilEnablerIsInitialized';
3
+ import getEventDispatcher from '@mediamonks/temple/util/doubleclick/getEventDispatcher';
4
+ import Events from '@mediamonks/temple/event/Events';
5
+
6
+ class Banner{
7
+
8
+ config = config;
9
+ /**
10
+ *
11
+ * @param {HTMLElement} container
12
+ * @param {FrameAnimation} animation
13
+ */
14
+ constructor (container, animation)
15
+ {
16
+ this.container = container;
17
+ this.animation = animation;
18
+ }
19
+
20
+ // function is called by INIT from studio.events.StudioEvent.INIT
21
+ async init(){
22
+
23
+ // waits until Enabler is initialized.
24
+ await untilEnablerIsInitialized();
25
+
26
+ const eventDispatcher = await getEventDispatcher();
27
+ eventDispatcher.addEventListener(Events.VISIBLE, () => {
28
+ // do something when banner is visible.
29
+ })
30
+ }
31
+
32
+ async start(){
33
+ await this.init();
34
+
35
+ this.animation.play();
36
+ }
37
+ }
38
+
39
+ export default Banner;
@@ -0,0 +1,9 @@
1
+ import Banner from './Banner';
2
+ import Animation from './Animation';
3
+
4
+ const banner = new Banner(
5
+ document.querySelector('body'),
6
+ new Animation()
7
+ );
8
+
9
+ banner.start();
package/package.json ADDED
@@ -0,0 +1,91 @@
1
+ {
2
+ "name": "@whoisxavier/display-temple",
3
+ "version": "1.0.0",
4
+ "description": "Display Advertising Temple by x-code.studio - Create Display Advertising Units for various vendors.",
5
+ "scripts": {
6
+ "validate": "npm-run-all -p lint test",
7
+ "build": "npm-run-all -s clean build:*",
8
+ "build:copy": "node copy-src-to-dist.js",
9
+ "build:npm": "node create-dist-package-json.js",
10
+ "test": "cross-env NODE_ENV=test nyc --all mocha \"./test/**/*.spec.js\"",
11
+ "test:dev": "mocha -w --watch-extensions ts,js \"./test/**/*.spec.js\"",
12
+ "clean": "npm-run-all clean:*",
13
+ "clean:test": "shx rm -rf coverage .nyc_output",
14
+ "clean:npm": "shx rm -rf lib tmp index.js",
15
+ "doc": "node_modules/.bin/esdoc",
16
+ "lint": "npm-run-all lint:*",
17
+ "lint:js": "eslint src --ext .js --cache",
18
+ "prettify": "prettier --write \"src/**/*.{js,json}\"",
19
+ "precommit": "lint-staged"
20
+ },
21
+ "lint-staged": {
22
+ "linters": {
23
+ "src/**/*.{js,json}": [
24
+ "prettier --write",
25
+ "git add"
26
+ ]
27
+ }
28
+ },
29
+ "pre-push": [
30
+ "validate"
31
+ ],
32
+ "repository": {
33
+ "type": "git",
34
+ "url": "git+https://github.com/xaviergdiez/display-temple.git"
35
+ },
36
+ "publishConfig": {
37
+ "access": "public"
38
+ },
39
+ "author": "Xavier Diez <hello@whoisxavier.com>",
40
+ "license": "MIT",
41
+ "bugs": {
42
+ "url": "https://github.com/xaviergdiez/display-temple/issues"
43
+ },
44
+ "homepage": "https://github.com/xaviergdiez/display-temple#readme",
45
+ "devDependencies": {
46
+ "@babel/cli": "^7.11.5",
47
+ "@babel/core": "^7.11.5",
48
+ "@babel/plugin-transform-runtime": "^7.11.5",
49
+ "@babel/preset-env": "^7.11.5",
50
+ "@babel/preset-stage-3": "^7.8.3",
51
+ "@babel/register": "^7.11.5",
52
+ "@types/chai": "^4.2.12",
53
+ "@types/mocha": "^2.2.44",
54
+ "@types/sinon": "^4.1.2",
55
+ "@types/sinon-chai": "^2.7.37",
56
+ "babel-eslint": "^8.0.3",
57
+ "babel-plugin-istanbul": "^4.1.5",
58
+ "babel-preset-next": "^1.4.0",
59
+ "chai": "^4.1.2",
60
+ "coveralls": "^2.11.6",
61
+ "cross-env": "^5.2.1",
62
+ "esdoc": "^1.1.0",
63
+ "esdoc-ecmascript-proposal-plugin": "^1.0.0",
64
+ "esdoc-standard-plugin": "^1.0.0",
65
+ "eslint": "^4.13.1",
66
+ "eslint-config-airbnb-base": "^12.1.0",
67
+ "eslint-config-prettier": "^2.9.0",
68
+ "eslint-friendly-formatter": "^3.0.0",
69
+ "eslint-import-resolver-typescript": "^1.0.2",
70
+ "eslint-plugin-import": "^2.22.0",
71
+ "eslint-plugin-prettier": "^2.4.0",
72
+ "fs-extra": "^6.0.1",
73
+ "glob": "^7.1.6",
74
+ "husky": "^0.14.3",
75
+ "jsdom": "^11.5.1",
76
+ "jsdom-global": "^3.0.2",
77
+ "lint-staged": "^6.0.0",
78
+ "mocha": "^4.0.1",
79
+ "npm-run-all": "^4.1.5",
80
+ "nyc": "^11.3.0",
81
+ "prettier": "^1.19.1",
82
+ "shx": "^0.2.2",
83
+ "sinon": "^4.1.3",
84
+ "sinon-chai": "^2.14.0",
85
+ "esdoc-publish-html-plugin": "^1.1.2"
86
+ },
87
+ "peerDependencies": {
88
+ "gsap": "^3.1.0"
89
+ },
90
+ "dependencies": {}
91
+ }
package/scoping.js ADDED
@@ -0,0 +1 @@
1
+