├── .gitignore ├── README.md ├── dist ├── aframedc.js └── aframedc.min.js ├── examples ├── components │ ├── barchart │ │ ├── basic │ │ │ └── index.html │ │ └── index.html │ ├── barchart3d │ │ ├── basic │ │ │ ├── barchartdata.html │ │ │ ├── index.html │ │ │ └── js │ │ │ │ ├── barchartdata.js │ │ │ │ └── demobarchart3d.js │ │ └── index.html │ ├── barchartstack │ │ ├── basic │ │ │ └── index.html │ │ └── index.html │ ├── bubblechart │ │ ├── basic │ │ │ ├── index.html │ │ │ ├── index2.html │ │ │ └── js │ │ │ │ ├── demobubblechart.js │ │ │ │ └── demobubblechart2.js │ │ └── index.html │ └── smoothcurvechart │ │ ├── basic │ │ └── index.html │ │ └── index.html ├── data │ ├── opnfv-commits.json │ ├── opnfv-commitsTD.json │ ├── scm-commits-filtered.json │ ├── scm-commits-filtered2.json │ ├── scm-commits.json │ └── webvr_commits.json ├── demopiechartscratch.html ├── img │ ├── dawnmountain-xneg.png │ ├── dawnmountain-xpos.png │ ├── dawnmountain-yneg.png │ ├── dawnmountain-ypos.png │ ├── dawnmountain-zneg.png │ ├── dawnmountain-zpos.png │ ├── dirt.png │ ├── fondo.jpg │ ├── opnfv.png │ ├── sky-xneg.png │ ├── sky-xpos.png │ ├── sky-yneg.png │ ├── sky-ypos.png │ ├── sky-zneg.png │ ├── sky-zpos.png │ ├── skycubemap-xneg.jpg │ ├── skycubemap-xpos.jpg │ ├── skycubemap-yneg.jpg │ ├── skycubemap-ypos.jpg │ ├── skycubemap-zneg.jpg │ ├── skycubemap-zpos.jpg │ └── webvr-logo.png ├── index.html ├── js │ ├── aframedc.js │ └── aframedc.min.js └── scenes │ ├── companiescommits │ ├── index.html │ └── js │ │ └── democompaniescommits.js │ ├── companiesdatapanel │ ├── index.html │ └── js │ │ └── democompaniescommitsPanel.js │ ├── opnfvstatistics │ ├── index.html │ └── js │ │ └── demoOPNFV1105.js │ ├── opnfvstatistics3dinfront │ ├── index.html │ └── js │ │ └── demoOPNFV1105.js │ ├── opnfvstatistics3dinfrontVR │ ├── index.html │ └── js │ │ └── demoOPNFV1105.js │ └── webvrstatistics │ ├── index.html │ └── js │ └── demoWEBVR.js ├── package.json ├── src ├── basefunctions.js ├── components │ ├── .gitignore │ ├── aframe-grid │ │ ├── LICENSE │ │ ├── README.md │ │ ├── dist │ │ │ ├── aframe-aframe-grid-component.js │ │ │ └── aframe-aframe-grid-component.min.js │ │ ├── index.js │ │ ├── package.json │ │ └── tests │ │ │ ├── __init.test.js │ │ │ ├── helpers.js │ │ │ ├── index.test.js │ │ │ └── karma.conf.js │ ├── aframe-gridxz │ │ ├── LICENSE │ │ ├── README.md │ │ ├── index.js │ │ ├── package.json │ │ └── tests │ │ │ ├── __init.test.js │ │ │ ├── helpers.js │ │ │ ├── index.test.js │ │ │ └── karma.conf.js │ ├── aframe-gridyz │ │ ├── LICENSE │ │ ├── README.md │ │ ├── index.js │ │ ├── package.json │ │ └── tests │ │ │ ├── __init.test.js │ │ │ ├── helpers.js │ │ │ ├── index.test.js │ │ │ └── karma.conf.js │ ├── barchart │ │ ├── LICENSE │ │ ├── README.md │ │ ├── dist │ │ │ ├── aframe-barchart-component.js │ │ │ └── aframe-barchart-component.min.js │ │ ├── index.js │ │ ├── package.json │ │ └── tests │ │ │ ├── __init.test.js │ │ │ ├── helpers.js │ │ │ ├── index.test.js │ │ │ └── karma.conf.js │ ├── barchart3d │ │ ├── LICENSE │ │ ├── README.md │ │ ├── dist │ │ │ ├── barchart3d-component.js │ │ │ └── barchart3d-component.min.js │ │ ├── index.js │ │ ├── package.json │ │ └── tests │ │ │ ├── __init.test.js │ │ │ ├── helpers.js │ │ │ ├── index.test.js │ │ │ └── karma.conf.js │ ├── barchartstack │ │ ├── LICENSE │ │ ├── README.md │ │ ├── dist │ │ │ ├── barchartstack-component.js │ │ │ └── barchartstack-component.min.js │ │ ├── index.js │ │ ├── package.json │ │ └── tests │ │ │ ├── __init.test.js │ │ │ ├── helpers.js │ │ │ ├── index.test.js │ │ │ └── karma.conf.js │ ├── bubblechart │ │ ├── LICENSE │ │ ├── README.md │ │ ├── dist │ │ │ ├── bubblechart-component.js │ │ │ └── bubblechart-component.min.js │ │ ├── index.js │ │ ├── package.json │ │ └── tests │ │ │ ├── __init.test.js │ │ │ ├── helpers.js │ │ │ ├── index.test.js │ │ │ └── karma.conf.js │ ├── envmap │ │ ├── LICENSE │ │ ├── README.md │ │ ├── dist │ │ │ ├── envmap-component.js │ │ │ └── envmap-component.min.js │ │ ├── index.js │ │ ├── package.json │ │ └── tests │ │ │ ├── __init.test.js │ │ │ ├── helpers.js │ │ │ ├── index.test.js │ │ │ └── karma.conf.js │ ├── panel │ │ ├── LICENSE │ │ ├── README.md │ │ ├── dist │ │ │ ├── panel-component.js │ │ │ └── panel-component.min.js │ │ ├── index.js │ │ ├── package.json │ │ └── tests │ │ │ ├── __init.test.js │ │ │ ├── helpers.js │ │ │ ├── index.test.js │ │ │ └── karma.conf.js │ ├── piechart │ │ ├── LICENSE │ │ ├── README.md │ │ ├── dist │ │ │ ├── aframe-piechart-component.js │ │ │ └── aframe-piechart-component.min.js │ │ ├── index.js │ │ ├── package.json │ │ └── tests │ │ │ ├── __init.test.js │ │ │ ├── helpers.js │ │ │ ├── index.test.js │ │ │ └── karma.conf.js │ ├── smoothcurvechart │ │ ├── LICENSE │ │ ├── README.md │ │ ├── index.js │ │ ├── package.json │ │ └── tests │ │ │ ├── __init.test.js │ │ │ ├── helpers.js │ │ │ ├── index.test.js │ │ │ └── karma.conf.js │ └── title │ │ ├── LICENSE │ │ ├── README.md │ │ ├── index.js │ │ ├── package.json │ │ └── tests │ │ ├── __init.test.js │ │ ├── helpers.js │ │ ├── index.test.js │ │ └── karma.conf.js └── index.js └── webpack-dev.config.js /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | gh_pages/ 3 | npm-debug.log* 4 | .npm 5 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # a-framedc 2 | 3D charts built with A-frame. A-framedc ships with a set of A-Frame components and a library to use them in easier way.It provides the following features: 3 | 4 | - Create 3D chart visualizations of data. 5 | - No additional software must we installed for executing our software thanks to A-Frame. 6 | - Similar functionality as [dc.js](https://github.com/dc-js/dc.js) library with filter possibilities and different types of charts. 7 | - A fast filter response thanks to crossfilter. 8 | - The ability to change between a 3D scene and a Virtual reality scenario. 9 | - Render our charts on a existing scenario, or create a scene from scratch. 10 | 11 | Our library exports a single global object (a-framedc) on which we have the following methods: 12 | 13 | - **addDashBoard(AFrameScene):** Allows us to associate a dashboard with an existing A-Frame scene. To do this, we must pass through this scene. Returns the dashboard object. 14 | - **Dashboard(containerdiv):** Allows us to create a new scene from scratch. It initialize a default configuration by creating the scene and a default camera. Returns the dashboard object. 15 | - **Panel:** creates a new [panel](https://github.com/fran-aguilar/a-framedc/tree/master/src/components/panel/) to add charts to it. 16 | - [**barChart:**](https://github.com/fran-aguilar/a-framedc/tree/master/src/components/piechart) Creates an A-Frame entity associated with the barchart component. 17 | This is a chart which visualizes the evolution of a value or attribute along an axis, commonly time, with bars of different heights. 18 | - [**pieChart:**](https://github.com/fran-aguilar/a-framedc/tree/master/src/components/piechart) Creates an A-Frame entity associated with the piechart component. 19 | This is a chart which composes a circle that represents the different parts of a whole in a set of segments of that circle until completing it. 20 | - [**bubbleChart:**](https://github.com/fran-aguilar/a-framedc/tree/master/src/components/bubblechart) Creates an A-Frame entity associated with the bubblechart component.This is a chart that represents different spheres of different position and size depending on different categories. In the context of our library we play with the following parameters: width, height, depth and radius of the sphere. 21 | - [**barChart3d:**](https://github.com/fran-aguilar/a-framedc/tree/master/src/components/barchart3d) Creates an A-Frame entity associated with the barChart3d component. It is a chart which has bars of different heights like barchart, but the height of each bar is determined by two values of two different categories. These bars are drawn along two axis. 22 | - [**barChartstack:**](https://github.com/fran-aguilar/a-framedc/tree/master/src/components/barchartstack) Creates an A-Frame entity associated with the barchartstack component.This is also a bar chart, in this case each bar is composed of parts of different size that make up the total of the bar in that specific value. 23 | - [**smoothCurveChart:**](https://github.com/fran-aguilar/a-framedc/tree/master/src/components/smoothcurvechart) Creates an A-Frame entity associated with the smoothcurvechart component.This is a graph with a line representing the evolution of a value or attribute along an axis. This graph does not respond directly to user actions, mouse events etc. Your data is updated if your group / dimension of crossfilter is affected. 24 | 25 | #### Browser Installation 26 | 27 | Install and use by directly including the [browser files](dist): 28 | 29 | 30 | ```html 31 | 32 | My A-Frame Scene 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | ``` 46 | 47 | #### NPM Installation 48 | 49 | Install via NPM: 50 | 51 | ```bash 52 | npm install a-framedc 53 | ``` 54 | 55 | Then register and use. 56 | 57 | ```js 58 | require('aframe'); 59 | var aframedc = require('a-framedc'); 60 | ``` 61 | #### Contact 62 | This project is under active development if you have any issue please let me know. Every help is much appreciated. 63 | -------------------------------------------------------------------------------- /examples/components/barchart/basic/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | A-Frame Barchart Component - Basic 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /examples/components/barchart/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | A-Frame Barchart Component 4 | 5 | 22 | 23 | 24 |

A-Frame Barchart Component

25 | Basic 26 |

This is a basic example.

27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /examples/components/barchart3d/basic/barchartdata.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | A-Frame Barchart3d Component - Basic 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | demo with OPNFV data 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 58 | 59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /examples/components/barchart3d/basic/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | A-Frame Barchart3d Component - Basic 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | demo with OPNFV data 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 58 | 59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /examples/components/barchart3d/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | A-Frame Barchart3d Component 4 | 5 | 22 | 23 | 24 |

A-Frame Barchart3d Component

25 | Basic 26 |

This is a basic example.

27 | 28 | Only setting data. 29 |

A example with only data.

30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /examples/components/barchartstack/basic/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | A-Frame Barchartstack Component - Basic 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /examples/components/barchartstack/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | A Barchartstack component for A-Frame. - Basic 4 | 5 | 6 | 7 | 8 | 9 | 28 | 29 | 30 |

A-Frame Barchartstack Component

31 | Basic 32 |

This is a basic example.

33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /examples/components/bubblechart/basic/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | A-Frame Bubblechart Component - Basic 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /examples/components/bubblechart/basic/index2.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | A-Frame Bubblechart Component - Basic 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /examples/components/bubblechart/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | A-Frame Bubblechart Component 4 | 5 | 22 | 23 | 24 |

A-Frame Bubblechart Component

25 | Basic 26 |

This is a example with data extracted with crossfilter.

27 | Basic with data 28 |

Passing to the chart the data explicitly.

29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /examples/components/smoothcurvechart/basic/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | A-Frame Smoothcurvechart Component - Basic 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 22 | 23 | 24 |

A-Frame Smoothcurvechart Component

25 | Basic 26 |

This is a basic example.

27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /examples/demopiechartscratch.html: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Simple dashboard with a pie chart, from scratch 10 | 16 | 17 | 18 | 19 |
20 | Return to Index 21 | 22 | -------------------------------------------------------------------------------- /examples/img/dawnmountain-xneg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fran-aguilar/a-framedc/40df9c132cbb2888d08372a59564a39c1c356dc1/examples/img/dawnmountain-xneg.png -------------------------------------------------------------------------------- /examples/img/dawnmountain-xpos.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fran-aguilar/a-framedc/40df9c132cbb2888d08372a59564a39c1c356dc1/examples/img/dawnmountain-xpos.png -------------------------------------------------------------------------------- /examples/img/dawnmountain-yneg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fran-aguilar/a-framedc/40df9c132cbb2888d08372a59564a39c1c356dc1/examples/img/dawnmountain-yneg.png -------------------------------------------------------------------------------- /examples/img/dawnmountain-ypos.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fran-aguilar/a-framedc/40df9c132cbb2888d08372a59564a39c1c356dc1/examples/img/dawnmountain-ypos.png -------------------------------------------------------------------------------- /examples/img/dawnmountain-zneg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fran-aguilar/a-framedc/40df9c132cbb2888d08372a59564a39c1c356dc1/examples/img/dawnmountain-zneg.png -------------------------------------------------------------------------------- /examples/img/dawnmountain-zpos.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fran-aguilar/a-framedc/40df9c132cbb2888d08372a59564a39c1c356dc1/examples/img/dawnmountain-zpos.png -------------------------------------------------------------------------------- /examples/img/dirt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fran-aguilar/a-framedc/40df9c132cbb2888d08372a59564a39c1c356dc1/examples/img/dirt.png -------------------------------------------------------------------------------- /examples/img/fondo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fran-aguilar/a-framedc/40df9c132cbb2888d08372a59564a39c1c356dc1/examples/img/fondo.jpg -------------------------------------------------------------------------------- /examples/img/opnfv.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fran-aguilar/a-framedc/40df9c132cbb2888d08372a59564a39c1c356dc1/examples/img/opnfv.png -------------------------------------------------------------------------------- /examples/img/sky-xneg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fran-aguilar/a-framedc/40df9c132cbb2888d08372a59564a39c1c356dc1/examples/img/sky-xneg.png -------------------------------------------------------------------------------- /examples/img/sky-xpos.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fran-aguilar/a-framedc/40df9c132cbb2888d08372a59564a39c1c356dc1/examples/img/sky-xpos.png -------------------------------------------------------------------------------- /examples/img/sky-yneg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fran-aguilar/a-framedc/40df9c132cbb2888d08372a59564a39c1c356dc1/examples/img/sky-yneg.png -------------------------------------------------------------------------------- /examples/img/sky-ypos.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fran-aguilar/a-framedc/40df9c132cbb2888d08372a59564a39c1c356dc1/examples/img/sky-ypos.png -------------------------------------------------------------------------------- /examples/img/sky-zneg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fran-aguilar/a-framedc/40df9c132cbb2888d08372a59564a39c1c356dc1/examples/img/sky-zneg.png -------------------------------------------------------------------------------- /examples/img/sky-zpos.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fran-aguilar/a-framedc/40df9c132cbb2888d08372a59564a39c1c356dc1/examples/img/sky-zpos.png -------------------------------------------------------------------------------- /examples/img/skycubemap-xneg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fran-aguilar/a-framedc/40df9c132cbb2888d08372a59564a39c1c356dc1/examples/img/skycubemap-xneg.jpg -------------------------------------------------------------------------------- /examples/img/skycubemap-xpos.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fran-aguilar/a-framedc/40df9c132cbb2888d08372a59564a39c1c356dc1/examples/img/skycubemap-xpos.jpg -------------------------------------------------------------------------------- /examples/img/skycubemap-yneg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fran-aguilar/a-framedc/40df9c132cbb2888d08372a59564a39c1c356dc1/examples/img/skycubemap-yneg.jpg -------------------------------------------------------------------------------- /examples/img/skycubemap-ypos.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fran-aguilar/a-framedc/40df9c132cbb2888d08372a59564a39c1c356dc1/examples/img/skycubemap-ypos.jpg -------------------------------------------------------------------------------- /examples/img/skycubemap-zneg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fran-aguilar/a-framedc/40df9c132cbb2888d08372a59564a39c1c356dc1/examples/img/skycubemap-zneg.jpg -------------------------------------------------------------------------------- /examples/img/skycubemap-zpos.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fran-aguilar/a-framedc/40df9c132cbb2888d08372a59564a39c1c356dc1/examples/img/skycubemap-zpos.jpg -------------------------------------------------------------------------------- /examples/img/webvr-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fran-aguilar/a-framedc/40df9c132cbb2888d08372a59564a39c1c356dc1/examples/img/webvr-logo.png -------------------------------------------------------------------------------- /examples/index.html: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | a-framedc 5 | 43 | 44 | 45 |

a-framedc

46 | 68 | 69 |

Scenes

70 | 71 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 144 | 145 | 146 | 147 | 148 | -------------------------------------------------------------------------------- /examples/scenes/companiescommits/index.html: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Pie chart (companies) and bar chart (commits per month) with same data 10 | 16 | 17 | 18 | 19 |
20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /examples/scenes/companiescommits/js/democompaniescommits.js: -------------------------------------------------------------------------------- 1 | // Example (assuming there is "myscene" in HTML, to place the dashboard) 2 | // Assume "lib" is either THREEDC ot aframdc 3 | 4 | 5 | window.onload = function () { 6 | 7 | // initialization 8 | //getJSON call, draw meshes with data 9 | $.getJSON("../../data/scm-commits.json", function (data) { 10 | var json_data = data; 11 | init(json_data); 12 | }); 13 | var init = function (json_data) { 14 | 15 | 16 | 17 | 18 | 19 | 20 | var scenediv = document.getElementById("myscene"); 21 | // 1 22 | myDashboard = aframedc.dashboard(scenediv); 23 | // 2 24 | var mypiechart = aframedc.pieChart(); 25 | var mybarchart = aframedc.barChart(); 26 | // Common 27 | var parsed_data = []; 28 | json_data.values.forEach(function (value) { 29 | var record = {} 30 | json_data.names.forEach(function (name, index) { 31 | if (name == "date") { 32 | var date = new Date(value[index] * 1000); 33 | record[name] = date; 34 | record.month = new Date(date.getFullYear(), date.getMonth(), 1); 35 | record.hour = date.getUTCHours(); 36 | } else { 37 | record[name] = value[index]; 38 | } 39 | }); 40 | parsed_data.push(record); 41 | }); 42 | cf = crossfilter(parsed_data); 43 | 44 | //create a dimension by month 45 | var dimByMonth = cf.dimension(function (p) { return p.month; }); 46 | var groupByMonth = dimByMonth.group(); 47 | 48 | //create a dimension by org 49 | var dimByOrg = cf.dimension(function (p) { return p.org; }); 50 | var groupByOrg = dimByOrg.group().reduceCount(); 51 | 52 | mypiechart.dimension(dimByOrg).group(groupByOrg).radius(2.5) ; 53 | mybarchart.dimension(dimByMonth).group(groupByMonth).width(30).gridsOn(true) ; 54 | 55 | var coordPieChart = { x: -9, y: 0, z: 0 }; 56 | var coordBarChart = { x: 0, y: 0, z: 0 }; 57 | myDashboard.addChart(mypiechart, coordPieChart); 58 | myDashboard.addChart(mybarchart, coordBarChart); 59 | 60 | var camera = document.querySelector("[camera]"); 61 | camera.setAttribute("position", { x: 11.21 , y: 0, z: 16.57}); 62 | } 63 | } -------------------------------------------------------------------------------- /examples/scenes/companiesdatapanel/index.html: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Pie chart (companies) and bar chart (commits per month) with same data 10 | 16 | 17 | Pie chart (companies) and bar chart (commits per month) with same data 18 | 24 | 25 | 26 | 27 |
28 | 29 |
30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /examples/scenes/companiesdatapanel/js/democompaniescommitsPanel.js: -------------------------------------------------------------------------------- 1 | // Example (assuming there is "myscene" in HTML, to place the dashboard) 2 | // Assume "lib" is either THREEDC ot aframdc 3 | 4 | 5 | window.onload = function () { 6 | 7 | // initialization 8 | //getJSON call, draw meshes with data 9 | $.getJSON("../../data/scm-commits.json", function (data) { 10 | var json_data = data; 11 | init(json_data); 12 | }); 13 | var init = function (json_data) { 14 | 15 | 16 | 17 | 18 | 19 | 20 | var scenediv = document.getElementById("myscene"); 21 | // 1 22 | myDashboard = aframedc.dashboard(scenediv); 23 | // 2 24 | var mypiechart = aframedc.pieChart(); 25 | var mybarchart = aframedc.barChart(); 26 | var myPanel = aframedc.Panel(); 27 | // Common 28 | var parsed_data = []; 29 | json_data.values.forEach(function (value) { 30 | var record = {} 31 | json_data.names.forEach(function (name, index) { 32 | if (name == "date") { 33 | var date = new Date(value[index] * 1000); 34 | record[name] = date; 35 | record.month = new Date(date.getFullYear(), date.getMonth(), 1); 36 | record.hour = date.getUTCHours(); 37 | } else { 38 | record[name] = value[index]; 39 | } 40 | }); 41 | parsed_data.push(record); 42 | }); 43 | cf = crossfilter(parsed_data); 44 | 45 | //create a dimension by month 46 | var dimByMonth = cf.dimension(function (p) { return p.month; }); 47 | var groupByMonth = dimByMonth.group(); 48 | 49 | //create a dimension by org 50 | var dimByOrg = cf.dimension(function (p) { return p.org; }); 51 | var groupByOrg = dimByOrg.group().reduceCount(); 52 | 53 | mypiechart.dimension(dimByOrg).group(groupByOrg).radius(2.5).setTitle("commits per company"); 54 | mybarchart.dimension(dimByMonth).group(groupByMonth).width(30).setTitle("commits per month"); 55 | myPanel.width(40).height(15).setTitle("commits per company and month"); 56 | myPanel.addChart(mypiechart); 57 | myPanel.addChart(mybarchart); 58 | 59 | 60 | myDashboard.addPanel(myPanel); 61 | } 62 | } -------------------------------------------------------------------------------- /examples/scenes/opnfvstatistics/index.html: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | demo with OPNFV data 12 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 58 | 59 | 64 | 65 |
66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 103 | 104 | Return to Index 105 | clear indexes 106 | Toggle ground 107 | 108 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "a-framedc", 3 | "version": "1.0.8", 4 | "description": "Charts of data built on A-Frame", 5 | "homepage": "https://fran-aguilar.github.io/a-framedc/", 6 | "main": "dist/aframedc.js", 7 | "scripts": { 8 | "test": "echo \"Error: no test specified\" && exit 1", 9 | "build": "webpack --config webpack-dev.config.js && webpack --optimize-minimize --config webpack-dev.config.js && copyfiles -u 1 dist/*.js examples/js", 10 | "start": "webpack-dev-server --host 0.0.0.0 --config webpack-dev.config.js" 11 | }, 12 | "keywords": [ 13 | "3d", 14 | "aframe", 15 | "cardboard", 16 | "components", 17 | "three", 18 | "three.js", 19 | "vr", 20 | "webvr", 21 | "charts", 22 | "statistics", 23 | "visualization" 24 | ], 25 | "repository": "fran-aguilar/a-framedc", 26 | "author": "", 27 | "license": "ISC", 28 | "devDependencies": { 29 | "glob": "^7.0.6", 30 | "webpack": "^2.5.1", 31 | "webpack-dev-server": "^2.4.5" 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/components/.gitignore: -------------------------------------------------------------------------------- 1 | gh-pages 2 | node_modules/ 3 | examples/ 4 | npm-debug.log 5 | examples/build.js 6 | examples/node_modules/ 7 | -------------------------------------------------------------------------------- /src/components/aframe-grid/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2017 Jane John <jj@foo.com> 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /src/components/aframe-grid/README.md: -------------------------------------------------------------------------------- 1 | ## aframe-aframe-grid-component 2 | 3 | A Aframe Grid component for A-Frame. 4 | 5 | For [A-Frame](https://aframe.io). 6 | 7 | ### API 8 | 9 | | Property | Description | Default Value | 10 | | -------- | ----------- | ------------- | 11 | | | | | 12 | 13 | ### Installation 14 | 15 | #### Browser 16 | 17 | Install and use by directly including the [browser files](dist): 18 | 19 | ```html 20 | 21 | My A-Frame Scene 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | ``` 32 | 33 | 34 | 43 | 44 | #### npm 45 | 46 | Install via npm: 47 | 48 | ```bash 49 | npm install aframe-aframe-grid-component 50 | ``` 51 | 52 | Then require and use. 53 | 54 | ```js 55 | require('aframe'); 56 | require('aframe-aframe-grid-component'); 57 | ``` 58 | -------------------------------------------------------------------------------- /src/components/aframe-grid/dist/aframe-aframe-grid-component.js: -------------------------------------------------------------------------------- 1 | /******/ (function(modules) { // webpackBootstrap 2 | /******/ // The module cache 3 | /******/ var installedModules = {}; 4 | 5 | /******/ // The require function 6 | /******/ function __webpack_require__(moduleId) { 7 | 8 | /******/ // Check if module is in cache 9 | /******/ if(installedModules[moduleId]) 10 | /******/ return installedModules[moduleId].exports; 11 | 12 | /******/ // Create a new module (and put it into the cache) 13 | /******/ var module = installedModules[moduleId] = { 14 | /******/ exports: {}, 15 | /******/ id: moduleId, 16 | /******/ loaded: false 17 | /******/ }; 18 | 19 | /******/ // Execute the module function 20 | /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 21 | 22 | /******/ // Flag the module as loaded 23 | /******/ module.loaded = true; 24 | 25 | /******/ // Return the exports of the module 26 | /******/ return module.exports; 27 | /******/ } 28 | 29 | 30 | /******/ // expose the modules object (__webpack_modules__) 31 | /******/ __webpack_require__.m = modules; 32 | 33 | /******/ // expose the module cache 34 | /******/ __webpack_require__.c = installedModules; 35 | 36 | /******/ // __webpack_public_path__ 37 | /******/ __webpack_require__.p = ""; 38 | 39 | /******/ // Load entry module and return exports 40 | /******/ return __webpack_require__(0); 41 | /******/ }) 42 | /************************************************************************/ 43 | /******/ ([ 44 | /* 0 */ 45 | /***/ (function(module, exports) { 46 | 47 | /* global AFRAME */ 48 | 49 | if (typeof AFRAME === 'undefined') { 50 | throw new Error('Component attempted to register before AFRAME was available.'); 51 | } 52 | 53 | /** 54 | * Aframe Grid component for A-Frame. 55 | */ 56 | AFRAME.registerComponent('aframe-grid', { 57 | schema: {}, 58 | 59 | /** 60 | * Set if component needs multiple instancing. 61 | */ 62 | multiple: false, 63 | 64 | /** 65 | * Called once when component is attached. Generally for initial setup. 66 | */ 67 | init: function () { }, 68 | 69 | /** 70 | * Called when component is attached and when component data changes. 71 | * Generally modifies the entity based on the data. 72 | */ 73 | update: function (oldData) { }, 74 | 75 | /** 76 | * Called when a component is removed (e.g., via removeAttribute). 77 | * Generally undoes all modifications to the entity. 78 | */ 79 | remove: function () { }, 80 | 81 | /** 82 | * Called on each scene tick. 83 | */ 84 | // tick: function (t) { }, 85 | 86 | /** 87 | * Called when entity pauses. 88 | * Use to stop or remove any dynamic or background behavior such as events. 89 | */ 90 | pause: function () { }, 91 | 92 | /** 93 | * Called when entity resumes. 94 | * Use to continue or add any dynamic or background behavior such as events. 95 | */ 96 | play: function () { } 97 | }); 98 | 99 | 100 | /***/ }) 101 | /******/ ]); -------------------------------------------------------------------------------- /src/components/aframe-grid/dist/aframe-aframe-grid-component.min.js: -------------------------------------------------------------------------------- 1 | !function(e){function t(o){if(n[o])return n[o].exports;var r=n[o]={exports:{},id:o,loaded:!1};return e[o].call(r.exports,r,r.exports,t),r.loaded=!0,r.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t){if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");AFRAME.registerComponent("aframe-grid",{schema:{},multiple:!1,init:function(){},update:function(e){},remove:function(){},pause:function(){},play:function(){}})}]); -------------------------------------------------------------------------------- /src/components/aframe-grid/index.js: -------------------------------------------------------------------------------- 1 | /* global AFRAME */ 2 | 3 | if (typeof AFRAME === 'undefined') { 4 | throw new Error('Component attempted to register before AFRAME was available.'); 5 | } 6 | 7 | /** 8 | * Aframe Grid component for A-Frame. 9 | */ 10 | AFRAME.registerComponent('aframe-grid', { 11 | schema: { 12 | height: { default: 1 }, 13 | width: { default: 1 }, 14 | ysteps: { default: 4 }, 15 | xsteps: { default: 4 } 16 | }, 17 | 18 | /** 19 | * Set if component needs multiple instancing. 20 | */ 21 | multiple: false, 22 | 23 | /** 24 | * Called once when component is attached. Generally for initial setup. 25 | */ 26 | init: function () { }, 27 | 28 | /** 29 | * Called when component is attached and when component data changes. 30 | * Generally modifies the entity based on the data. 31 | */ 32 | update: function (oldData) { 33 | var data = this.data; 34 | var material = new THREE.LineBasicMaterial({ 35 | color: 0x000000, 36 | linewidth: 1 37 | }); 38 | 39 | var stepY = data.height / data.ysteps; 40 | 41 | var grids = new THREE.Object3D(); 42 | for (var i = 0; i < data.ysteps + 1; i++) { 43 | grids.add(putYGrid(i * stepY)); 44 | }; 45 | 46 | 47 | var stepX = data.width / data.xsteps; 48 | 49 | 50 | for (var i = 0; i < data.xsteps + 1; i++) { 51 | grids.add(putXGrid(i * stepX)); 52 | }; 53 | 54 | 55 | function putXGrid(step) { 56 | 57 | var verticalGeometry = new THREE.Geometry(); 58 | 59 | verticalGeometry.vertices.push( 60 | new THREE.Vector3(0, -0.2, 0), 61 | new THREE.Vector3(0, data.height, 0) 62 | ); 63 | var verticalLine = new THREE.Line(verticalGeometry, material); 64 | 65 | verticalLine.position.set(step, 0, 0); 66 | return verticalLine; 67 | 68 | }; 69 | 70 | function putYGrid(step) { 71 | 72 | var horizontalGeometry = new THREE.Geometry(); 73 | 74 | horizontalGeometry.vertices.push( 75 | new THREE.Vector3(-0.2, 0, 0), 76 | new THREE.Vector3(data.width, 0, 0) 77 | ); 78 | var horizontalLine = new THREE.Line(horizontalGeometry, material); 79 | 80 | horizontalLine.position.set(0, step, 0); 81 | return horizontalLine; 82 | 83 | }; 84 | this.el.setObject3D('group', grids); 85 | }, 86 | 87 | /** 88 | * Called when a component is removed (e.g., via removeAttribute). 89 | * Generally undoes all modifications to the entity. 90 | */ 91 | remove: function () { 92 | this.el.removeObject3D('group'); 93 | }, 94 | 95 | /** 96 | * Called on each scene tick. 97 | */ 98 | // tick: function (t) { }, 99 | 100 | /** 101 | * Called when entity pauses. 102 | * Use to stop or remove any dynamic or background behavior such as events. 103 | */ 104 | pause: function () { }, 105 | 106 | /** 107 | * Called when entity resumes. 108 | * Use to continue or add any dynamic or background behavior such as events. 109 | */ 110 | play: function () { } 111 | }); 112 | -------------------------------------------------------------------------------- /src/components/aframe-grid/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "aframe-aframe-grid-component", 3 | "version": "1.0.0", 4 | "description": "A Aframe Grid component for A-Frame.", 5 | "main": "index.js", 6 | "cdn": "dist/aframe-aframe-grid-component.min.js", 7 | "scripts": { 8 | "build": "browserify examples/main.js -o examples/build.js", 9 | "dev": "budo examples/main.js:build.js --dir examples --port 8000 --live --open", 10 | "dist": "webpack index.js dist/aframe-aframe-grid-component.js && webpack -p index.js dist/aframe-aframe-grid-component.min.js", 11 | "lint": "semistandard -v | snazzy", 12 | "prepublish": "npm run dist", 13 | "preghpages": "npm run build && shx rm -rf gh-pages && shx mkdir gh-pages && shx cp -r examples/* gh-pages", 14 | "ghpages": "npm run preghpages && ghpages -p gh-pages", 15 | "start": "npm run dev", 16 | "test": "karma start ./tests/karma.conf.js", 17 | "test:firefox": "karma start ./tests/karma.conf.js --browsers Firefox", 18 | "test:chrome": "karma start ./tests/karma.conf.js --browsers Chrome" 19 | }, 20 | "repository": { 21 | "type": "git", 22 | "url": "git+https://github.com/fran-aguilar/a-framedc.git" 23 | }, 24 | "keywords": [ 25 | "aframe", 26 | "aframe-component", 27 | "aframe-vr", 28 | "vr", 29 | "mozvr", 30 | "webvr", 31 | "aframe-grid" 32 | ], 33 | "author": "Jane John ", 34 | "license": "MIT", 35 | "bugs": { 36 | "url": "https://github.com/fran-aguilar/a-framedc/issues" 37 | }, 38 | "homepage": "https://github.com/fran-aguilar/a-framedc#readme", 39 | "devDependencies": { 40 | "aframe": "^0.4.0", 41 | "browserify": "^13.0.0", 42 | "budo": "^8.2.2", 43 | "chai": "^3.4.1", 44 | "chai-shallow-deep-equal": "^1.3.0", 45 | "ghpages": "^0.0.8", 46 | "karma": "^0.13.15", 47 | "karma-browserify": "^4.4.2", 48 | "karma-chai-shallow-deep-equal": "0.0.4", 49 | "karma-chrome-launcher": "2.0.0", 50 | "karma-env-preprocessor": "^0.1.1", 51 | "karma-firefox-launcher": "^0.1.7", 52 | "karma-mocha": "^0.2.1", 53 | "karma-mocha-reporter": "^1.1.3", 54 | "karma-sinon-chai": "^1.1.0", 55 | "mocha": "^2.3.4", 56 | "randomcolor": "^0.4.4", 57 | "semistandard": "^8.0.0", 58 | "shelljs": "^0.7.0", 59 | "sinon": "^1.17.5", 60 | "sinon-chai": "^2.8.0", 61 | "shx": "^0.1.1", 62 | "snazzy": "^4.0.0", 63 | "webpack": "^1.13.0" 64 | }, 65 | "semistandard": { 66 | "ignore": [ 67 | "examples/build.js", 68 | "dist/**" 69 | ] 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /src/components/aframe-grid/tests/__init.test.js: -------------------------------------------------------------------------------- 1 | /* global sinon, setup, teardown */ 2 | 3 | /** 4 | * __init.test.js is run before every test case. 5 | */ 6 | window.debug = true; 7 | var AScene = require('aframe').AScene 8 | 9 | navigator.getVRDisplays = function () { 10 | var resolvePromise = Promise.resolve(); 11 | var mockVRDisplay = { 12 | requestPresent: resolvePromise, 13 | exitPresent: resolvePromise, 14 | getPose: function () { return {orientation: null, position: null}; }, 15 | requestAnimationFrame: function () { return 1; } 16 | }; 17 | return Promise.resolve([mockVRDisplay]); 18 | }; 19 | 20 | setup(function () { 21 | this.sinon = sinon.sandbox.create(); 22 | // Stubs to not create a WebGL context since Travis CI runs headless. 23 | this.sinon.stub(AScene.prototype, 'render'); 24 | this.sinon.stub(AScene.prototype, 'resize'); 25 | this.sinon.stub(AScene.prototype, 'setupRenderer'); 26 | }); 27 | 28 | teardown(function () { 29 | // Clean up any attached elements. 30 | var attachedEls = ['canvas', 'a-assets', 'a-scene']; 31 | var els = document.querySelectorAll(attachedEls.join(',')); 32 | for (var i = 0; i < els.length; i++) { 33 | els[i].parentNode.removeChild(els[i]); 34 | } 35 | this.sinon.restore(); 36 | }); 37 | -------------------------------------------------------------------------------- /src/components/aframe-grid/tests/helpers.js: -------------------------------------------------------------------------------- 1 | /* global suite */ 2 | 3 | /** 4 | * Helper method to create a scene, create an entity, add entity to scene, 5 | * add scene to document. 6 | * 7 | * @returns {object} An `` element. 8 | */ 9 | module.exports.entityFactory = function (opts) { 10 | var scene = document.createElement('a-scene'); 11 | var assets = document.createElement('a-assets'); 12 | var entity = document.createElement('a-entity'); 13 | scene.appendChild(assets); 14 | scene.appendChild(entity); 15 | 16 | opts = opts || {}; 17 | 18 | if (opts.assets) { 19 | opts.assets.forEach(function (asset) { 20 | assets.appendChild(asset); 21 | }); 22 | } 23 | 24 | document.body.appendChild(scene); 25 | return entity; 26 | }; 27 | 28 | /** 29 | * Creates and attaches a mixin element (and an `` element if necessary). 30 | * 31 | * @param {string} id - ID of mixin. 32 | * @param {object} obj - Map of component names to attribute values. 33 | * @param {Element} scene - Indicate which scene to apply mixin to if necessary. 34 | * @returns {object} An attached `` element. 35 | */ 36 | module.exports.mixinFactory = function (id, obj, scene) { 37 | var mixinEl = document.createElement('a-mixin'); 38 | mixinEl.setAttribute('id', id); 39 | Object.keys(obj).forEach(function (componentName) { 40 | mixinEl.setAttribute(componentName, obj[componentName]); 41 | }); 42 | 43 | var assetsEl = scene ? scene.querySelector('a-assets') : document.querySelector('a-assets'); 44 | assetsEl.appendChild(mixinEl); 45 | 46 | return mixinEl; 47 | }; 48 | 49 | /** 50 | * Test that is only run locally and is skipped on CI. 51 | */ 52 | module.exports.getSkipCISuite = function () { 53 | if (window.__env__.TEST_ENV === 'ci') { 54 | return suite.skip; 55 | } else { 56 | return suite; 57 | } 58 | }; 59 | -------------------------------------------------------------------------------- /src/components/aframe-grid/tests/index.test.js: -------------------------------------------------------------------------------- 1 | /* global assert, setup, suite, test */ 2 | require('aframe'); 3 | require('../index.js'); 4 | var entityFactory = require('./helpers').entityFactory; 5 | 6 | suite('aframe-grid component', function () { 7 | var component; 8 | var el; 9 | 10 | setup(function (done) { 11 | el = entityFactory(); 12 | el.addEventListener('componentinitialized', function (evt) { 13 | if (evt.detail.name !== 'aframe-grid') { return; } 14 | component = el.components['aframe-grid']; 15 | done(); 16 | }); 17 | el.setAttribute('aframe-grid', {}); 18 | }); 19 | 20 | suite('foo property', function () { 21 | test('is good', function () { 22 | assert.equal(1, 1); 23 | }); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/components/aframe-grid/tests/karma.conf.js: -------------------------------------------------------------------------------- 1 | // Karma configuration. 2 | module.exports = function (config) { 3 | config.set({ 4 | basePath: '../', 5 | browserify: { 6 | debug: true, 7 | paths: ['./'] 8 | }, 9 | browsers: ['Firefox', 'Chrome'], 10 | client: { 11 | captureConsole: true, 12 | mocha: {ui: 'tdd'} 13 | }, 14 | envPreprocessor: ['TEST_ENV'], 15 | files: [ 16 | // Define test files. 17 | {pattern: 'tests/**/*.test.js'}, 18 | // Serve test assets. 19 | {pattern: 'tests/assets/**/*', included: false, served: true} 20 | ], 21 | frameworks: ['mocha', 'sinon-chai', 'chai-shallow-deep-equal', 'browserify'], 22 | preprocessors: {'tests/**/*.js': ['browserify', 'env']}, 23 | reporters: ['mocha'] 24 | }); 25 | }; 26 | -------------------------------------------------------------------------------- /src/components/aframe-gridxz/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2017 Jane John <jj@foo.com> 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /src/components/aframe-gridxz/README.md: -------------------------------------------------------------------------------- 1 | ## aframe-aframe-gridxz-component 2 | 3 | A Aframe Gridxz component for A-Frame. 4 | 5 | For [A-Frame](https://aframe.io). 6 | 7 | ### API 8 | 9 | | Property | Description | Default Value | 10 | | -------- | ----------- | ------------- | 11 | | | | | 12 | 13 | ### Installation 14 | 15 | #### Browser 16 | 17 | Install and use by directly including the [browser files](dist): 18 | 19 | ```html 20 | 21 | My A-Frame Scene 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | ``` 32 | 33 | 34 | 43 | 44 | #### npm 45 | 46 | Install via npm: 47 | 48 | ```bash 49 | npm install aframe-aframe-gridxz-component 50 | ``` 51 | 52 | Then require and use. 53 | 54 | ```js 55 | require('aframe'); 56 | require('aframe-aframe-gridxz-component'); 57 | ``` 58 | -------------------------------------------------------------------------------- /src/components/aframe-gridxz/index.js: -------------------------------------------------------------------------------- 1 | /* global AFRAME */ 2 | 3 | if (typeof AFRAME === 'undefined') { 4 | throw new Error('Component attempted to register before AFRAME was available.'); 5 | } 6 | 7 | /** 8 | * Aframe Gridxz component for A-Frame. 9 | */ 10 | AFRAME.registerComponent("aframe-gridxz", { 11 | schema: { 12 | width: { default: 1 }, 13 | depth: { default: 1 }, 14 | xsteps: { default: 4 }, 15 | zsteps: { default: 4 } 16 | }, 17 | 18 | update: function () { 19 | var data = this.data; 20 | var material = new THREE.LineBasicMaterial({ 21 | color: 0x000000, 22 | linewidth: 1 23 | }); 24 | 25 | var grids = new THREE.Object3D(); 26 | 27 | var stepX = data.width / data.xsteps; 28 | for (var i = 0; i < data.xsteps + 1; i++) { 29 | grids.add(putXGrid(i * stepX)); 30 | }; 31 | 32 | var stepZ = data.depth / data.zsteps; 33 | 34 | for (var i = 0; i < data.zsteps + 1; i++) { 35 | grids.add(putZGrid(i * stepZ)); 36 | }; 37 | 38 | 39 | 40 | 41 | 42 | 43 | function putZGrid(step) { 44 | 45 | var verticalGeometry = new THREE.Geometry(); 46 | 47 | verticalGeometry.vertices.push( 48 | new THREE.Vector3(0, 0, 0), 49 | new THREE.Vector3(data.width, 0, 0) 50 | ); 51 | var verticalLine = new THREE.Line(verticalGeometry, material); 52 | 53 | verticalLine.position.set(0, 0, -step); 54 | return verticalLine; 55 | 56 | }; 57 | 58 | function putXGrid(step) { 59 | 60 | var horizontalGeometry = new THREE.Geometry(); 61 | 62 | horizontalGeometry.vertices.push( 63 | new THREE.Vector3(0, 0, 0), 64 | new THREE.Vector3(0, 0, -data.depth) 65 | ); 66 | var horizontalLine = new THREE.Line(horizontalGeometry, material); 67 | 68 | horizontalLine.position.set(step, 0, 0); 69 | return horizontalLine; 70 | 71 | }; 72 | this.el.setObject3D('group', grids); 73 | }, 74 | 75 | remove: function () { 76 | this.el.removeObject3D('group'); 77 | } 78 | }); 79 | -------------------------------------------------------------------------------- /src/components/aframe-gridxz/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "aframe-gridxz", 3 | "version": "1.0.0", 4 | "description": "A Aframe Gridxz component for A-Frame.", 5 | "main": "index.js", 6 | "cdn": "dist/aframe-gridxz.min.js", 7 | "scripts": { 8 | "build": "browserify examples/main.js -o examples/build.js", 9 | "dev": "budo examples/main.js:build.js --dir examples --port 8000 --live --open", 10 | "dist": "webpack index.js dist/aframe-gridxz.js && webpack -p index.js dist/aframe-gridxz.min.js", 11 | "lint": "semistandard -v | snazzy", 12 | "prepublish": "npm run dist", 13 | "preghpages": "npm run build && shx rm -rf gh-pages && shx mkdir gh-pages && shx cp -r examples/* gh-pages", 14 | "ghpages": "npm run preghpages && ghpages -p gh-pages", 15 | "start": "npm run dev", 16 | "test": "karma start ./tests/karma.conf.js", 17 | "test:firefox": "karma start ./tests/karma.conf.js --browsers Firefox", 18 | "test:chrome": "karma start ./tests/karma.conf.js --browsers Chrome" 19 | }, 20 | "repository": { 21 | "type": "git", 22 | "url": "git+https://github.com/fran-aguilar/aframe-dc.git" 23 | }, 24 | "keywords": [ 25 | "aframe", 26 | "aframe-component", 27 | "aframe-vr", 28 | "vr", 29 | "mozvr", 30 | "webvr", 31 | "aframe-gridxz" 32 | ], 33 | "author": "Jane John ", 34 | "license": "MIT", 35 | "bugs": { 36 | "url": "https://github.com/fran-aguilar/aframe-dc/issues" 37 | }, 38 | "homepage": "https://github.com/fran-aguilar/aframe-dc#readme", 39 | "devDependencies": { 40 | "aframe": "^0.4.0", 41 | "browserify": "^13.0.0", 42 | "budo": "^8.2.2", 43 | "chai": "^3.4.1", 44 | "chai-shallow-deep-equal": "^1.3.0", 45 | "ghpages": "^0.0.8", 46 | "karma": "^0.13.15", 47 | "karma-browserify": "^4.4.2", 48 | "karma-chai-shallow-deep-equal": "0.0.4", 49 | "karma-chrome-launcher": "2.0.0", 50 | "karma-env-preprocessor": "^0.1.1", 51 | "karma-firefox-launcher": "^0.1.7", 52 | "karma-mocha": "^0.2.1", 53 | "karma-mocha-reporter": "^1.1.3", 54 | "karma-sinon-chai": "^1.1.0", 55 | "mocha": "^2.3.4", 56 | "randomcolor": "^0.4.4", 57 | "semistandard": "^8.0.0", 58 | "shelljs": "^0.7.0", 59 | "sinon": "^1.17.5", 60 | "sinon-chai": "^2.8.0", 61 | "shx": "^0.1.1", 62 | "snazzy": "^4.0.0", 63 | "webpack": "^1.13.0" 64 | }, 65 | "semistandard": { 66 | "ignore": [ 67 | "examples/build.js", 68 | "dist/**" 69 | ] 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /src/components/aframe-gridxz/tests/__init.test.js: -------------------------------------------------------------------------------- 1 | /* global sinon, setup, teardown */ 2 | 3 | /** 4 | * __init.test.js is run before every test case. 5 | */ 6 | window.debug = true; 7 | var AScene = require('aframe').AScene 8 | 9 | navigator.getVRDisplays = function () { 10 | var resolvePromise = Promise.resolve(); 11 | var mockVRDisplay = { 12 | requestPresent: resolvePromise, 13 | exitPresent: resolvePromise, 14 | getPose: function () { return {orientation: null, position: null}; }, 15 | requestAnimationFrame: function () { return 1; } 16 | }; 17 | return Promise.resolve([mockVRDisplay]); 18 | }; 19 | 20 | setup(function () { 21 | this.sinon = sinon.sandbox.create(); 22 | // Stubs to not create a WebGL context since Travis CI runs headless. 23 | this.sinon.stub(AScene.prototype, 'render'); 24 | this.sinon.stub(AScene.prototype, 'resize'); 25 | this.sinon.stub(AScene.prototype, 'setupRenderer'); 26 | }); 27 | 28 | teardown(function () { 29 | // Clean up any attached elements. 30 | var attachedEls = ['canvas', 'a-assets', 'a-scene']; 31 | var els = document.querySelectorAll(attachedEls.join(',')); 32 | for (var i = 0; i < els.length; i++) { 33 | els[i].parentNode.removeChild(els[i]); 34 | } 35 | this.sinon.restore(); 36 | }); 37 | -------------------------------------------------------------------------------- /src/components/aframe-gridxz/tests/helpers.js: -------------------------------------------------------------------------------- 1 | /* global suite */ 2 | 3 | /** 4 | * Helper method to create a scene, create an entity, add entity to scene, 5 | * add scene to document. 6 | * 7 | * @returns {object} An `` element. 8 | */ 9 | module.exports.entityFactory = function (opts) { 10 | var scene = document.createElement('a-scene'); 11 | var assets = document.createElement('a-assets'); 12 | var entity = document.createElement('a-entity'); 13 | scene.appendChild(assets); 14 | scene.appendChild(entity); 15 | 16 | opts = opts || {}; 17 | 18 | if (opts.assets) { 19 | opts.assets.forEach(function (asset) { 20 | assets.appendChild(asset); 21 | }); 22 | } 23 | 24 | document.body.appendChild(scene); 25 | return entity; 26 | }; 27 | 28 | /** 29 | * Creates and attaches a mixin element (and an `` element if necessary). 30 | * 31 | * @param {string} id - ID of mixin. 32 | * @param {object} obj - Map of component names to attribute values. 33 | * @param {Element} scene - Indicate which scene to apply mixin to if necessary. 34 | * @returns {object} An attached `` element. 35 | */ 36 | module.exports.mixinFactory = function (id, obj, scene) { 37 | var mixinEl = document.createElement('a-mixin'); 38 | mixinEl.setAttribute('id', id); 39 | Object.keys(obj).forEach(function (componentName) { 40 | mixinEl.setAttribute(componentName, obj[componentName]); 41 | }); 42 | 43 | var assetsEl = scene ? scene.querySelector('a-assets') : document.querySelector('a-assets'); 44 | assetsEl.appendChild(mixinEl); 45 | 46 | return mixinEl; 47 | }; 48 | 49 | /** 50 | * Test that is only run locally and is skipped on CI. 51 | */ 52 | module.exports.getSkipCISuite = function () { 53 | if (window.__env__.TEST_ENV === 'ci') { 54 | return suite.skip; 55 | } else { 56 | return suite; 57 | } 58 | }; 59 | -------------------------------------------------------------------------------- /src/components/aframe-gridxz/tests/index.test.js: -------------------------------------------------------------------------------- 1 | /* global assert, setup, suite, test */ 2 | require('aframe'); 3 | require('../index.js'); 4 | var entityFactory = require('./helpers').entityFactory; 5 | 6 | suite('aframe-gridxz component', function () { 7 | var component; 8 | var el; 9 | 10 | setup(function (done) { 11 | el = entityFactory(); 12 | el.addEventListener('componentinitialized', function (evt) { 13 | if (evt.detail.name !== 'aframe-gridxz') { return; } 14 | component = el.components['aframe-gridxz']; 15 | done(); 16 | }); 17 | el.setAttribute('aframe-gridxz', {}); 18 | }); 19 | 20 | suite('foo property', function () { 21 | test('is good', function () { 22 | assert.equal(1, 1); 23 | }); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/components/aframe-gridxz/tests/karma.conf.js: -------------------------------------------------------------------------------- 1 | // Karma configuration. 2 | module.exports = function (config) { 3 | config.set({ 4 | basePath: '../', 5 | browserify: { 6 | debug: true, 7 | paths: ['./'] 8 | }, 9 | browsers: ['Firefox', 'Chrome'], 10 | client: { 11 | captureConsole: true, 12 | mocha: {ui: 'tdd'} 13 | }, 14 | envPreprocessor: ['TEST_ENV'], 15 | files: [ 16 | // Define test files. 17 | {pattern: 'tests/**/*.test.js'}, 18 | // Serve test assets. 19 | {pattern: 'tests/assets/**/*', included: false, served: true} 20 | ], 21 | frameworks: ['mocha', 'sinon-chai', 'chai-shallow-deep-equal', 'browserify'], 22 | preprocessors: {'tests/**/*.js': ['browserify', 'env']}, 23 | reporters: ['mocha'] 24 | }); 25 | }; 26 | -------------------------------------------------------------------------------- /src/components/aframe-gridyz/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2017 Jane John <jj@foo.com> 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /src/components/aframe-gridyz/README.md: -------------------------------------------------------------------------------- 1 | ## aframe-aframe-gridyz-component 2 | 3 | A Aframe Gridyz component for A-Frame. 4 | 5 | For [A-Frame](https://aframe.io). 6 | 7 | ### API 8 | 9 | | Property | Description | Default Value | 10 | | -------- | ----------- | ------------- | 11 | | | | | 12 | 13 | ### Installation 14 | 15 | #### Browser 16 | 17 | Install and use by directly including the [browser files](dist): 18 | 19 | ```html 20 | 21 | My A-Frame Scene 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | ``` 32 | 33 | 34 | 43 | 44 | #### npm 45 | 46 | Install via npm: 47 | 48 | ```bash 49 | npm install aframe-aframe-gridyz-component 50 | ``` 51 | 52 | Then require and use. 53 | 54 | ```js 55 | require('aframe'); 56 | require('aframe-aframe-gridyz-component'); 57 | ``` 58 | -------------------------------------------------------------------------------- /src/components/aframe-gridyz/index.js: -------------------------------------------------------------------------------- 1 | /* global AFRAME */ 2 | 3 | if (typeof AFRAME === 'undefined') { 4 | throw new Error('Component attempted to register before AFRAME was available.'); 5 | } 6 | 7 | /** 8 | * Aframe Gridyz component for A-Frame. 9 | */ 10 | 11 | AFRAME.registerComponent("aframe-gridyz", { 12 | schema: { 13 | height: { default: 1 }, 14 | depth: { default: 1 }, 15 | zsteps: { default: 4 }, 16 | ysteps: { default: 4 } 17 | }, 18 | 19 | update: function () { 20 | var data = this.data; 21 | var material = new THREE.LineBasicMaterial({ 22 | color: 0x000000, 23 | linewidth: 1 24 | }); 25 | 26 | 27 | var grids = new THREE.Object3D(); 28 | 29 | var stepY = data.depth / data.zsteps; 30 | for (var i = 0; i < data.zsteps + 1; i++) { 31 | grids.add(putYGrid(i * stepY)); 32 | }; 33 | var stepZ = data.height / data.ysteps; 34 | 35 | for (var i = 0; i < data.ysteps + 1; i++) { 36 | grids.add(putZGrid(i * stepZ)); 37 | }; 38 | 39 | 40 | 41 | 42 | 43 | 44 | function putYGrid(step) { 45 | 46 | var verticalGeometry = new THREE.Geometry(); 47 | 48 | verticalGeometry.vertices.push( 49 | new THREE.Vector3(0, -0.2, 0), 50 | new THREE.Vector3(0, data.height, 0) 51 | ); 52 | var verticalLine = new THREE.Line(verticalGeometry, material); 53 | 54 | verticalLine.position.set(0, 0, -step); 55 | return verticalLine; 56 | 57 | }; 58 | 59 | function putZGrid(step) { 60 | 61 | var horizontalGeometry = new THREE.Geometry(); 62 | 63 | horizontalGeometry.vertices.push( 64 | new THREE.Vector3(0, 0, 0), 65 | new THREE.Vector3(0, 0, -data.depth) 66 | ); 67 | var horizontalLine = new THREE.Line(horizontalGeometry, material); 68 | 69 | horizontalLine.position.set(0, step, 0); 70 | return horizontalLine; 71 | 72 | }; 73 | this.el.setObject3D('group', grids); 74 | }, 75 | 76 | remove: function () { 77 | this.el.removeObject3D('group'); 78 | } 79 | }); 80 | -------------------------------------------------------------------------------- /src/components/aframe-gridyz/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "aframe-gridyz", 3 | "version": "1.0.0", 4 | "description": "A Aframe Gridyz component for A-Frame.", 5 | "main": "index.js", 6 | "cdn": "dist/aframe-gridyz.min.js", 7 | "scripts": { 8 | "build": "browserify examples/main.js -o examples/build.js", 9 | "dev": "budo examples/main.js:build.js --dir examples --port 8000 --live --open", 10 | "dist": "webpack index.js dist/aframe-gridyz.js && webpack -p index.js dist/aframe-gridyz.min.js", 11 | "lint": "semistandard -v | snazzy", 12 | "prepublish": "npm run dist", 13 | "preghpages": "npm run build && shx rm -rf gh-pages && shx mkdir gh-pages && shx cp -r examples/* gh-pages", 14 | "ghpages": "npm run preghpages && ghpages -p gh-pages", 15 | "start": "npm run dev", 16 | "test": "karma start ./tests/karma.conf.js", 17 | "test:firefox": "karma start ./tests/karma.conf.js --browsers Firefox", 18 | "test:chrome": "karma start ./tests/karma.conf.js --browsers Chrome" 19 | }, 20 | "repository": { 21 | "type": "git", 22 | "url": "git+https://github.com/fran-aguilar/a-framedc.git" 23 | }, 24 | "keywords": [ 25 | "aframe", 26 | "aframe-component", 27 | "aframe-vr", 28 | "vr", 29 | "mozvr", 30 | "webvr", 31 | "aframe-gridyz" 32 | ], 33 | "author": "Jane John ", 34 | "license": "MIT", 35 | "bugs": { 36 | "url": "https://github.com/fran-aguilar/a-framedc/issues" 37 | }, 38 | "homepage": "https://github.com/fran-aguilar/a-framedc#readme", 39 | "devDependencies": { 40 | "aframe": "^0.4.0", 41 | "browserify": "^13.0.0", 42 | "budo": "^8.2.2", 43 | "chai": "^3.4.1", 44 | "chai-shallow-deep-equal": "^1.3.0", 45 | "ghpages": "^0.0.8", 46 | "karma": "^0.13.15", 47 | "karma-browserify": "^4.4.2", 48 | "karma-chai-shallow-deep-equal": "0.0.4", 49 | "karma-chrome-launcher": "2.0.0", 50 | "karma-env-preprocessor": "^0.1.1", 51 | "karma-firefox-launcher": "^0.1.7", 52 | "karma-mocha": "^0.2.1", 53 | "karma-mocha-reporter": "^1.1.3", 54 | "karma-sinon-chai": "^1.1.0", 55 | "mocha": "^2.3.4", 56 | "randomcolor": "^0.4.4", 57 | "semistandard": "^8.0.0", 58 | "shelljs": "^0.7.0", 59 | "sinon": "^1.17.5", 60 | "sinon-chai": "^2.8.0", 61 | "shx": "^0.1.1", 62 | "snazzy": "^4.0.0", 63 | "webpack": "^1.13.0" 64 | }, 65 | "semistandard": { 66 | "ignore": [ 67 | "examples/build.js", 68 | "dist/**" 69 | ] 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /src/components/aframe-gridyz/tests/__init.test.js: -------------------------------------------------------------------------------- 1 | /* global sinon, setup, teardown */ 2 | 3 | /** 4 | * __init.test.js is run before every test case. 5 | */ 6 | window.debug = true; 7 | var AScene = require('aframe').AScene 8 | 9 | navigator.getVRDisplays = function () { 10 | var resolvePromise = Promise.resolve(); 11 | var mockVRDisplay = { 12 | requestPresent: resolvePromise, 13 | exitPresent: resolvePromise, 14 | getPose: function () { return {orientation: null, position: null}; }, 15 | requestAnimationFrame: function () { return 1; } 16 | }; 17 | return Promise.resolve([mockVRDisplay]); 18 | }; 19 | 20 | setup(function () { 21 | this.sinon = sinon.sandbox.create(); 22 | // Stubs to not create a WebGL context since Travis CI runs headless. 23 | this.sinon.stub(AScene.prototype, 'render'); 24 | this.sinon.stub(AScene.prototype, 'resize'); 25 | this.sinon.stub(AScene.prototype, 'setupRenderer'); 26 | }); 27 | 28 | teardown(function () { 29 | // Clean up any attached elements. 30 | var attachedEls = ['canvas', 'a-assets', 'a-scene']; 31 | var els = document.querySelectorAll(attachedEls.join(',')); 32 | for (var i = 0; i < els.length; i++) { 33 | els[i].parentNode.removeChild(els[i]); 34 | } 35 | this.sinon.restore(); 36 | }); 37 | -------------------------------------------------------------------------------- /src/components/aframe-gridyz/tests/helpers.js: -------------------------------------------------------------------------------- 1 | /* global suite */ 2 | 3 | /** 4 | * Helper method to create a scene, create an entity, add entity to scene, 5 | * add scene to document. 6 | * 7 | * @returns {object} An `` element. 8 | */ 9 | module.exports.entityFactory = function (opts) { 10 | var scene = document.createElement('a-scene'); 11 | var assets = document.createElement('a-assets'); 12 | var entity = document.createElement('a-entity'); 13 | scene.appendChild(assets); 14 | scene.appendChild(entity); 15 | 16 | opts = opts || {}; 17 | 18 | if (opts.assets) { 19 | opts.assets.forEach(function (asset) { 20 | assets.appendChild(asset); 21 | }); 22 | } 23 | 24 | document.body.appendChild(scene); 25 | return entity; 26 | }; 27 | 28 | /** 29 | * Creates and attaches a mixin element (and an `` element if necessary). 30 | * 31 | * @param {string} id - ID of mixin. 32 | * @param {object} obj - Map of component names to attribute values. 33 | * @param {Element} scene - Indicate which scene to apply mixin to if necessary. 34 | * @returns {object} An attached `` element. 35 | */ 36 | module.exports.mixinFactory = function (id, obj, scene) { 37 | var mixinEl = document.createElement('a-mixin'); 38 | mixinEl.setAttribute('id', id); 39 | Object.keys(obj).forEach(function (componentName) { 40 | mixinEl.setAttribute(componentName, obj[componentName]); 41 | }); 42 | 43 | var assetsEl = scene ? scene.querySelector('a-assets') : document.querySelector('a-assets'); 44 | assetsEl.appendChild(mixinEl); 45 | 46 | return mixinEl; 47 | }; 48 | 49 | /** 50 | * Test that is only run locally and is skipped on CI. 51 | */ 52 | module.exports.getSkipCISuite = function () { 53 | if (window.__env__.TEST_ENV === 'ci') { 54 | return suite.skip; 55 | } else { 56 | return suite; 57 | } 58 | }; 59 | -------------------------------------------------------------------------------- /src/components/aframe-gridyz/tests/index.test.js: -------------------------------------------------------------------------------- 1 | /* global assert, setup, suite, test */ 2 | require('aframe'); 3 | require('../index.js'); 4 | var entityFactory = require('./helpers').entityFactory; 5 | 6 | suite('aframe-gridyz component', function () { 7 | var component; 8 | var el; 9 | 10 | setup(function (done) { 11 | el = entityFactory(); 12 | el.addEventListener('componentinitialized', function (evt) { 13 | if (evt.detail.name !== 'aframe-gridyz') { return; } 14 | component = el.components['aframe-gridyz']; 15 | done(); 16 | }); 17 | el.setAttribute('aframe-gridyz', {}); 18 | }); 19 | 20 | suite('foo property', function () { 21 | test('is good', function () { 22 | assert.equal(1, 1); 23 | }); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/components/aframe-gridyz/tests/karma.conf.js: -------------------------------------------------------------------------------- 1 | // Karma configuration. 2 | module.exports = function (config) { 3 | config.set({ 4 | basePath: '../', 5 | browserify: { 6 | debug: true, 7 | paths: ['./'] 8 | }, 9 | browsers: ['Firefox', 'Chrome'], 10 | client: { 11 | captureConsole: true, 12 | mocha: {ui: 'tdd'} 13 | }, 14 | envPreprocessor: ['TEST_ENV'], 15 | files: [ 16 | // Define test files. 17 | {pattern: 'tests/**/*.test.js'}, 18 | // Serve test assets. 19 | {pattern: 'tests/assets/**/*', included: false, served: true} 20 | ], 21 | frameworks: ['mocha', 'sinon-chai', 'chai-shallow-deep-equal', 'browserify'], 22 | preprocessors: {'tests/**/*.js': ['browserify', 'env']}, 23 | reporters: ['mocha'] 24 | }); 25 | }; 26 | -------------------------------------------------------------------------------- /src/components/barchart/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2017 Jane John <jj@foo.com> 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /src/components/barchart/README.md: -------------------------------------------------------------------------------- 1 | ## aframe-barchart-component 2 | 3 | A Barchart component for A-Frame. 4 | 5 | For [A-Frame](https://aframe.io). 6 | 7 | ### API 8 | 9 | | Property | Description | Default Value | 10 | | -------- | ----------- | ------------- | 11 | | | | | 12 | 13 | ### Installation 14 | 15 | #### Browser 16 | 17 | Install and use by directly including the [browser files](dist): 18 | 19 | ```html 20 | 21 | My A-Frame Scene 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | ``` 32 | 33 | 34 | 43 | 44 | #### npm 45 | 46 | Install via npm: 47 | 48 | ```bash 49 | npm install aframe-barchart-component 50 | ``` 51 | 52 | Then require and use. 53 | 54 | ```js 55 | require('aframe'); 56 | require('aframe-barchart-component'); 57 | ``` 58 | -------------------------------------------------------------------------------- /src/components/barchart/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "barchart", 3 | "version": "1.0.0", 4 | "description": "A Barchart component for A-Frame.", 5 | "main": "index.js", 6 | "cdn": "dist/aframe-barchart-component.min.js", 7 | "scripts": { 8 | "build": "browserify examples/main.js -o examples/build.js", 9 | "dev": "budo examples/main.js:build.js --dir examples --port 8000 --live --open", 10 | "dist": "webpack index.js dist/aframe-barchart-component.js && webpack -p index.js dist/aframe-barchart-component.min.js", 11 | "lint": "semistandard -v | snazzy", 12 | "prepublish": "npm run dist", 13 | "preghpages": "npm run build && shx rm -rf gh-pages && shx mkdir gh-pages && shx cp -r examples/* gh-pages", 14 | "ghpages": "npm run preghpages && ghpages -p gh-pages", 15 | "start": "npm run dev", 16 | "test": "karma start ./tests/karma.conf.js", 17 | "test:firefox": "karma start ./tests/karma.conf.js --browsers Firefox", 18 | "test:chrome": "karma start ./tests/karma.conf.js --browsers Chrome" 19 | }, 20 | "repository": { 21 | "type": "git", 22 | "url": "git+https://github.com/fran-aguilar/a-framedc.git" 23 | }, 24 | "keywords": [ 25 | "aframe", 26 | "aframe-component", 27 | "aframe-vr", 28 | "vr", 29 | "mozvr", 30 | "webvr", 31 | "barchart" 32 | ], 33 | "author": "Jane John ", 34 | "license": "MIT", 35 | "bugs": { 36 | "url": "https://github.com/fran-aguilar/a-framedc/issues" 37 | }, 38 | "homepage": "https://github.com/fran-aguilar/a-framedc#readme", 39 | "devDependencies": { 40 | "aframe": "^0.4.0", 41 | "browserify": "^13.0.0", 42 | "budo": "^8.2.2", 43 | "chai": "^3.4.1", 44 | "chai-shallow-deep-equal": "^1.3.0", 45 | "ghpages": "^0.0.8", 46 | "karma": "^0.13.15", 47 | "karma-browserify": "^4.4.2", 48 | "karma-chai-shallow-deep-equal": "0.0.4", 49 | "karma-chrome-launcher": "2.0.0", 50 | "karma-env-preprocessor": "^0.1.1", 51 | "karma-firefox-launcher": "^0.1.7", 52 | "karma-mocha": "^0.2.1", 53 | "karma-mocha-reporter": "^1.1.3", 54 | "karma-sinon-chai": "^1.1.0", 55 | "mocha": "^2.3.4", 56 | "randomcolor": "^0.4.4", 57 | "semistandard": "^8.0.0", 58 | "shelljs": "^0.7.0", 59 | "sinon": "^1.17.5", 60 | "sinon-chai": "^2.8.0", 61 | "shx": "^0.1.1", 62 | "snazzy": "^4.0.0", 63 | "webpack": "^1.13.0" 64 | }, 65 | "semistandard": { 66 | "ignore": [ 67 | "examples/build.js", 68 | "dist/**" 69 | ] 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /src/components/barchart/tests/__init.test.js: -------------------------------------------------------------------------------- 1 | /* global sinon, setup, teardown */ 2 | 3 | /** 4 | * __init.test.js is run before every test case. 5 | */ 6 | window.debug = true; 7 | var AScene = require('aframe').AScene 8 | 9 | navigator.getVRDisplays = function () { 10 | var resolvePromise = Promise.resolve(); 11 | var mockVRDisplay = { 12 | requestPresent: resolvePromise, 13 | exitPresent: resolvePromise, 14 | getPose: function () { return {orientation: null, position: null}; }, 15 | requestAnimationFrame: function () { return 1; } 16 | }; 17 | return Promise.resolve([mockVRDisplay]); 18 | }; 19 | 20 | setup(function () { 21 | this.sinon = sinon.sandbox.create(); 22 | // Stubs to not create a WebGL context since Travis CI runs headless. 23 | this.sinon.stub(AScene.prototype, 'render'); 24 | this.sinon.stub(AScene.prototype, 'resize'); 25 | this.sinon.stub(AScene.prototype, 'setupRenderer'); 26 | }); 27 | 28 | teardown(function () { 29 | // Clean up any attached elements. 30 | var attachedEls = ['canvas', 'a-assets', 'a-scene']; 31 | var els = document.querySelectorAll(attachedEls.join(',')); 32 | for (var i = 0; i < els.length; i++) { 33 | els[i].parentNode.removeChild(els[i]); 34 | } 35 | this.sinon.restore(); 36 | }); 37 | -------------------------------------------------------------------------------- /src/components/barchart/tests/helpers.js: -------------------------------------------------------------------------------- 1 | /* global suite */ 2 | 3 | /** 4 | * Helper method to create a scene, create an entity, add entity to scene, 5 | * add scene to document. 6 | * 7 | * @returns {object} An `` element. 8 | */ 9 | module.exports.entityFactory = function (opts) { 10 | var scene = document.createElement('a-scene'); 11 | var assets = document.createElement('a-assets'); 12 | var entity = document.createElement('a-entity'); 13 | scene.appendChild(assets); 14 | scene.appendChild(entity); 15 | 16 | opts = opts || {}; 17 | 18 | if (opts.assets) { 19 | opts.assets.forEach(function (asset) { 20 | assets.appendChild(asset); 21 | }); 22 | } 23 | 24 | document.body.appendChild(scene); 25 | return entity; 26 | }; 27 | 28 | /** 29 | * Creates and attaches a mixin element (and an `` element if necessary). 30 | * 31 | * @param {string} id - ID of mixin. 32 | * @param {object} obj - Map of component names to attribute values. 33 | * @param {Element} scene - Indicate which scene to apply mixin to if necessary. 34 | * @returns {object} An attached `` element. 35 | */ 36 | module.exports.mixinFactory = function (id, obj, scene) { 37 | var mixinEl = document.createElement('a-mixin'); 38 | mixinEl.setAttribute('id', id); 39 | Object.keys(obj).forEach(function (componentName) { 40 | mixinEl.setAttribute(componentName, obj[componentName]); 41 | }); 42 | 43 | var assetsEl = scene ? scene.querySelector('a-assets') : document.querySelector('a-assets'); 44 | assetsEl.appendChild(mixinEl); 45 | 46 | return mixinEl; 47 | }; 48 | 49 | /** 50 | * Test that is only run locally and is skipped on CI. 51 | */ 52 | module.exports.getSkipCISuite = function () { 53 | if (window.__env__.TEST_ENV === 'ci') { 54 | return suite.skip; 55 | } else { 56 | return suite; 57 | } 58 | }; 59 | -------------------------------------------------------------------------------- /src/components/barchart/tests/index.test.js: -------------------------------------------------------------------------------- 1 | /* global assert, setup, suite, test */ 2 | require('aframe'); 3 | require('../index.js'); 4 | var entityFactory = require('./helpers').entityFactory; 5 | 6 | suite('barchart component', function () { 7 | var component; 8 | var el; 9 | 10 | setup(function (done) { 11 | el = entityFactory(); 12 | el.addEventListener('componentinitialized', function (evt) { 13 | if (evt.detail.name !== 'barchart') { return; } 14 | component = el.components['barchart']; 15 | done(); 16 | }); 17 | el.setAttribute('barchart', {}); 18 | }); 19 | 20 | suite('foo property', function () { 21 | test('is good', function () { 22 | assert.equal(1, 1); 23 | }); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/components/barchart/tests/karma.conf.js: -------------------------------------------------------------------------------- 1 | // Karma configuration. 2 | module.exports = function (config) { 3 | config.set({ 4 | basePath: '../', 5 | browserify: { 6 | debug: true, 7 | paths: ['./'] 8 | }, 9 | browsers: ['Firefox', 'Chrome'], 10 | client: { 11 | captureConsole: true, 12 | mocha: {ui: 'tdd'} 13 | }, 14 | envPreprocessor: ['TEST_ENV'], 15 | files: [ 16 | // Define test files. 17 | {pattern: 'tests/**/*.test.js'}, 18 | // Serve test assets. 19 | {pattern: 'tests/assets/**/*', included: false, served: true} 20 | ], 21 | frameworks: ['mocha', 'sinon-chai', 'chai-shallow-deep-equal', 'browserify'], 22 | preprocessors: {'tests/**/*.js': ['browserify', 'env']}, 23 | reporters: ['mocha'] 24 | }); 25 | }; 26 | -------------------------------------------------------------------------------- /src/components/barchart3d/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2017 Jane John <jj@foo.com> 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /src/components/barchart3d/README.md: -------------------------------------------------------------------------------- 1 | ## aframe-barchart3d-component 2 | 3 | A Barchart3d component for A-Frame. 4 | 5 | For [A-Frame](https://aframe.io). 6 | 7 | ### API 8 | 9 | | Property | Description | Default Value | 10 | | -------- | ----------- | ------------- | 11 | | | | | 12 | 13 | ### Installation 14 | 15 | #### Browser 16 | 17 | Install and use by directly including the [browser files](dist): 18 | 19 | ```html 20 | 21 | My A-Frame Scene 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | ``` 32 | 33 | 34 | 43 | 44 | #### npm 45 | 46 | Install via npm: 47 | 48 | ```bash 49 | npm install aframe-barchart3d-component 50 | ``` 51 | 52 | Then require and use. 53 | 54 | ```js 55 | require('aframe'); 56 | require('aframe-barchart3d-component'); 57 | ``` 58 | -------------------------------------------------------------------------------- /src/components/barchart3d/index.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fran-aguilar/a-framedc/40df9c132cbb2888d08372a59564a39c1c356dc1/src/components/barchart3d/index.js -------------------------------------------------------------------------------- /src/components/barchart3d/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "barchart3d", 3 | "version": "1.0.0", 4 | "description": "A Barchart3d component for A-Frame.", 5 | "main": "index.js", 6 | "cdn": "dist/barchart3d-component.min.js", 7 | "scripts": { 8 | "build": "browserify examples/main.js -o examples/build.js", 9 | "dev": "budo examples/main.js:build.js --dir examples --port 8000 --live --open", 10 | "dist": "webpack index.js dist/barchart3d-component.js && webpack -p index.js dist/barchart3d-component.min.js", 11 | "lint": "semistandard -v | snazzy", 12 | "prepublish": "npm run dist", 13 | "preghpages": "npm run build && shx rm -rf gh-pages && shx mkdir gh-pages && shx cp -r examples/* gh-pages", 14 | "ghpages": "npm run preghpages && ghpages -p gh-pages", 15 | "start": "npm run dev", 16 | "test": "karma start ./tests/karma.conf.js", 17 | "test:firefox": "karma start ./tests/karma.conf.js --browsers Firefox", 18 | "test:chrome": "karma start ./tests/karma.conf.js --browsers Chrome" 19 | }, 20 | "repository": { 21 | "type": "git", 22 | "url": "git+https://github.com/fran-aguilar/a-framedc.git" 23 | }, 24 | "keywords": [ 25 | "aframe", 26 | "aframe-component", 27 | "aframe-vr", 28 | "vr", 29 | "mozvr", 30 | "webvr", 31 | "barchart3d" 32 | ], 33 | "author": "Jane John ", 34 | "license": "MIT", 35 | "bugs": { 36 | "url": "https://github.com/fran-aguilar/a-framedc/issues" 37 | }, 38 | "homepage": "https://github.com/fran-aguilar/a-framedc#readme", 39 | "devDependencies": { 40 | "aframe": "^0.4.0", 41 | "browserify": "^13.0.0", 42 | "budo": "^8.2.2", 43 | "chai": "^3.4.1", 44 | "chai-shallow-deep-equal": "^1.3.0", 45 | "ghpages": "^0.0.8", 46 | "karma": "^0.13.15", 47 | "karma-browserify": "^4.4.2", 48 | "karma-chai-shallow-deep-equal": "0.0.4", 49 | "karma-chrome-launcher": "2.0.0", 50 | "karma-env-preprocessor": "^0.1.1", 51 | "karma-firefox-launcher": "^0.1.7", 52 | "karma-mocha": "^0.2.1", 53 | "karma-mocha-reporter": "^1.1.3", 54 | "karma-sinon-chai": "^1.1.0", 55 | "mocha": "^2.3.4", 56 | "randomcolor": "^0.4.4", 57 | "semistandard": "^8.0.0", 58 | "shelljs": "^0.7.0", 59 | "sinon": "^1.17.5", 60 | "sinon-chai": "^2.8.0", 61 | "shx": "^0.1.1", 62 | "snazzy": "^4.0.0", 63 | "webpack": "^1.13.0" 64 | }, 65 | "semistandard": { 66 | "ignore": [ 67 | "examples/build.js", 68 | "dist/**" 69 | ] 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /src/components/barchart3d/tests/__init.test.js: -------------------------------------------------------------------------------- 1 | /* global sinon, setup, teardown */ 2 | 3 | /** 4 | * __init.test.js is run before every test case. 5 | */ 6 | window.debug = true; 7 | var AScene = require('aframe').AScene 8 | 9 | navigator.getVRDisplays = function () { 10 | var resolvePromise = Promise.resolve(); 11 | var mockVRDisplay = { 12 | requestPresent: resolvePromise, 13 | exitPresent: resolvePromise, 14 | getPose: function () { return {orientation: null, position: null}; }, 15 | requestAnimationFrame: function () { return 1; } 16 | }; 17 | return Promise.resolve([mockVRDisplay]); 18 | }; 19 | 20 | setup(function () { 21 | this.sinon = sinon.sandbox.create(); 22 | // Stubs to not create a WebGL context since Travis CI runs headless. 23 | this.sinon.stub(AScene.prototype, 'render'); 24 | this.sinon.stub(AScene.prototype, 'resize'); 25 | this.sinon.stub(AScene.prototype, 'setupRenderer'); 26 | }); 27 | 28 | teardown(function () { 29 | // Clean up any attached elements. 30 | var attachedEls = ['canvas', 'a-assets', 'a-scene']; 31 | var els = document.querySelectorAll(attachedEls.join(',')); 32 | for (var i = 0; i < els.length; i++) { 33 | els[i].parentNode.removeChild(els[i]); 34 | } 35 | this.sinon.restore(); 36 | }); 37 | -------------------------------------------------------------------------------- /src/components/barchart3d/tests/helpers.js: -------------------------------------------------------------------------------- 1 | /* global suite */ 2 | 3 | /** 4 | * Helper method to create a scene, create an entity, add entity to scene, 5 | * add scene to document. 6 | * 7 | * @returns {object} An `` element. 8 | */ 9 | module.exports.entityFactory = function (opts) { 10 | var scene = document.createElement('a-scene'); 11 | var assets = document.createElement('a-assets'); 12 | var entity = document.createElement('a-entity'); 13 | scene.appendChild(assets); 14 | scene.appendChild(entity); 15 | 16 | opts = opts || {}; 17 | 18 | if (opts.assets) { 19 | opts.assets.forEach(function (asset) { 20 | assets.appendChild(asset); 21 | }); 22 | } 23 | 24 | document.body.appendChild(scene); 25 | return entity; 26 | }; 27 | 28 | /** 29 | * Creates and attaches a mixin element (and an `` element if necessary). 30 | * 31 | * @param {string} id - ID of mixin. 32 | * @param {object} obj - Map of component names to attribute values. 33 | * @param {Element} scene - Indicate which scene to apply mixin to if necessary. 34 | * @returns {object} An attached `` element. 35 | */ 36 | module.exports.mixinFactory = function (id, obj, scene) { 37 | var mixinEl = document.createElement('a-mixin'); 38 | mixinEl.setAttribute('id', id); 39 | Object.keys(obj).forEach(function (componentName) { 40 | mixinEl.setAttribute(componentName, obj[componentName]); 41 | }); 42 | 43 | var assetsEl = scene ? scene.querySelector('a-assets') : document.querySelector('a-assets'); 44 | assetsEl.appendChild(mixinEl); 45 | 46 | return mixinEl; 47 | }; 48 | 49 | /** 50 | * Test that is only run locally and is skipped on CI. 51 | */ 52 | module.exports.getSkipCISuite = function () { 53 | if (window.__env__.TEST_ENV === 'ci') { 54 | return suite.skip; 55 | } else { 56 | return suite; 57 | } 58 | }; 59 | -------------------------------------------------------------------------------- /src/components/barchart3d/tests/index.test.js: -------------------------------------------------------------------------------- 1 | /* global assert, setup, suite, test */ 2 | require('aframe'); 3 | require('../index.js'); 4 | var entityFactory = require('./helpers').entityFactory; 5 | 6 | suite('barchart3d component', function () { 7 | var component; 8 | var el; 9 | 10 | setup(function (done) { 11 | el = entityFactory(); 12 | el.addEventListener('componentinitialized', function (evt) { 13 | if (evt.detail.name !== 'barchart3d') { return; } 14 | component = el.components['barchart3d']; 15 | done(); 16 | }); 17 | el.setAttribute('barchart3d', {}); 18 | }); 19 | 20 | suite('foo property', function () { 21 | test('is good', function () { 22 | assert.equal(1, 1); 23 | }); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/components/barchart3d/tests/karma.conf.js: -------------------------------------------------------------------------------- 1 | // Karma configuration. 2 | module.exports = function (config) { 3 | config.set({ 4 | basePath: '../', 5 | browserify: { 6 | debug: true, 7 | paths: ['./'] 8 | }, 9 | browsers: ['Firefox', 'Chrome'], 10 | client: { 11 | captureConsole: true, 12 | mocha: {ui: 'tdd'} 13 | }, 14 | envPreprocessor: ['TEST_ENV'], 15 | files: [ 16 | // Define test files. 17 | {pattern: 'tests/**/*.test.js'}, 18 | // Serve test assets. 19 | {pattern: 'tests/assets/**/*', included: false, served: true} 20 | ], 21 | frameworks: ['mocha', 'sinon-chai', 'chai-shallow-deep-equal', 'browserify'], 22 | preprocessors: {'tests/**/*.js': ['browserify', 'env']}, 23 | reporters: ['mocha'] 24 | }); 25 | }; 26 | -------------------------------------------------------------------------------- /src/components/barchartstack/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2017 Jane John <jj@foo.com> 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /src/components/barchartstack/README.md: -------------------------------------------------------------------------------- 1 | ## aframe-barchartstack-component 2 | 3 | A Barchartstack component for A-Frame. 4 | 5 | For [A-Frame](https://aframe.io). 6 | 7 | ### API 8 | 9 | | Property | Description | Default Value | 10 | | -------- | ----------- | ------------- | 11 | | | | | 12 | 13 | ### Installation 14 | 15 | #### Browser 16 | 17 | Install and use by directly including the [browser files](dist): 18 | 19 | ```html 20 | 21 | My A-Frame Scene 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | ``` 32 | 33 | 34 | 43 | 44 | #### npm 45 | 46 | Install via npm: 47 | 48 | ```bash 49 | npm install aframe-barchartstack-component 50 | ``` 51 | 52 | Then require and use. 53 | 54 | ```js 55 | require('aframe'); 56 | require('aframe-barchartstack-component'); 57 | ``` 58 | -------------------------------------------------------------------------------- /src/components/barchartstack/index.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fran-aguilar/a-framedc/40df9c132cbb2888d08372a59564a39c1c356dc1/src/components/barchartstack/index.js -------------------------------------------------------------------------------- /src/components/barchartstack/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "barchartstack", 3 | "version": "1.0.0", 4 | "description": "A Barchartstack component for A-Frame.", 5 | "main": "index.js", 6 | "cdn": "dist/barchartstack-component.min.js", 7 | "scripts": { 8 | "build": "browserify examples/main.js -o examples/build.js", 9 | "dev": "budo examples/main.js:build.js --dir examples --port 8000 --live --open", 10 | "dist": "webpack index.js dist/barchartstack-component.js && webpack -p index.js dist/barchartstack-component.min.js", 11 | "lint": "semistandard -v | snazzy", 12 | "prepublish": "npm run dist", 13 | "preghpages": "npm run build && shx rm -rf gh-pages && shx mkdir gh-pages && shx cp -r examples/* gh-pages", 14 | "ghpages": "npm run preghpages && ghpages -p gh-pages", 15 | "start": "npm run dev", 16 | "test": "karma start ./tests/karma.conf.js", 17 | "test:firefox": "karma start ./tests/karma.conf.js --browsers Firefox", 18 | "test:chrome": "karma start ./tests/karma.conf.js --browsers Chrome" 19 | }, 20 | "repository": { 21 | "type": "git", 22 | "url": "git+https://github.com/fran-aguilar/a-framedc.git" 23 | }, 24 | "keywords": [ 25 | "aframe", 26 | "aframe-component", 27 | "aframe-vr", 28 | "vr", 29 | "mozvr", 30 | "webvr", 31 | "barchartstack" 32 | ], 33 | "author": "Jane John ", 34 | "license": "MIT", 35 | "bugs": { 36 | "url": "https://github.com/fran-aguilar/a-framedc/issues" 37 | }, 38 | "homepage": "https://github.com/fran-aguilar/a-framedc#readme", 39 | "devDependencies": { 40 | "aframe": "^0.4.0", 41 | "browserify": "^13.0.0", 42 | "budo": "^8.2.2", 43 | "chai": "^3.4.1", 44 | "chai-shallow-deep-equal": "^1.3.0", 45 | "ghpages": "^0.0.8", 46 | "karma": "^0.13.15", 47 | "karma-browserify": "^4.4.2", 48 | "karma-chai-shallow-deep-equal": "0.0.4", 49 | "karma-chrome-launcher": "2.0.0", 50 | "karma-env-preprocessor": "^0.1.1", 51 | "karma-firefox-launcher": "^0.1.7", 52 | "karma-mocha": "^0.2.1", 53 | "karma-mocha-reporter": "^1.1.3", 54 | "karma-sinon-chai": "^1.1.0", 55 | "mocha": "^2.3.4", 56 | "randomcolor": "^0.4.4", 57 | "semistandard": "^8.0.0", 58 | "shelljs": "^0.7.0", 59 | "sinon": "^1.17.5", 60 | "sinon-chai": "^2.8.0", 61 | "shx": "^0.1.1", 62 | "snazzy": "^4.0.0", 63 | "webpack": "^1.13.0" 64 | }, 65 | "semistandard": { 66 | "ignore": [ 67 | "examples/build.js", 68 | "dist/**" 69 | ] 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /src/components/barchartstack/tests/__init.test.js: -------------------------------------------------------------------------------- 1 | /* global sinon, setup, teardown */ 2 | 3 | /** 4 | * __init.test.js is run before every test case. 5 | */ 6 | window.debug = true; 7 | var AScene = require('aframe').AScene 8 | 9 | navigator.getVRDisplays = function () { 10 | var resolvePromise = Promise.resolve(); 11 | var mockVRDisplay = { 12 | requestPresent: resolvePromise, 13 | exitPresent: resolvePromise, 14 | getPose: function () { return {orientation: null, position: null}; }, 15 | requestAnimationFrame: function () { return 1; } 16 | }; 17 | return Promise.resolve([mockVRDisplay]); 18 | }; 19 | 20 | setup(function () { 21 | this.sinon = sinon.sandbox.create(); 22 | // Stubs to not create a WebGL context since Travis CI runs headless. 23 | this.sinon.stub(AScene.prototype, 'render'); 24 | this.sinon.stub(AScene.prototype, 'resize'); 25 | this.sinon.stub(AScene.prototype, 'setupRenderer'); 26 | }); 27 | 28 | teardown(function () { 29 | // Clean up any attached elements. 30 | var attachedEls = ['canvas', 'a-assets', 'a-scene']; 31 | var els = document.querySelectorAll(attachedEls.join(',')); 32 | for (var i = 0; i < els.length; i++) { 33 | els[i].parentNode.removeChild(els[i]); 34 | } 35 | this.sinon.restore(); 36 | }); 37 | -------------------------------------------------------------------------------- /src/components/barchartstack/tests/helpers.js: -------------------------------------------------------------------------------- 1 | /* global suite */ 2 | 3 | /** 4 | * Helper method to create a scene, create an entity, add entity to scene, 5 | * add scene to document. 6 | * 7 | * @returns {object} An `` element. 8 | */ 9 | module.exports.entityFactory = function (opts) { 10 | var scene = document.createElement('a-scene'); 11 | var assets = document.createElement('a-assets'); 12 | var entity = document.createElement('a-entity'); 13 | scene.appendChild(assets); 14 | scene.appendChild(entity); 15 | 16 | opts = opts || {}; 17 | 18 | if (opts.assets) { 19 | opts.assets.forEach(function (asset) { 20 | assets.appendChild(asset); 21 | }); 22 | } 23 | 24 | document.body.appendChild(scene); 25 | return entity; 26 | }; 27 | 28 | /** 29 | * Creates and attaches a mixin element (and an `` element if necessary). 30 | * 31 | * @param {string} id - ID of mixin. 32 | * @param {object} obj - Map of component names to attribute values. 33 | * @param {Element} scene - Indicate which scene to apply mixin to if necessary. 34 | * @returns {object} An attached `` element. 35 | */ 36 | module.exports.mixinFactory = function (id, obj, scene) { 37 | var mixinEl = document.createElement('a-mixin'); 38 | mixinEl.setAttribute('id', id); 39 | Object.keys(obj).forEach(function (componentName) { 40 | mixinEl.setAttribute(componentName, obj[componentName]); 41 | }); 42 | 43 | var assetsEl = scene ? scene.querySelector('a-assets') : document.querySelector('a-assets'); 44 | assetsEl.appendChild(mixinEl); 45 | 46 | return mixinEl; 47 | }; 48 | 49 | /** 50 | * Test that is only run locally and is skipped on CI. 51 | */ 52 | module.exports.getSkipCISuite = function () { 53 | if (window.__env__.TEST_ENV === 'ci') { 54 | return suite.skip; 55 | } else { 56 | return suite; 57 | } 58 | }; 59 | -------------------------------------------------------------------------------- /src/components/barchartstack/tests/index.test.js: -------------------------------------------------------------------------------- 1 | /* global assert, setup, suite, test */ 2 | require('aframe'); 3 | require('../index.js'); 4 | var entityFactory = require('./helpers').entityFactory; 5 | 6 | suite('barchartstack component', function () { 7 | var component; 8 | var el; 9 | 10 | setup(function (done) { 11 | el = entityFactory(); 12 | el.addEventListener('componentinitialized', function (evt) { 13 | if (evt.detail.name !== 'barchartstack') { return; } 14 | component = el.components['barchartstack']; 15 | done(); 16 | }); 17 | el.setAttribute('barchartstack', {}); 18 | }); 19 | 20 | suite('foo property', function () { 21 | test('is good', function () { 22 | assert.equal(1, 1); 23 | }); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/components/barchartstack/tests/karma.conf.js: -------------------------------------------------------------------------------- 1 | // Karma configuration. 2 | module.exports = function (config) { 3 | config.set({ 4 | basePath: '../', 5 | browserify: { 6 | debug: true, 7 | paths: ['./'] 8 | }, 9 | browsers: ['Firefox', 'Chrome'], 10 | client: { 11 | captureConsole: true, 12 | mocha: {ui: 'tdd'} 13 | }, 14 | envPreprocessor: ['TEST_ENV'], 15 | files: [ 16 | // Define test files. 17 | {pattern: 'tests/**/*.test.js'}, 18 | // Serve test assets. 19 | {pattern: 'tests/assets/**/*', included: false, served: true} 20 | ], 21 | frameworks: ['mocha', 'sinon-chai', 'chai-shallow-deep-equal', 'browserify'], 22 | preprocessors: {'tests/**/*.js': ['browserify', 'env']}, 23 | reporters: ['mocha'] 24 | }); 25 | }; 26 | -------------------------------------------------------------------------------- /src/components/bubblechart/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2017 Jane John <jj@foo.com> 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /src/components/bubblechart/README.md: -------------------------------------------------------------------------------- 1 | ## aframe-bubblechart-component 2 | 3 | A Bubblechart component for A-Frame. 4 | 5 | For [A-Frame](https://aframe.io). 6 | 7 | ### API 8 | 9 | | Property | Description | Default Value | 10 | | -------- | ----------- | ------------- | 11 | | | | | 12 | 13 | ### Installation 14 | 15 | #### Browser 16 | 17 | Install and use by directly including the [browser files](dist): 18 | 19 | ```html 20 | 21 | My A-Frame Scene 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | ``` 32 | 33 | 34 | 43 | 44 | #### npm 45 | 46 | Install via npm: 47 | 48 | ```bash 49 | npm install aframe-bubblechart-component 50 | ``` 51 | 52 | Then require and use. 53 | 54 | ```js 55 | require('aframe'); 56 | require('aframe-bubblechart-component'); 57 | ``` 58 | -------------------------------------------------------------------------------- /src/components/bubblechart/index.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fran-aguilar/a-framedc/40df9c132cbb2888d08372a59564a39c1c356dc1/src/components/bubblechart/index.js -------------------------------------------------------------------------------- /src/components/bubblechart/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "bubblechart", 3 | "version": "1.0.0", 4 | "description": "A Bubblechart component for A-Frame.", 5 | "main": "index.js", 6 | "cdn": "dist/bubblechart-component.min.js", 7 | "scripts": { 8 | "build": "browserify examples/main.js -o examples/build.js", 9 | "dev": "budo examples/main.js:build.js --dir examples --port 8000 --live --open", 10 | "dist": "webpack index.js dist/bubblechart-component.js && webpack -p index.js dist/bubblechart-component.min.js", 11 | "lint": "semistandard -v | snazzy", 12 | "prepublish": "npm run dist", 13 | "preghpages": "npm run build && shx rm -rf gh-pages && shx mkdir gh-pages && shx cp -r examples/* gh-pages", 14 | "ghpages": "npm run preghpages && ghpages -p gh-pages", 15 | "start": "npm run dev", 16 | "test": "karma start ./tests/karma.conf.js", 17 | "test:firefox": "karma start ./tests/karma.conf.js --browsers Firefox", 18 | "test:chrome": "karma start ./tests/karma.conf.js --browsers Chrome" 19 | }, 20 | "repository": { 21 | "type": "git", 22 | "url": "git+https://github.com/fran-aguilar/a-framedc.git" 23 | }, 24 | "keywords": [ 25 | "aframe", 26 | "aframe-component", 27 | "aframe-vr", 28 | "vr", 29 | "mozvr", 30 | "webvr", 31 | "bubblechart" 32 | ], 33 | "author": "Jane John ", 34 | "license": "MIT", 35 | "bugs": { 36 | "url": "https://github.com/fran-aguilar/a-framedc/issues" 37 | }, 38 | "homepage": "https://github.com/fran-aguilar/a-framedc#readme", 39 | "devDependencies": { 40 | "aframe": "^0.4.0", 41 | "browserify": "^13.0.0", 42 | "budo": "^8.2.2", 43 | "chai": "^3.4.1", 44 | "chai-shallow-deep-equal": "^1.3.0", 45 | "ghpages": "^0.0.8", 46 | "karma": "^0.13.15", 47 | "karma-browserify": "^4.4.2", 48 | "karma-chai-shallow-deep-equal": "0.0.4", 49 | "karma-chrome-launcher": "2.0.0", 50 | "karma-env-preprocessor": "^0.1.1", 51 | "karma-firefox-launcher": "^0.1.7", 52 | "karma-mocha": "^0.2.1", 53 | "karma-mocha-reporter": "^1.1.3", 54 | "karma-sinon-chai": "^1.1.0", 55 | "mocha": "^2.3.4", 56 | "randomcolor": "^0.4.4", 57 | "semistandard": "^8.0.0", 58 | "shelljs": "^0.7.0", 59 | "sinon": "^1.17.5", 60 | "sinon-chai": "^2.8.0", 61 | "shx": "^0.1.1", 62 | "snazzy": "^4.0.0", 63 | "webpack": "^1.13.0" 64 | }, 65 | "semistandard": { 66 | "ignore": [ 67 | "examples/build.js", 68 | "dist/**" 69 | ] 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /src/components/bubblechart/tests/__init.test.js: -------------------------------------------------------------------------------- 1 | /* global sinon, setup, teardown */ 2 | 3 | /** 4 | * __init.test.js is run before every test case. 5 | */ 6 | window.debug = true; 7 | var AScene = require('aframe').AScene 8 | 9 | navigator.getVRDisplays = function () { 10 | var resolvePromise = Promise.resolve(); 11 | var mockVRDisplay = { 12 | requestPresent: resolvePromise, 13 | exitPresent: resolvePromise, 14 | getPose: function () { return {orientation: null, position: null}; }, 15 | requestAnimationFrame: function () { return 1; } 16 | }; 17 | return Promise.resolve([mockVRDisplay]); 18 | }; 19 | 20 | setup(function () { 21 | this.sinon = sinon.sandbox.create(); 22 | // Stubs to not create a WebGL context since Travis CI runs headless. 23 | this.sinon.stub(AScene.prototype, 'render'); 24 | this.sinon.stub(AScene.prototype, 'resize'); 25 | this.sinon.stub(AScene.prototype, 'setupRenderer'); 26 | }); 27 | 28 | teardown(function () { 29 | // Clean up any attached elements. 30 | var attachedEls = ['canvas', 'a-assets', 'a-scene']; 31 | var els = document.querySelectorAll(attachedEls.join(',')); 32 | for (var i = 0; i < els.length; i++) { 33 | els[i].parentNode.removeChild(els[i]); 34 | } 35 | this.sinon.restore(); 36 | }); 37 | -------------------------------------------------------------------------------- /src/components/bubblechart/tests/helpers.js: -------------------------------------------------------------------------------- 1 | /* global suite */ 2 | 3 | /** 4 | * Helper method to create a scene, create an entity, add entity to scene, 5 | * add scene to document. 6 | * 7 | * @returns {object} An `` element. 8 | */ 9 | module.exports.entityFactory = function (opts) { 10 | var scene = document.createElement('a-scene'); 11 | var assets = document.createElement('a-assets'); 12 | var entity = document.createElement('a-entity'); 13 | scene.appendChild(assets); 14 | scene.appendChild(entity); 15 | 16 | opts = opts || {}; 17 | 18 | if (opts.assets) { 19 | opts.assets.forEach(function (asset) { 20 | assets.appendChild(asset); 21 | }); 22 | } 23 | 24 | document.body.appendChild(scene); 25 | return entity; 26 | }; 27 | 28 | /** 29 | * Creates and attaches a mixin element (and an `` element if necessary). 30 | * 31 | * @param {string} id - ID of mixin. 32 | * @param {object} obj - Map of component names to attribute values. 33 | * @param {Element} scene - Indicate which scene to apply mixin to if necessary. 34 | * @returns {object} An attached `` element. 35 | */ 36 | module.exports.mixinFactory = function (id, obj, scene) { 37 | var mixinEl = document.createElement('a-mixin'); 38 | mixinEl.setAttribute('id', id); 39 | Object.keys(obj).forEach(function (componentName) { 40 | mixinEl.setAttribute(componentName, obj[componentName]); 41 | }); 42 | 43 | var assetsEl = scene ? scene.querySelector('a-assets') : document.querySelector('a-assets'); 44 | assetsEl.appendChild(mixinEl); 45 | 46 | return mixinEl; 47 | }; 48 | 49 | /** 50 | * Test that is only run locally and is skipped on CI. 51 | */ 52 | module.exports.getSkipCISuite = function () { 53 | if (window.__env__.TEST_ENV === 'ci') { 54 | return suite.skip; 55 | } else { 56 | return suite; 57 | } 58 | }; 59 | -------------------------------------------------------------------------------- /src/components/bubblechart/tests/index.test.js: -------------------------------------------------------------------------------- 1 | /* global assert, setup, suite, test */ 2 | require('aframe'); 3 | require('../index.js'); 4 | var entityFactory = require('./helpers').entityFactory; 5 | 6 | suite('bubblechart component', function () { 7 | var component; 8 | var el; 9 | 10 | setup(function (done) { 11 | el = entityFactory(); 12 | el.addEventListener('componentinitialized', function (evt) { 13 | if (evt.detail.name !== 'bubblechart') { return; } 14 | component = el.components['bubblechart']; 15 | done(); 16 | }); 17 | el.setAttribute('bubblechart', {}); 18 | }); 19 | 20 | suite('foo property', function () { 21 | test('is good', function () { 22 | assert.equal(1, 1); 23 | }); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/components/bubblechart/tests/karma.conf.js: -------------------------------------------------------------------------------- 1 | // Karma configuration. 2 | module.exports = function (config) { 3 | config.set({ 4 | basePath: '../', 5 | browserify: { 6 | debug: true, 7 | paths: ['./'] 8 | }, 9 | browsers: ['Firefox', 'Chrome'], 10 | client: { 11 | captureConsole: true, 12 | mocha: {ui: 'tdd'} 13 | }, 14 | envPreprocessor: ['TEST_ENV'], 15 | files: [ 16 | // Define test files. 17 | {pattern: 'tests/**/*.test.js'}, 18 | // Serve test assets. 19 | {pattern: 'tests/assets/**/*', included: false, served: true} 20 | ], 21 | frameworks: ['mocha', 'sinon-chai', 'chai-shallow-deep-equal', 'browserify'], 22 | preprocessors: {'tests/**/*.js': ['browserify', 'env']}, 23 | reporters: ['mocha'] 24 | }); 25 | }; 26 | -------------------------------------------------------------------------------- /src/components/envmap/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2017 Jane John <jj@foo.com> 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /src/components/envmap/README.md: -------------------------------------------------------------------------------- 1 | ## aframe-envmap-component 2 | 3 | A Envmap component for A-Frame. 4 | 5 | For [A-Frame](https://aframe.io). 6 | 7 | ### API 8 | 9 | | Property | Description | Default Value | 10 | | -------- | ----------- | ------------- | 11 | | | | | 12 | 13 | ### Installation 14 | 15 | #### Browser 16 | 17 | Install and use by directly including the [browser files](dist): 18 | 19 | ```html 20 | 21 | My A-Frame Scene 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | ``` 32 | 33 | 34 | 43 | 44 | #### npm 45 | 46 | Install via npm: 47 | 48 | ```bash 49 | npm install aframe-envmap-component 50 | ``` 51 | 52 | Then require and use. 53 | 54 | ```js 55 | require('aframe'); 56 | require('aframe-envmap-component'); 57 | ``` 58 | -------------------------------------------------------------------------------- /src/components/envmap/dist/envmap-component.js: -------------------------------------------------------------------------------- 1 | /******/ (function(modules) { // webpackBootstrap 2 | /******/ // The module cache 3 | /******/ var installedModules = {}; 4 | 5 | /******/ // The require function 6 | /******/ function __webpack_require__(moduleId) { 7 | 8 | /******/ // Check if module is in cache 9 | /******/ if(installedModules[moduleId]) 10 | /******/ return installedModules[moduleId].exports; 11 | 12 | /******/ // Create a new module (and put it into the cache) 13 | /******/ var module = installedModules[moduleId] = { 14 | /******/ exports: {}, 15 | /******/ id: moduleId, 16 | /******/ loaded: false 17 | /******/ }; 18 | 19 | /******/ // Execute the module function 20 | /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 21 | 22 | /******/ // Flag the module as loaded 23 | /******/ module.loaded = true; 24 | 25 | /******/ // Return the exports of the module 26 | /******/ return module.exports; 27 | /******/ } 28 | 29 | 30 | /******/ // expose the modules object (__webpack_modules__) 31 | /******/ __webpack_require__.m = modules; 32 | 33 | /******/ // expose the module cache 34 | /******/ __webpack_require__.c = installedModules; 35 | 36 | /******/ // __webpack_public_path__ 37 | /******/ __webpack_require__.p = ""; 38 | 39 | /******/ // Load entry module and return exports 40 | /******/ return __webpack_require__(0); 41 | /******/ }) 42 | /************************************************************************/ 43 | /******/ ([ 44 | /* 0 */ 45 | /***/ (function(module, exports) { 46 | 47 | /* global AFRAME */ 48 | 49 | if (typeof AFRAME === 'undefined') { 50 | throw new Error('Component attempted to register before AFRAME was available.'); 51 | } 52 | 53 | AFRAME.registerComponent("envmap", { 54 | schema: { 55 | imgprefix: { default: "img/dawnmountain-" }, 56 | extension: { default: "png" }, 57 | width: { default: 500 }, 58 | height: { default: 500 }, 59 | depth: { default: 500 } 60 | }, 61 | init: function () { 62 | 63 | var imagePrefix = this.data.imgprefix; 64 | var directions = ["xpos", "xneg", "ypos", "yneg", "zpos", "zneg"]; 65 | var imageSuffix = "." + this.data.extension; 66 | var skyGeometry = new THREE.CubeGeometry(this.data.width, this.data.height, this.data.depth); 67 | 68 | var materialArray = []; 69 | for (var i = 0; i < 6; i++) 70 | materialArray.push(new THREE.MeshBasicMaterial({ 71 | map: THREE.ImageUtils.loadTexture(imagePrefix + directions[i] + imageSuffix), 72 | side: THREE.BackSide 73 | })); 74 | var skyMaterial = new THREE.MeshFaceMaterial(materialArray); 75 | var skyBox = new THREE.Mesh(skyGeometry, skyMaterial); 76 | this.mesh = skyBox; 77 | this.el.setObject3D('mesh', this.mesh); 78 | } 79 | }); 80 | 81 | 82 | /***/ }) 83 | /******/ ]); -------------------------------------------------------------------------------- /src/components/envmap/dist/envmap-component.min.js: -------------------------------------------------------------------------------- 1 | !function(e){function t(i){if(a[i])return a[i].exports;var n=a[i]={exports:{},id:i,loaded:!1};return e[i].call(n.exports,n,n.exports,t),n.loaded=!0,n.exports}var a={};return t.m=e,t.c=a,t.p="",t(0)}([function(e,t){if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");AFRAME.registerComponent("envmap",{schema:{imgprefix:{default:"img/dawnmountain-"},extension:{default:"png"},width:{default:500},height:{default:500},depth:{default:500}},init:function(){for(var e=this.data.imgprefix,t=["xpos","xneg","ypos","yneg","zpos","zneg"],a="."+this.data.extension,i=new THREE.CubeGeometry(this.data.width,this.data.height,this.data.depth),n=[],s=0;s<6;s++)n.push(new THREE.MeshBasicMaterial({map:THREE.ImageUtils.loadTexture(e+t[s]+a),side:THREE.BackSide}));var r=new THREE.MeshFaceMaterial(n),o=new THREE.Mesh(i,r);this.mesh=o,this.el.setObject3D("mesh",this.mesh)}})}]); -------------------------------------------------------------------------------- /src/components/envmap/index.js: -------------------------------------------------------------------------------- 1 | /* global AFRAME */ 2 | 3 | if (typeof AFRAME === 'undefined') { 4 | throw new Error('Component attempted to register before AFRAME was available.'); 5 | } 6 | 7 | AFRAME.registerComponent("envmap", { 8 | schema: { 9 | imgprefix: { default: "img/dawnmountain-" }, 10 | extension: { default: "png" }, 11 | width: { default: 500 }, 12 | height: { default: 500 }, 13 | depth: { default: 500 } 14 | }, 15 | update: function () { 16 | 17 | var imagePrefix = this.data.imgprefix; 18 | var directions = ["xpos", "xneg", "ypos", "yneg", "zpos", "zneg"]; 19 | var imageSuffix = "." + this.data.extension; 20 | var skyGeometry = new THREE.CubeGeometry(this.data.width, this.data.height, this.data.depth); 21 | 22 | var materialArray = []; 23 | for (var i = 0; i < 6; i++) 24 | materialArray.push(new THREE.MeshBasicMaterial({ 25 | map: THREE.ImageUtils.loadTexture(imagePrefix + directions[i] + imageSuffix), 26 | side: THREE.BackSide 27 | })); 28 | var skyMaterial = new THREE.MeshFaceMaterial(materialArray); 29 | var skyBox = new THREE.Mesh(skyGeometry, skyMaterial); 30 | this.mesh = skyBox; 31 | this.el.setObject3D('mesh', this.mesh); 32 | } 33 | }); 34 | -------------------------------------------------------------------------------- /src/components/envmap/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "envmap-component", 3 | "version": "1.0.0", 4 | "description": "A Envmap component for A-Frame.", 5 | "main": "index.js", 6 | "cdn": "dist/envmap-component.min.js", 7 | "scripts": { 8 | "build": "browserify examples/main.js -o examples/build.js", 9 | "dev": "budo examples/main.js:build.js --dir examples --port 8000 --live --open", 10 | "dist": "webpack index.js dist/envmap-component.js && webpack -p index.js dist/envmap-component.min.js", 11 | "lint": "semistandard -v | snazzy", 12 | "prepublish": "npm run dist", 13 | "preghpages": "npm run build && shx rm -rf gh-pages && shx mkdir gh-pages && shx cp -r examples/* gh-pages", 14 | "ghpages": "npm run preghpages && ghpages -p gh-pages", 15 | "start": "npm run dev", 16 | "test": "karma start ./tests/karma.conf.js", 17 | "test:firefox": "karma start ./tests/karma.conf.js --browsers Firefox", 18 | "test:chrome": "karma start ./tests/karma.conf.js --browsers Chrome" 19 | }, 20 | "repository": { 21 | "type": "git", 22 | "url": "git+https://github.com/fran-aguilar/aframe-dc.git" 23 | }, 24 | "keywords": [ 25 | "aframe", 26 | "aframe-component", 27 | "aframe-vr", 28 | "vr", 29 | "mozvr", 30 | "webvr", 31 | "envmap" 32 | ], 33 | "author": "Jane John ", 34 | "license": "MIT", 35 | "bugs": { 36 | "url": "https://github.com/fran-aguilar/aframe-dc/issues" 37 | }, 38 | "homepage": "https://github.com/fran-aguilar/aframe-dc#readme", 39 | "devDependencies": { 40 | "aframe": "^0.4.0", 41 | "browserify": "^13.0.0", 42 | "budo": "^8.2.2", 43 | "chai": "^3.4.1", 44 | "chai-shallow-deep-equal": "^1.3.0", 45 | "ghpages": "^0.0.8", 46 | "karma": "^0.13.15", 47 | "karma-browserify": "^4.4.2", 48 | "karma-chai-shallow-deep-equal": "0.0.4", 49 | "karma-chrome-launcher": "2.0.0", 50 | "karma-env-preprocessor": "^0.1.1", 51 | "karma-firefox-launcher": "^0.1.7", 52 | "karma-mocha": "^0.2.1", 53 | "karma-mocha-reporter": "^1.1.3", 54 | "karma-sinon-chai": "^1.1.0", 55 | "mocha": "^2.3.4", 56 | "randomcolor": "^0.4.4", 57 | "semistandard": "^8.0.0", 58 | "shelljs": "^0.7.0", 59 | "sinon": "^1.17.5", 60 | "sinon-chai": "^2.8.0", 61 | "shx": "^0.1.1", 62 | "snazzy": "^4.0.0", 63 | "webpack": "^1.13.0" 64 | }, 65 | "semistandard": { 66 | "ignore": [ 67 | "examples/build.js", 68 | "dist/**" 69 | ] 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /src/components/envmap/tests/__init.test.js: -------------------------------------------------------------------------------- 1 | /* global sinon, setup, teardown */ 2 | 3 | /** 4 | * __init.test.js is run before every test case. 5 | */ 6 | window.debug = true; 7 | var AScene = require('aframe').AScene 8 | 9 | navigator.getVRDisplays = function () { 10 | var resolvePromise = Promise.resolve(); 11 | var mockVRDisplay = { 12 | requestPresent: resolvePromise, 13 | exitPresent: resolvePromise, 14 | getPose: function () { return {orientation: null, position: null}; }, 15 | requestAnimationFrame: function () { return 1; } 16 | }; 17 | return Promise.resolve([mockVRDisplay]); 18 | }; 19 | 20 | setup(function () { 21 | this.sinon = sinon.sandbox.create(); 22 | // Stubs to not create a WebGL context since Travis CI runs headless. 23 | this.sinon.stub(AScene.prototype, 'render'); 24 | this.sinon.stub(AScene.prototype, 'resize'); 25 | this.sinon.stub(AScene.prototype, 'setupRenderer'); 26 | }); 27 | 28 | teardown(function () { 29 | // Clean up any attached elements. 30 | var attachedEls = ['canvas', 'a-assets', 'a-scene']; 31 | var els = document.querySelectorAll(attachedEls.join(',')); 32 | for (var i = 0; i < els.length; i++) { 33 | els[i].parentNode.removeChild(els[i]); 34 | } 35 | this.sinon.restore(); 36 | }); 37 | -------------------------------------------------------------------------------- /src/components/envmap/tests/helpers.js: -------------------------------------------------------------------------------- 1 | /* global suite */ 2 | 3 | /** 4 | * Helper method to create a scene, create an entity, add entity to scene, 5 | * add scene to document. 6 | * 7 | * @returns {object} An `` element. 8 | */ 9 | module.exports.entityFactory = function (opts) { 10 | var scene = document.createElement('a-scene'); 11 | var assets = document.createElement('a-assets'); 12 | var entity = document.createElement('a-entity'); 13 | scene.appendChild(assets); 14 | scene.appendChild(entity); 15 | 16 | opts = opts || {}; 17 | 18 | if (opts.assets) { 19 | opts.assets.forEach(function (asset) { 20 | assets.appendChild(asset); 21 | }); 22 | } 23 | 24 | document.body.appendChild(scene); 25 | return entity; 26 | }; 27 | 28 | /** 29 | * Creates and attaches a mixin element (and an `` element if necessary). 30 | * 31 | * @param {string} id - ID of mixin. 32 | * @param {object} obj - Map of component names to attribute values. 33 | * @param {Element} scene - Indicate which scene to apply mixin to if necessary. 34 | * @returns {object} An attached `` element. 35 | */ 36 | module.exports.mixinFactory = function (id, obj, scene) { 37 | var mixinEl = document.createElement('a-mixin'); 38 | mixinEl.setAttribute('id', id); 39 | Object.keys(obj).forEach(function (componentName) { 40 | mixinEl.setAttribute(componentName, obj[componentName]); 41 | }); 42 | 43 | var assetsEl = scene ? scene.querySelector('a-assets') : document.querySelector('a-assets'); 44 | assetsEl.appendChild(mixinEl); 45 | 46 | return mixinEl; 47 | }; 48 | 49 | /** 50 | * Test that is only run locally and is skipped on CI. 51 | */ 52 | module.exports.getSkipCISuite = function () { 53 | if (window.__env__.TEST_ENV === 'ci') { 54 | return suite.skip; 55 | } else { 56 | return suite; 57 | } 58 | }; 59 | -------------------------------------------------------------------------------- /src/components/envmap/tests/index.test.js: -------------------------------------------------------------------------------- 1 | /* global assert, setup, suite, test */ 2 | require('aframe'); 3 | require('../index.js'); 4 | var entityFactory = require('./helpers').entityFactory; 5 | 6 | suite('envmap component', function () { 7 | var component; 8 | var el; 9 | 10 | setup(function (done) { 11 | el = entityFactory(); 12 | el.addEventListener('componentinitialized', function (evt) { 13 | if (evt.detail.name !== 'envmap') { return; } 14 | component = el.components['envmap']; 15 | done(); 16 | }); 17 | el.setAttribute('envmap', {}); 18 | }); 19 | 20 | suite('foo property', function () { 21 | test('is good', function () { 22 | assert.equal(1, 1); 23 | }); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/components/envmap/tests/karma.conf.js: -------------------------------------------------------------------------------- 1 | // Karma configuration. 2 | module.exports = function (config) { 3 | config.set({ 4 | basePath: '../', 5 | browserify: { 6 | debug: true, 7 | paths: ['./'] 8 | }, 9 | browsers: ['Firefox', 'Chrome'], 10 | client: { 11 | captureConsole: true, 12 | mocha: {ui: 'tdd'} 13 | }, 14 | envPreprocessor: ['TEST_ENV'], 15 | files: [ 16 | // Define test files. 17 | {pattern: 'tests/**/*.test.js'}, 18 | // Serve test assets. 19 | {pattern: 'tests/assets/**/*', included: false, served: true} 20 | ], 21 | frameworks: ['mocha', 'sinon-chai', 'chai-shallow-deep-equal', 'browserify'], 22 | preprocessors: {'tests/**/*.js': ['browserify', 'env']}, 23 | reporters: ['mocha'] 24 | }); 25 | }; 26 | -------------------------------------------------------------------------------- /src/components/panel/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2017 Jane John <jj@foo.com> 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /src/components/panel/README.md: -------------------------------------------------------------------------------- 1 | ## aframe-panel-component 2 | 3 | A Panel component for A-Frame. 4 | 5 | For [A-Frame](https://aframe.io). 6 | 7 | ### API 8 | 9 | | Property | Description | Default Value | 10 | | -------- | ----------- | ------------- | 11 | | | | | 12 | 13 | ### Installation 14 | 15 | #### Browser 16 | 17 | Install and use by directly including the [browser files](dist): 18 | 19 | ```html 20 | 21 | My A-Frame Scene 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | ``` 32 | 33 | 34 | 43 | 44 | #### npm 45 | 46 | Install via npm: 47 | 48 | ```bash 49 | npm install aframe-panel-component 50 | ``` 51 | 52 | Then require and use. 53 | 54 | ```js 55 | require('aframe'); 56 | require('aframe-panel-component'); 57 | ``` 58 | -------------------------------------------------------------------------------- /src/components/panel/dist/panel-component.js: -------------------------------------------------------------------------------- 1 | /******/ (function(modules) { // webpackBootstrap 2 | /******/ // The module cache 3 | /******/ var installedModules = {}; 4 | 5 | /******/ // The require function 6 | /******/ function __webpack_require__(moduleId) { 7 | 8 | /******/ // Check if module is in cache 9 | /******/ if(installedModules[moduleId]) 10 | /******/ return installedModules[moduleId].exports; 11 | 12 | /******/ // Create a new module (and put it into the cache) 13 | /******/ var module = installedModules[moduleId] = { 14 | /******/ exports: {}, 15 | /******/ id: moduleId, 16 | /******/ loaded: false 17 | /******/ }; 18 | 19 | /******/ // Execute the module function 20 | /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 21 | 22 | /******/ // Flag the module as loaded 23 | /******/ module.loaded = true; 24 | 25 | /******/ // Return the exports of the module 26 | /******/ return module.exports; 27 | /******/ } 28 | 29 | 30 | /******/ // expose the modules object (__webpack_modules__) 31 | /******/ __webpack_require__.m = modules; 32 | 33 | /******/ // expose the module cache 34 | /******/ __webpack_require__.c = installedModules; 35 | 36 | /******/ // __webpack_public_path__ 37 | /******/ __webpack_require__.p = ""; 38 | 39 | /******/ // Load entry module and return exports 40 | /******/ return __webpack_require__(0); 41 | /******/ }) 42 | /************************************************************************/ 43 | /******/ ([ 44 | /* 0 */ 45 | /***/ (function(module, exports) { 46 | 47 | /* global AFRAME */ 48 | 49 | if (typeof AFRAME === 'undefined') { 50 | throw new Error('Component attempted to register before AFRAME was available.'); 51 | } 52 | 53 | /** 54 | * Panel component for A-Frame. 55 | */ 56 | AFRAME.registerComponent('panel', { 57 | schema: {}, 58 | 59 | /** 60 | * Set if component needs multiple instancing. 61 | */ 62 | multiple: false, 63 | 64 | /** 65 | * Called once when component is attached. Generally for initial setup. 66 | */ 67 | init: function () { }, 68 | 69 | /** 70 | * Called when component is attached and when component data changes. 71 | * Generally modifies the entity based on the data. 72 | */ 73 | update: function (oldData) { }, 74 | 75 | /** 76 | * Called when a component is removed (e.g., via removeAttribute). 77 | * Generally undoes all modifications to the entity. 78 | */ 79 | remove: function () { }, 80 | 81 | /** 82 | * Called on each scene tick. 83 | */ 84 | // tick: function (t) { }, 85 | 86 | /** 87 | * Called when entity pauses. 88 | * Use to stop or remove any dynamic or background behavior such as events. 89 | */ 90 | pause: function () { }, 91 | 92 | /** 93 | * Called when entity resumes. 94 | * Use to continue or add any dynamic or background behavior such as events. 95 | */ 96 | play: function () { } 97 | }); 98 | 99 | 100 | /***/ }) 101 | /******/ ]); -------------------------------------------------------------------------------- /src/components/panel/dist/panel-component.min.js: -------------------------------------------------------------------------------- 1 | !function(e){function t(o){if(n[o])return n[o].exports;var r=n[o]={exports:{},id:o,loaded:!1};return e[o].call(r.exports,r,r.exports,t),r.loaded=!0,r.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t){if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");AFRAME.registerComponent("panel",{schema:{},multiple:!1,init:function(){},update:function(e){},remove:function(){},pause:function(){},play:function(){}})}]); -------------------------------------------------------------------------------- /src/components/panel/index.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fran-aguilar/a-framedc/40df9c132cbb2888d08372a59564a39c1c356dc1/src/components/panel/index.js -------------------------------------------------------------------------------- /src/components/panel/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "panel-component", 3 | "version": "1.0.0", 4 | "description": "A Panel component for A-Frame.", 5 | "main": "index.js", 6 | "cdn": "dist/aframe-panel-component.min.js", 7 | "scripts": { 8 | "build": "browserify examples/main.js -o examples/build.js", 9 | "dev": "budo examples/main.js:build.js --dir examples --port 8000 --live --open", 10 | "dist": "webpack index.js dist/panel-component.js && webpack -p index.js dist/panel-component.min.js", 11 | "lint": "semistandard -v | snazzy", 12 | "prepublish": "npm run dist", 13 | "preghpages": "npm run build && shx rm -rf gh-pages && shx mkdir gh-pages && shx cp -r examples/* gh-pages", 14 | "ghpages": "npm run preghpages && ghpages -p gh-pages", 15 | "start": "npm run dev", 16 | "test": "karma start ./tests/karma.conf.js", 17 | "test:firefox": "karma start ./tests/karma.conf.js --browsers Firefox", 18 | "test:chrome": "karma start ./tests/karma.conf.js --browsers Chrome" 19 | }, 20 | "repository": { 21 | "type": "git", 22 | "url": "git+https://github.com/fran-aguilar/a-framedc.git" 23 | }, 24 | "keywords": [ 25 | "aframe", 26 | "aframe-component", 27 | "aframe-vr", 28 | "vr", 29 | "mozvr", 30 | "webvr", 31 | "panel" 32 | ], 33 | "author": "Jane John ", 34 | "license": "MIT", 35 | "bugs": { 36 | "url": "https://github.com/fran-aguilar/a-framedc/issues" 37 | }, 38 | "homepage": "https://github.com/fran-aguilar/a-framedc#readme", 39 | "devDependencies": { 40 | "aframe": "^0.4.0", 41 | "browserify": "^13.0.0", 42 | "budo": "^8.2.2", 43 | "chai": "^3.4.1", 44 | "chai-shallow-deep-equal": "^1.3.0", 45 | "ghpages": "^0.0.8", 46 | "karma": "^0.13.15", 47 | "karma-browserify": "^4.4.2", 48 | "karma-chai-shallow-deep-equal": "0.0.4", 49 | "karma-chrome-launcher": "2.0.0", 50 | "karma-env-preprocessor": "^0.1.1", 51 | "karma-firefox-launcher": "^0.1.7", 52 | "karma-mocha": "^0.2.1", 53 | "karma-mocha-reporter": "^1.1.3", 54 | "karma-sinon-chai": "^1.1.0", 55 | "mocha": "^2.3.4", 56 | "randomcolor": "^0.4.4", 57 | "semistandard": "^8.0.0", 58 | "shelljs": "^0.7.0", 59 | "sinon": "^1.17.5", 60 | "sinon-chai": "^2.8.0", 61 | "shx": "^0.1.1", 62 | "snazzy": "^4.0.0", 63 | "webpack": "^1.13.0" 64 | }, 65 | "semistandard": { 66 | "ignore": [ 67 | "examples/build.js", 68 | "dist/**" 69 | ] 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /src/components/panel/tests/__init.test.js: -------------------------------------------------------------------------------- 1 | /* global sinon, setup, teardown */ 2 | 3 | /** 4 | * __init.test.js is run before every test case. 5 | */ 6 | window.debug = true; 7 | var AScene = require('aframe').AScene 8 | 9 | navigator.getVRDisplays = function () { 10 | var resolvePromise = Promise.resolve(); 11 | var mockVRDisplay = { 12 | requestPresent: resolvePromise, 13 | exitPresent: resolvePromise, 14 | getPose: function () { return {orientation: null, position: null}; }, 15 | requestAnimationFrame: function () { return 1; } 16 | }; 17 | return Promise.resolve([mockVRDisplay]); 18 | }; 19 | 20 | setup(function () { 21 | this.sinon = sinon.sandbox.create(); 22 | // Stubs to not create a WebGL context since Travis CI runs headless. 23 | this.sinon.stub(AScene.prototype, 'render'); 24 | this.sinon.stub(AScene.prototype, 'resize'); 25 | this.sinon.stub(AScene.prototype, 'setupRenderer'); 26 | }); 27 | 28 | teardown(function () { 29 | // Clean up any attached elements. 30 | var attachedEls = ['canvas', 'a-assets', 'a-scene']; 31 | var els = document.querySelectorAll(attachedEls.join(',')); 32 | for (var i = 0; i < els.length; i++) { 33 | els[i].parentNode.removeChild(els[i]); 34 | } 35 | this.sinon.restore(); 36 | }); 37 | -------------------------------------------------------------------------------- /src/components/panel/tests/helpers.js: -------------------------------------------------------------------------------- 1 | /* global suite */ 2 | 3 | /** 4 | * Helper method to create a scene, create an entity, add entity to scene, 5 | * add scene to document. 6 | * 7 | * @returns {object} An `` element. 8 | */ 9 | module.exports.entityFactory = function (opts) { 10 | var scene = document.createElement('a-scene'); 11 | var assets = document.createElement('a-assets'); 12 | var entity = document.createElement('a-entity'); 13 | scene.appendChild(assets); 14 | scene.appendChild(entity); 15 | 16 | opts = opts || {}; 17 | 18 | if (opts.assets) { 19 | opts.assets.forEach(function (asset) { 20 | assets.appendChild(asset); 21 | }); 22 | } 23 | 24 | document.body.appendChild(scene); 25 | return entity; 26 | }; 27 | 28 | /** 29 | * Creates and attaches a mixin element (and an `` element if necessary). 30 | * 31 | * @param {string} id - ID of mixin. 32 | * @param {object} obj - Map of component names to attribute values. 33 | * @param {Element} scene - Indicate which scene to apply mixin to if necessary. 34 | * @returns {object} An attached `` element. 35 | */ 36 | module.exports.mixinFactory = function (id, obj, scene) { 37 | var mixinEl = document.createElement('a-mixin'); 38 | mixinEl.setAttribute('id', id); 39 | Object.keys(obj).forEach(function (componentName) { 40 | mixinEl.setAttribute(componentName, obj[componentName]); 41 | }); 42 | 43 | var assetsEl = scene ? scene.querySelector('a-assets') : document.querySelector('a-assets'); 44 | assetsEl.appendChild(mixinEl); 45 | 46 | return mixinEl; 47 | }; 48 | 49 | /** 50 | * Test that is only run locally and is skipped on CI. 51 | */ 52 | module.exports.getSkipCISuite = function () { 53 | if (window.__env__.TEST_ENV === 'ci') { 54 | return suite.skip; 55 | } else { 56 | return suite; 57 | } 58 | }; 59 | -------------------------------------------------------------------------------- /src/components/panel/tests/index.test.js: -------------------------------------------------------------------------------- 1 | /* global assert, setup, suite, test */ 2 | require('aframe'); 3 | require('../index.js'); 4 | var entityFactory = require('./helpers').entityFactory; 5 | 6 | suite('panel component', function () { 7 | var component; 8 | var el; 9 | 10 | setup(function (done) { 11 | el = entityFactory(); 12 | el.addEventListener('componentinitialized', function (evt) { 13 | if (evt.detail.name !== 'panel') { return; } 14 | component = el.components['panel']; 15 | done(); 16 | }); 17 | el.setAttribute('panel', {}); 18 | }); 19 | 20 | suite('foo property', function () { 21 | test('is good', function () { 22 | assert.equal(1, 1); 23 | }); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/components/panel/tests/karma.conf.js: -------------------------------------------------------------------------------- 1 | // Karma configuration. 2 | module.exports = function (config) { 3 | config.set({ 4 | basePath: '../', 5 | browserify: { 6 | debug: true, 7 | paths: ['./'] 8 | }, 9 | browsers: ['Firefox', 'Chrome'], 10 | client: { 11 | captureConsole: true, 12 | mocha: {ui: 'tdd'} 13 | }, 14 | envPreprocessor: ['TEST_ENV'], 15 | files: [ 16 | // Define test files. 17 | {pattern: 'tests/**/*.test.js'}, 18 | // Serve test assets. 19 | {pattern: 'tests/assets/**/*', included: false, served: true} 20 | ], 21 | frameworks: ['mocha', 'sinon-chai', 'chai-shallow-deep-equal', 'browserify'], 22 | preprocessors: {'tests/**/*.js': ['browserify', 'env']}, 23 | reporters: ['mocha'] 24 | }); 25 | }; 26 | -------------------------------------------------------------------------------- /src/components/piechart/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2017 Jane John <jj@foo.com> 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /src/components/piechart/README.md: -------------------------------------------------------------------------------- 1 | ## aframe-piechart-component 2 | 3 | A Piechart component for A-Frame. 4 | 5 | For [A-Frame](https://aframe.io). 6 | 7 | ### API 8 | 9 | | Property | Description | Default Value | 10 | | -------- | ----------- | ------------- | 11 | | | | | 12 | 13 | ### Installation 14 | 15 | #### Browser 16 | 17 | Install and use by directly including the [browser files](dist): 18 | 19 | ```html 20 | 21 | My A-Frame Scene 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | ``` 32 | 33 | 34 | 43 | 44 | #### npm 45 | 46 | Install via npm: 47 | 48 | ```bash 49 | npm install aframe-piechart-component 50 | ``` 51 | 52 | Then require and use. 53 | 54 | ```js 55 | require('aframe'); 56 | require('aframe-piechart-component'); 57 | ``` 58 | -------------------------------------------------------------------------------- /src/components/piechart/dist/aframe-piechart-component.js: -------------------------------------------------------------------------------- 1 | /******/ (function(modules) { // webpackBootstrap 2 | /******/ // The module cache 3 | /******/ var installedModules = {}; 4 | 5 | /******/ // The require function 6 | /******/ function __webpack_require__(moduleId) { 7 | 8 | /******/ // Check if module is in cache 9 | /******/ if(installedModules[moduleId]) 10 | /******/ return installedModules[moduleId].exports; 11 | 12 | /******/ // Create a new module (and put it into the cache) 13 | /******/ var module = installedModules[moduleId] = { 14 | /******/ exports: {}, 15 | /******/ id: moduleId, 16 | /******/ loaded: false 17 | /******/ }; 18 | 19 | /******/ // Execute the module function 20 | /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 21 | 22 | /******/ // Flag the module as loaded 23 | /******/ module.loaded = true; 24 | 25 | /******/ // Return the exports of the module 26 | /******/ return module.exports; 27 | /******/ } 28 | 29 | 30 | /******/ // expose the modules object (__webpack_modules__) 31 | /******/ __webpack_require__.m = modules; 32 | 33 | /******/ // expose the module cache 34 | /******/ __webpack_require__.c = installedModules; 35 | 36 | /******/ // __webpack_public_path__ 37 | /******/ __webpack_require__.p = ""; 38 | 39 | /******/ // Load entry module and return exports 40 | /******/ return __webpack_require__(0); 41 | /******/ }) 42 | /************************************************************************/ 43 | /******/ ([ 44 | /* 0 */ 45 | /***/ (function(module, exports) { 46 | 47 | /* global AFRAME */ 48 | 49 | if (typeof AFRAME === 'undefined') { 50 | throw new Error('Component attempted to register before AFRAME was available.'); 51 | } 52 | 53 | /** 54 | * Piechart component for A-Frame. 55 | */ 56 | AFRAME.registerComponent('piechart', { 57 | schema: {}, 58 | 59 | /** 60 | * Set if component needs multiple instancing. 61 | */ 62 | multiple: false, 63 | 64 | /** 65 | * Called once when component is attached. Generally for initial setup. 66 | */ 67 | init: function () { }, 68 | 69 | /** 70 | * Called when component is attached and when component data changes. 71 | * Generally modifies the entity based on the data. 72 | */ 73 | update: function (oldData) { }, 74 | 75 | /** 76 | * Called when a component is removed (e.g., via removeAttribute). 77 | * Generally undoes all modifications to the entity. 78 | */ 79 | remove: function () { }, 80 | 81 | /** 82 | * Called on each scene tick. 83 | */ 84 | // tick: function (t) { }, 85 | 86 | /** 87 | * Called when entity pauses. 88 | * Use to stop or remove any dynamic or background behavior such as events. 89 | */ 90 | pause: function () { }, 91 | 92 | /** 93 | * Called when entity resumes. 94 | * Use to continue or add any dynamic or background behavior such as events. 95 | */ 96 | play: function () { } 97 | }); 98 | 99 | 100 | /***/ }) 101 | /******/ ]); -------------------------------------------------------------------------------- /src/components/piechart/dist/aframe-piechart-component.min.js: -------------------------------------------------------------------------------- 1 | !function(e){function t(o){if(n[o])return n[o].exports;var r=n[o]={exports:{},id:o,loaded:!1};return e[o].call(r.exports,r,r.exports,t),r.loaded=!0,r.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t){if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");AFRAME.registerComponent("piechart",{schema:{},multiple:!1,init:function(){},update:function(e){},remove:function(){},pause:function(){},play:function(){}})}]); -------------------------------------------------------------------------------- /src/components/piechart/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "piechart", 3 | "version": "1.0.0", 4 | "description": "A Piechart component for A-Frame.", 5 | "main": "index.js", 6 | "cdn": "dist/aframe-piechart-component.min.js", 7 | "scripts": { 8 | "build": "browserify examples/main.js -o examples/build.js", 9 | "dev": "budo examples/main.js:build.js --dir examples --port 8000 --live --open", 10 | "dist": "webpack index.js dist/aframe-piechart-component.js && webpack -p index.js dist/aframe-piechart-component.min.js", 11 | "lint": "semistandard -v | snazzy", 12 | "prepublish": "npm run dist", 13 | "preghpages": "npm run build && shx rm -rf gh-pages && shx mkdir gh-pages && shx cp -r examples/* gh-pages", 14 | "ghpages": "npm run preghpages && ghpages -p gh-pages", 15 | "start": "npm run dev", 16 | "test": "karma start ./tests/karma.conf.js", 17 | "test:firefox": "karma start ./tests/karma.conf.js --browsers Firefox", 18 | "test:chrome": "karma start ./tests/karma.conf.js --browsers Chrome" 19 | }, 20 | "repository": { 21 | "type": "git", 22 | "url": "git+https://github.com/fran-aguilar/a-framedc.git" 23 | }, 24 | "keywords": [ 25 | "aframe", 26 | "aframe-component", 27 | "aframe-vr", 28 | "vr", 29 | "mozvr", 30 | "webvr", 31 | "piechart" 32 | ], 33 | "author": "Jane John ", 34 | "license": "MIT", 35 | "bugs": { 36 | "url": "https://github.com/fran-aguilar/a-framedc/issues" 37 | }, 38 | "homepage": "https://github.com/fran-aguilar/a-framedc#readme", 39 | "devDependencies": { 40 | "aframe": "^0.4.0", 41 | "browserify": "^13.0.0", 42 | "budo": "^8.2.2", 43 | "chai": "^3.4.1", 44 | "chai-shallow-deep-equal": "^1.3.0", 45 | "ghpages": "^0.0.8", 46 | "karma": "^0.13.15", 47 | "karma-browserify": "^4.4.2", 48 | "karma-chai-shallow-deep-equal": "0.0.4", 49 | "karma-chrome-launcher": "2.0.0", 50 | "karma-env-preprocessor": "^0.1.1", 51 | "karma-firefox-launcher": "^0.1.7", 52 | "karma-mocha": "^0.2.1", 53 | "karma-mocha-reporter": "^1.1.3", 54 | "karma-sinon-chai": "^1.1.0", 55 | "mocha": "^2.3.4", 56 | "randomcolor": "^0.4.4", 57 | "semistandard": "^8.0.0", 58 | "shelljs": "^0.7.0", 59 | "sinon": "^1.17.5", 60 | "sinon-chai": "^2.8.0", 61 | "shx": "^0.1.1", 62 | "snazzy": "^4.0.0", 63 | "webpack": "^1.13.0" 64 | }, 65 | "semistandard": { 66 | "ignore": [ 67 | "examples/build.js", 68 | "dist/**" 69 | ] 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /src/components/piechart/tests/__init.test.js: -------------------------------------------------------------------------------- 1 | /* global sinon, setup, teardown */ 2 | 3 | /** 4 | * __init.test.js is run before every test case. 5 | */ 6 | window.debug = true; 7 | var AScene = require('aframe').AScene 8 | 9 | navigator.getVRDisplays = function () { 10 | var resolvePromise = Promise.resolve(); 11 | var mockVRDisplay = { 12 | requestPresent: resolvePromise, 13 | exitPresent: resolvePromise, 14 | getPose: function () { return {orientation: null, position: null}; }, 15 | requestAnimationFrame: function () { return 1; } 16 | }; 17 | return Promise.resolve([mockVRDisplay]); 18 | }; 19 | 20 | setup(function () { 21 | this.sinon = sinon.sandbox.create(); 22 | // Stubs to not create a WebGL context since Travis CI runs headless. 23 | this.sinon.stub(AScene.prototype, 'render'); 24 | this.sinon.stub(AScene.prototype, 'resize'); 25 | this.sinon.stub(AScene.prototype, 'setupRenderer'); 26 | }); 27 | 28 | teardown(function () { 29 | // Clean up any attached elements. 30 | var attachedEls = ['canvas', 'a-assets', 'a-scene']; 31 | var els = document.querySelectorAll(attachedEls.join(',')); 32 | for (var i = 0; i < els.length; i++) { 33 | els[i].parentNode.removeChild(els[i]); 34 | } 35 | this.sinon.restore(); 36 | }); 37 | -------------------------------------------------------------------------------- /src/components/piechart/tests/helpers.js: -------------------------------------------------------------------------------- 1 | /* global suite */ 2 | 3 | /** 4 | * Helper method to create a scene, create an entity, add entity to scene, 5 | * add scene to document. 6 | * 7 | * @returns {object} An `` element. 8 | */ 9 | module.exports.entityFactory = function (opts) { 10 | var scene = document.createElement('a-scene'); 11 | var assets = document.createElement('a-assets'); 12 | var entity = document.createElement('a-entity'); 13 | scene.appendChild(assets); 14 | scene.appendChild(entity); 15 | 16 | opts = opts || {}; 17 | 18 | if (opts.assets) { 19 | opts.assets.forEach(function (asset) { 20 | assets.appendChild(asset); 21 | }); 22 | } 23 | 24 | document.body.appendChild(scene); 25 | return entity; 26 | }; 27 | 28 | /** 29 | * Creates and attaches a mixin element (and an `` element if necessary). 30 | * 31 | * @param {string} id - ID of mixin. 32 | * @param {object} obj - Map of component names to attribute values. 33 | * @param {Element} scene - Indicate which scene to apply mixin to if necessary. 34 | * @returns {object} An attached `` element. 35 | */ 36 | module.exports.mixinFactory = function (id, obj, scene) { 37 | var mixinEl = document.createElement('a-mixin'); 38 | mixinEl.setAttribute('id', id); 39 | Object.keys(obj).forEach(function (componentName) { 40 | mixinEl.setAttribute(componentName, obj[componentName]); 41 | }); 42 | 43 | var assetsEl = scene ? scene.querySelector('a-assets') : document.querySelector('a-assets'); 44 | assetsEl.appendChild(mixinEl); 45 | 46 | return mixinEl; 47 | }; 48 | 49 | /** 50 | * Test that is only run locally and is skipped on CI. 51 | */ 52 | module.exports.getSkipCISuite = function () { 53 | if (window.__env__.TEST_ENV === 'ci') { 54 | return suite.skip; 55 | } else { 56 | return suite; 57 | } 58 | }; 59 | -------------------------------------------------------------------------------- /src/components/piechart/tests/index.test.js: -------------------------------------------------------------------------------- 1 | /* global assert, setup, suite, test */ 2 | require('aframe'); 3 | require('../index.js'); 4 | var entityFactory = require('./helpers').entityFactory; 5 | 6 | suite('piechart component', function () { 7 | var component; 8 | var el; 9 | 10 | setup(function (done) { 11 | el = entityFactory(); 12 | el.addEventListener('componentinitialized', function (evt) { 13 | if (evt.detail.name !== 'piechart') { return; } 14 | component = el.components['piechart']; 15 | done(); 16 | }); 17 | el.setAttribute('piechart', {}); 18 | }); 19 | 20 | suite('foo property', function () { 21 | test('is good', function () { 22 | assert.equal(1, 1); 23 | }); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/components/piechart/tests/karma.conf.js: -------------------------------------------------------------------------------- 1 | // Karma configuration. 2 | module.exports = function (config) { 3 | config.set({ 4 | basePath: '../', 5 | browserify: { 6 | debug: true, 7 | paths: ['./'] 8 | }, 9 | browsers: ['Firefox', 'Chrome'], 10 | client: { 11 | captureConsole: true, 12 | mocha: {ui: 'tdd'} 13 | }, 14 | envPreprocessor: ['TEST_ENV'], 15 | files: [ 16 | // Define test files. 17 | {pattern: 'tests/**/*.test.js'}, 18 | // Serve test assets. 19 | {pattern: 'tests/assets/**/*', included: false, served: true} 20 | ], 21 | frameworks: ['mocha', 'sinon-chai', 'chai-shallow-deep-equal', 'browserify'], 22 | preprocessors: {'tests/**/*.js': ['browserify', 'env']}, 23 | reporters: ['mocha'] 24 | }); 25 | }; 26 | -------------------------------------------------------------------------------- /src/components/smoothcurvechart/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2017 Jane John <jj@foo.com> 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /src/components/smoothcurvechart/README.md: -------------------------------------------------------------------------------- 1 | ## aframe-smoothcurvechart-component 2 | 3 | A Smoothcurvechart component for A-Frame. 4 | 5 | For [A-Frame](https://aframe.io). 6 | 7 | ### API 8 | 9 | | Property | Description | Default Value | 10 | | -------- | ----------- | ------------- | 11 | | | | | 12 | 13 | ### Installation 14 | 15 | #### Browser 16 | 17 | Install and use by directly including the [browser files](dist): 18 | 19 | ```html 20 | 21 | My A-Frame Scene 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | ``` 32 | 33 | 34 | 43 | 44 | #### npm 45 | 46 | Install via npm: 47 | 48 | ```bash 49 | npm install aframe-smoothcurvechart-component 50 | ``` 51 | 52 | Then require and use. 53 | 54 | ```js 55 | require('aframe'); 56 | require('aframe-smoothcurvechart-component'); 57 | ``` 58 | -------------------------------------------------------------------------------- /src/components/smoothcurvechart/index.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fran-aguilar/a-framedc/40df9c132cbb2888d08372a59564a39c1c356dc1/src/components/smoothcurvechart/index.js -------------------------------------------------------------------------------- /src/components/smoothcurvechart/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "smoothcurvechart-component", 3 | "version": "1.0.0", 4 | "description": "A Smoothcurvechart component for A-Frame.", 5 | "main": "index.js", 6 | "cdn": "dist/smoothcurvechart-component.min.js", 7 | "scripts": { 8 | "build": "browserify examples/main.js -o examples/build.js", 9 | "dev": "budo examples/main.js:build.js --dir examples --port 8000 --live --open", 10 | "dist": "webpack index.js dist/smoothcurvechart-component.js && webpack -p index.js dist/smoothcurvechart-component.min.js", 11 | "lint": "semistandard -v | snazzy", 12 | "prepublish": "npm run dist", 13 | "preghpages": "npm run build && shx rm -rf gh-pages && shx mkdir gh-pages && shx cp -r examples/* gh-pages", 14 | "ghpages": "npm run preghpages && ghpages -p gh-pages", 15 | "start": "npm run dev", 16 | "test": "karma start ./tests/karma.conf.js", 17 | "test:firefox": "karma start ./tests/karma.conf.js --browsers Firefox", 18 | "test:chrome": "karma start ./tests/karma.conf.js --browsers Chrome" 19 | }, 20 | "repository": { 21 | "type": "git", 22 | "url": "git+https://github.com/fran-aguilar/a-framedc.git" 23 | }, 24 | "keywords": [ 25 | "aframe", 26 | "aframe-component", 27 | "aframe-vr", 28 | "vr", 29 | "mozvr", 30 | "webvr", 31 | "smoothcurvechart" 32 | ], 33 | "author": "Jane John ", 34 | "license": "MIT", 35 | "bugs": { 36 | "url": "https://github.com/fran-aguilar/a-framedc/issues" 37 | }, 38 | "homepage": "https://github.com/fran-aguilar/a-framedc#readme", 39 | "devDependencies": { 40 | "aframe": "^0.4.0", 41 | "browserify": "^13.0.0", 42 | "budo": "^8.2.2", 43 | "chai": "^3.4.1", 44 | "chai-shallow-deep-equal": "^1.3.0", 45 | "ghpages": "^0.0.8", 46 | "karma": "^0.13.15", 47 | "karma-browserify": "^4.4.2", 48 | "karma-chai-shallow-deep-equal": "0.0.4", 49 | "karma-chrome-launcher": "2.0.0", 50 | "karma-env-preprocessor": "^0.1.1", 51 | "karma-firefox-launcher": "^0.1.7", 52 | "karma-mocha": "^0.2.1", 53 | "karma-mocha-reporter": "^1.1.3", 54 | "karma-sinon-chai": "^1.1.0", 55 | "mocha": "^2.3.4", 56 | "randomcolor": "^0.4.4", 57 | "semistandard": "^8.0.0", 58 | "shelljs": "^0.7.0", 59 | "sinon": "^1.17.5", 60 | "sinon-chai": "^2.8.0", 61 | "shx": "^0.1.1", 62 | "snazzy": "^4.0.0", 63 | "webpack": "^1.13.0" 64 | }, 65 | "semistandard": { 66 | "ignore": [ 67 | "examples/build.js", 68 | "dist/**" 69 | ] 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /src/components/smoothcurvechart/tests/__init.test.js: -------------------------------------------------------------------------------- 1 | /* global sinon, setup, teardown */ 2 | 3 | /** 4 | * __init.test.js is run before every test case. 5 | */ 6 | window.debug = true; 7 | var AScene = require('aframe').AScene 8 | 9 | navigator.getVRDisplays = function () { 10 | var resolvePromise = Promise.resolve(); 11 | var mockVRDisplay = { 12 | requestPresent: resolvePromise, 13 | exitPresent: resolvePromise, 14 | getPose: function () { return {orientation: null, position: null}; }, 15 | requestAnimationFrame: function () { return 1; } 16 | }; 17 | return Promise.resolve([mockVRDisplay]); 18 | }; 19 | 20 | setup(function () { 21 | this.sinon = sinon.sandbox.create(); 22 | // Stubs to not create a WebGL context since Travis CI runs headless. 23 | this.sinon.stub(AScene.prototype, 'render'); 24 | this.sinon.stub(AScene.prototype, 'resize'); 25 | this.sinon.stub(AScene.prototype, 'setupRenderer'); 26 | }); 27 | 28 | teardown(function () { 29 | // Clean up any attached elements. 30 | var attachedEls = ['canvas', 'a-assets', 'a-scene']; 31 | var els = document.querySelectorAll(attachedEls.join(',')); 32 | for (var i = 0; i < els.length; i++) { 33 | els[i].parentNode.removeChild(els[i]); 34 | } 35 | this.sinon.restore(); 36 | }); 37 | -------------------------------------------------------------------------------- /src/components/smoothcurvechart/tests/helpers.js: -------------------------------------------------------------------------------- 1 | /* global suite */ 2 | 3 | /** 4 | * Helper method to create a scene, create an entity, add entity to scene, 5 | * add scene to document. 6 | * 7 | * @returns {object} An `` element. 8 | */ 9 | module.exports.entityFactory = function (opts) { 10 | var scene = document.createElement('a-scene'); 11 | var assets = document.createElement('a-assets'); 12 | var entity = document.createElement('a-entity'); 13 | scene.appendChild(assets); 14 | scene.appendChild(entity); 15 | 16 | opts = opts || {}; 17 | 18 | if (opts.assets) { 19 | opts.assets.forEach(function (asset) { 20 | assets.appendChild(asset); 21 | }); 22 | } 23 | 24 | document.body.appendChild(scene); 25 | return entity; 26 | }; 27 | 28 | /** 29 | * Creates and attaches a mixin element (and an `` element if necessary). 30 | * 31 | * @param {string} id - ID of mixin. 32 | * @param {object} obj - Map of component names to attribute values. 33 | * @param {Element} scene - Indicate which scene to apply mixin to if necessary. 34 | * @returns {object} An attached `` element. 35 | */ 36 | module.exports.mixinFactory = function (id, obj, scene) { 37 | var mixinEl = document.createElement('a-mixin'); 38 | mixinEl.setAttribute('id', id); 39 | Object.keys(obj).forEach(function (componentName) { 40 | mixinEl.setAttribute(componentName, obj[componentName]); 41 | }); 42 | 43 | var assetsEl = scene ? scene.querySelector('a-assets') : document.querySelector('a-assets'); 44 | assetsEl.appendChild(mixinEl); 45 | 46 | return mixinEl; 47 | }; 48 | 49 | /** 50 | * Test that is only run locally and is skipped on CI. 51 | */ 52 | module.exports.getSkipCISuite = function () { 53 | if (window.__env__.TEST_ENV === 'ci') { 54 | return suite.skip; 55 | } else { 56 | return suite; 57 | } 58 | }; 59 | -------------------------------------------------------------------------------- /src/components/smoothcurvechart/tests/index.test.js: -------------------------------------------------------------------------------- 1 | /* global assert, setup, suite, test */ 2 | require('aframe'); 3 | require('../index.js'); 4 | var entityFactory = require('./helpers').entityFactory; 5 | 6 | suite('smoothcurvechart component', function () { 7 | var component; 8 | var el; 9 | 10 | setup(function (done) { 11 | el = entityFactory(); 12 | el.addEventListener('componentinitialized', function (evt) { 13 | if (evt.detail.name !== 'smoothcurvechart') { return; } 14 | component = el.components['smoothcurvechart']; 15 | done(); 16 | }); 17 | el.setAttribute('smoothcurvechart', {}); 18 | }); 19 | 20 | suite('foo property', function () { 21 | test('is good', function () { 22 | assert.equal(1, 1); 23 | }); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/components/smoothcurvechart/tests/karma.conf.js: -------------------------------------------------------------------------------- 1 | // Karma configuration. 2 | module.exports = function (config) { 3 | config.set({ 4 | basePath: '../', 5 | browserify: { 6 | debug: true, 7 | paths: ['./'] 8 | }, 9 | browsers: ['Firefox', 'Chrome'], 10 | client: { 11 | captureConsole: true, 12 | mocha: {ui: 'tdd'} 13 | }, 14 | envPreprocessor: ['TEST_ENV'], 15 | files: [ 16 | // Define test files. 17 | {pattern: 'tests/**/*.test.js'}, 18 | // Serve test assets. 19 | {pattern: 'tests/assets/**/*', included: false, served: true} 20 | ], 21 | frameworks: ['mocha', 'sinon-chai', 'chai-shallow-deep-equal', 'browserify'], 22 | preprocessors: {'tests/**/*.js': ['browserify', 'env']}, 23 | reporters: ['mocha'] 24 | }); 25 | }; 26 | -------------------------------------------------------------------------------- /src/components/title/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2017 Jane John <jj@foo.com> 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /src/components/title/README.md: -------------------------------------------------------------------------------- 1 | ## aframe-title-component 2 | 3 | A Title component for A-Frame. 4 | 5 | For [A-Frame](https://aframe.io). 6 | 7 | ### API 8 | 9 | | Property | Description | Default Value | 10 | | -------- | ----------- | ------------- | 11 | | | | | 12 | 13 | ### Installation 14 | 15 | #### Browser 16 | 17 | Install and use by directly including the [browser files](dist): 18 | 19 | ```html 20 | 21 | My A-Frame Scene 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | ``` 32 | 33 | 34 | 43 | 44 | #### npm 45 | 46 | Install via npm: 47 | 48 | ```bash 49 | npm install aframe-title-component 50 | ``` 51 | 52 | Then require and use. 53 | 54 | ```js 55 | require('aframe'); 56 | require('aframe-title-component'); 57 | ``` 58 | -------------------------------------------------------------------------------- /src/components/title/index.js: -------------------------------------------------------------------------------- 1 | /* global AFRAME */ 2 | 3 | if (typeof AFRAME === 'undefined') { 4 | throw new Error('Component attempted to register before AFRAME was available.'); 5 | } 6 | 7 | /** 8 | * Title component for A-Frame. 9 | */ 10 | AFRAME.registerComponent('title', { 11 | schema: { 12 | caption: { default: "", type: "string" }, 13 | width: { default: 7, type: "number" }, 14 | }, 15 | 16 | /** 17 | * Set if component needs multiple instancing. 18 | */ 19 | multiple: false, 20 | 21 | /** 22 | * Called when component is attached and when component data changes. 23 | * Generally modifies the entity based on the data. 24 | */ 25 | update: function (oldData) { 26 | var data = this.data; 27 | var texto; 28 | 29 | texto = this.el; 30 | 31 | var TEXT_WIDTH = data.width; 32 | texto.setAttribute("text", { 33 | color: "#000000", 34 | side: "double", 35 | value: data.caption, 36 | align: "center", 37 | width: TEXT_WIDTH, 38 | wrapCount: 30 39 | }); 40 | //var labelpos = { x: 0, y: 1, z: 0 }; 41 | ////texto.setAttribute('geometry',{primitive: 'plane', width: 'auto', height: 'auto'}); 42 | //texto.setAttribute('position', labelpos); 43 | }, 44 | /** 45 | * Called when a component is removed (e.g., via removeAttribute). 46 | * Generally undoes all modifications to the entity. 47 | */ 48 | remove: function () { }, 49 | 50 | /** 51 | * Called on each scene tick. 52 | */ 53 | // tick: function (t) { }, 54 | 55 | /** 56 | * Called when entity pauses. 57 | * Use to stop or remove any dynamic or background behavior such as events. 58 | */ 59 | pause: function () { }, 60 | 61 | /** 62 | * Called when entity resumes. 63 | * Use to continue or add any dynamic or background behavior such as events. 64 | */ 65 | play: function () { } 66 | }); 67 | -------------------------------------------------------------------------------- /src/components/title/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "title-component", 3 | "version": "1.0.0", 4 | "description": "A Title component for A-Frame.", 5 | "main": "index.js", 6 | "cdn": "dist/title-component.min.js", 7 | "scripts": { 8 | "build": "browserify examples/main.js -o examples/build.js", 9 | "dev": "budo examples/main.js:build.js --dir examples --port 8000 --live --open", 10 | "dist": "webpack index.js dist/title-component.js && webpack -p index.js dist/title-component.min.js", 11 | "lint": "semistandard -v | snazzy", 12 | "prepublish": "npm run dist", 13 | "preghpages": "npm run build && shx rm -rf gh-pages && shx mkdir gh-pages && shx cp -r examples/* gh-pages", 14 | "ghpages": "npm run preghpages && ghpages -p gh-pages", 15 | "start": "npm run dev", 16 | "test": "karma start ./tests/karma.conf.js", 17 | "test:firefox": "karma start ./tests/karma.conf.js --browsers Firefox", 18 | "test:chrome": "karma start ./tests/karma.conf.js --browsers Chrome" 19 | }, 20 | "repository": { 21 | "type": "git", 22 | "url": "git+https://github.com/fran-aguilar/a-framedc.git" 23 | }, 24 | "keywords": [ 25 | "aframe", 26 | "aframe-component", 27 | "aframe-vr", 28 | "vr", 29 | "mozvr", 30 | "webvr", 31 | "title" 32 | ], 33 | "author": "Jane John ", 34 | "license": "MIT", 35 | "bugs": { 36 | "url": "https://github.com/fran-aguilar/a-framedc/issues" 37 | }, 38 | "homepage": "https://github.com/fran-aguilar/a-framedc#readme", 39 | "devDependencies": { 40 | "aframe": "^0.4.0", 41 | "browserify": "^13.0.0", 42 | "budo": "^8.2.2", 43 | "chai": "^3.4.1", 44 | "chai-shallow-deep-equal": "^1.3.0", 45 | "ghpages": "^0.0.8", 46 | "karma": "^0.13.15", 47 | "karma-browserify": "^4.4.2", 48 | "karma-chai-shallow-deep-equal": "0.0.4", 49 | "karma-chrome-launcher": "2.0.0", 50 | "karma-env-preprocessor": "^0.1.1", 51 | "karma-firefox-launcher": "^0.1.7", 52 | "karma-mocha": "^0.2.1", 53 | "karma-mocha-reporter": "^1.1.3", 54 | "karma-sinon-chai": "^1.1.0", 55 | "mocha": "^2.3.4", 56 | "randomcolor": "^0.4.4", 57 | "semistandard": "^8.0.0", 58 | "shelljs": "^0.7.0", 59 | "sinon": "^1.17.5", 60 | "sinon-chai": "^2.8.0", 61 | "shx": "^0.1.1", 62 | "snazzy": "^4.0.0", 63 | "webpack": "^1.13.0" 64 | }, 65 | "semistandard": { 66 | "ignore": [ 67 | "examples/build.js", 68 | "dist/**" 69 | ] 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /src/components/title/tests/__init.test.js: -------------------------------------------------------------------------------- 1 | /* global sinon, setup, teardown */ 2 | 3 | /** 4 | * __init.test.js is run before every test case. 5 | */ 6 | window.debug = true; 7 | var AScene = require('aframe').AScene 8 | 9 | navigator.getVRDisplays = function () { 10 | var resolvePromise = Promise.resolve(); 11 | var mockVRDisplay = { 12 | requestPresent: resolvePromise, 13 | exitPresent: resolvePromise, 14 | getPose: function () { return {orientation: null, position: null}; }, 15 | requestAnimationFrame: function () { return 1; } 16 | }; 17 | return Promise.resolve([mockVRDisplay]); 18 | }; 19 | 20 | setup(function () { 21 | this.sinon = sinon.sandbox.create(); 22 | // Stubs to not create a WebGL context since Travis CI runs headless. 23 | this.sinon.stub(AScene.prototype, 'render'); 24 | this.sinon.stub(AScene.prototype, 'resize'); 25 | this.sinon.stub(AScene.prototype, 'setupRenderer'); 26 | }); 27 | 28 | teardown(function () { 29 | // Clean up any attached elements. 30 | var attachedEls = ['canvas', 'a-assets', 'a-scene']; 31 | var els = document.querySelectorAll(attachedEls.join(',')); 32 | for (var i = 0; i < els.length; i++) { 33 | els[i].parentNode.removeChild(els[i]); 34 | } 35 | this.sinon.restore(); 36 | }); 37 | -------------------------------------------------------------------------------- /src/components/title/tests/helpers.js: -------------------------------------------------------------------------------- 1 | /* global suite */ 2 | 3 | /** 4 | * Helper method to create a scene, create an entity, add entity to scene, 5 | * add scene to document. 6 | * 7 | * @returns {object} An `` element. 8 | */ 9 | module.exports.entityFactory = function (opts) { 10 | var scene = document.createElement('a-scene'); 11 | var assets = document.createElement('a-assets'); 12 | var entity = document.createElement('a-entity'); 13 | scene.appendChild(assets); 14 | scene.appendChild(entity); 15 | 16 | opts = opts || {}; 17 | 18 | if (opts.assets) { 19 | opts.assets.forEach(function (asset) { 20 | assets.appendChild(asset); 21 | }); 22 | } 23 | 24 | document.body.appendChild(scene); 25 | return entity; 26 | }; 27 | 28 | /** 29 | * Creates and attaches a mixin element (and an `` element if necessary). 30 | * 31 | * @param {string} id - ID of mixin. 32 | * @param {object} obj - Map of component names to attribute values. 33 | * @param {Element} scene - Indicate which scene to apply mixin to if necessary. 34 | * @returns {object} An attached `` element. 35 | */ 36 | module.exports.mixinFactory = function (id, obj, scene) { 37 | var mixinEl = document.createElement('a-mixin'); 38 | mixinEl.setAttribute('id', id); 39 | Object.keys(obj).forEach(function (componentName) { 40 | mixinEl.setAttribute(componentName, obj[componentName]); 41 | }); 42 | 43 | var assetsEl = scene ? scene.querySelector('a-assets') : document.querySelector('a-assets'); 44 | assetsEl.appendChild(mixinEl); 45 | 46 | return mixinEl; 47 | }; 48 | 49 | /** 50 | * Test that is only run locally and is skipped on CI. 51 | */ 52 | module.exports.getSkipCISuite = function () { 53 | if (window.__env__.TEST_ENV === 'ci') { 54 | return suite.skip; 55 | } else { 56 | return suite; 57 | } 58 | }; 59 | -------------------------------------------------------------------------------- /src/components/title/tests/index.test.js: -------------------------------------------------------------------------------- 1 | /* global assert, setup, suite, test */ 2 | require('aframe'); 3 | require('../index.js'); 4 | var entityFactory = require('./helpers').entityFactory; 5 | 6 | suite('title component', function () { 7 | var component; 8 | var el; 9 | 10 | setup(function (done) { 11 | el = entityFactory(); 12 | el.addEventListener('componentinitialized', function (evt) { 13 | if (evt.detail.name !== 'title') { return; } 14 | component = el.components['title']; 15 | done(); 16 | }); 17 | el.setAttribute('title', {}); 18 | }); 19 | 20 | suite('foo property', function () { 21 | test('is good', function () { 22 | assert.equal(1, 1); 23 | }); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/components/title/tests/karma.conf.js: -------------------------------------------------------------------------------- 1 | // Karma configuration. 2 | module.exports = function (config) { 3 | config.set({ 4 | basePath: '../', 5 | browserify: { 6 | debug: true, 7 | paths: ['./'] 8 | }, 9 | browsers: ['Firefox', 'Chrome'], 10 | client: { 11 | captureConsole: true, 12 | mocha: {ui: 'tdd'} 13 | }, 14 | envPreprocessor: ['TEST_ENV'], 15 | files: [ 16 | // Define test files. 17 | {pattern: 'tests/**/*.test.js'}, 18 | // Serve test assets. 19 | {pattern: 'tests/assets/**/*', included: false, served: true} 20 | ], 21 | frameworks: ['mocha', 'sinon-chai', 'chai-shallow-deep-equal', 'browserify'], 22 | preprocessors: {'tests/**/*.js': ['browserify', 'env']}, 23 | reporters: ['mocha'] 24 | }); 25 | }; 26 | -------------------------------------------------------------------------------- /webpack-dev.config.js: -------------------------------------------------------------------------------- 1 | 2 | var path = require('path'); 3 | var webpack = require('webpack'); 4 | var minimizeOpt = process.argv.indexOf('--optimize-minimize') !== -1; 5 | 6 | 7 | module.exports = { 8 | entry: "./src/index.js", 9 | output: { 10 | path: path.resolve(__dirname, './dist'), 11 | filename: minimizeOpt ? 'aframedc.min.js' : 'aframedc.js', 12 | library: 'aframedc', 13 | libraryTarget: 'umd' 14 | }, 15 | devServer: { 16 | host: '0.0.0.0', 17 | disableHostCheck: true 18 | } 19 | }; 20 | if (minimizeOpt) { 21 | module.exports.plugins = []; 22 | module.exports.plugins.push(new webpack.optimize.UglifyJsPlugin()); 23 | } 24 | --------------------------------------------------------------------------------