Skip to content

Commit

Permalink
Merge branch 'master' into 2737-doc-links
Browse files Browse the repository at this point in the history
  • Loading branch information
chasenlehara committed Jul 26, 2017
2 parents ccda212 + 7800ec9 commit 6832ff7
Show file tree
Hide file tree
Showing 153 changed files with 9,785 additions and 1,716 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Expand Up @@ -4,9 +4,11 @@ dist/
*.orig
util/can.*.js
*node_modules*
npm-debug.log
doc/
*.DS_Store
.idea
.vscode/*
test/pluginified/latest.js
docco
test/builders/steal-tools/dist/
Expand Down
4 changes: 2 additions & 2 deletions .travis.yml
@@ -1,6 +1,6 @@
sudo: false
language: node_js
node_js: node
node_js: "6"
before_install:
- ./firefox-allow-popups.sh
- "export DISPLAY=:99.0"
Expand All @@ -17,4 +17,4 @@ before_script:
- sleep 2
addons:
sauce_connect: true
firefox: "51.0"
firefox: "53.0"
12 changes: 11 additions & 1 deletion Makefile
Expand Up @@ -10,17 +10,27 @@ publish-docs:
git add -f node_modules/es6-promise
git add -f node_modules/steal
git add -f node_modules/steal-*
git add -f node_modules/when
git add -f node_modules/jquery
git add -f node_modules/jquery-ui
git add -f node_modules/funcunit
git add -f node_modules/syn
# React Deps Start
git add -f node_modules/react
git add -f node_modules/react-dom
git add -f node_modules/react-view-model
git add -f node_modules/create-react-class
git add -f node_modules/fbjs
git add -f node_modules/loose-envify
git add -f node_modules/object-assign
git add -f node_modules/prop-types
# React Deps End
git add -f node_modules/socket.io-client
git add -f node_modules/feathers/package.json
git add -f node_modules/feathers-authentication-client/package.json
git add -f node_modules/feathers-hooks/package.json
git add -f node_modules/feathers-rest/package.json
git add -f node_modules/feathers-socketio/package.json
git add -f node_modules/validate.js/package.json
git checkout origin/gh-pages -- CNAME
git checkout origin/gh-pages -- release/
git commit -m "Publish docs"
Expand Down
44 changes: 36 additions & 8 deletions build.js
@@ -1,23 +1,51 @@
var stealTools = require("steal-tools");
var globalJS = require("steal-tools/lib/build/helpers/global").js;



var ignoreModuleNamesStartingWith = [
"jquery",
"kefir",
'ms-signalr-client',
'prop-types',
'fbjs',
'create-react-class'
];
var ignoreModuleNames = [
'react'
];

var baseNormalize = globalJS.normalize();
var ignoreModules = [function(name){
if(name.indexOf("jquery") === 0 || name.indexOf("kefir") === 0 ||
name.indexOf('validate.js') === 0 || name.indexOf('ms-signalr-client') === 0) {
return true;
} else {
return false;
}
var foundMatch = ignoreModuleNamesStartingWith.some(function(matchName){
return name.indexOf(matchName) === 0;
})
if(foundMatch) {
return true;
}

foundMatch = ignoreModuleNames.some(function(matchName){
return name.indexOf(matchName+"@") === 0;
});
if(foundMatch) {
return true;
}





return false;
}];
var exportsMap = {
"jquery": "jQuery",
"can-util/namespace": "can",
"kefir": "Kefir",
"validate.js": "validate"
"validate.js": "validate",
"react": "React"
};
stealTools.export({
system: {
steal: {
config: __dirname + "/package.json!npm",
main: "can/all"
},
Expand Down
33 changes: 17 additions & 16 deletions contributing.md
@@ -1,25 +1,26 @@
<!--
@page contributing How to Contribute
@parent guides 4
@body
-->
# Contributing to CanJS

Thank you for contributing to CanJS! If you need any help setting up a CanJS development environment and fixing CanJS bugs, please reach out to us on the [canjs/canjs Gitter channel](https://gitter.im/canjs/canjs) or email (contact@bitovi.com). We will happily walk you through setting up your environment, creating a test, and submitting a pull request. Here is a video showing how to contribute to CanJS:

<iframe width="662" height="372" src="https://www.youtube.com/embed/PRuueWqnpIw" frameborder="0" allowfullscreen></iframe>

For more details we have the following more in-depth contribution guides:

- [guides/contributing/bug-report Report a bug]
- [guides/contributing/feature-suggestion Suggest a feature]
- [guides/contributing/code Code changes]
- [guides/contributing/documentation Documentation improvements]
- [Create a plugin](https://donejs.com/plugin.html)
- [guides/contributing/evangelism Evangelism - Blog, meetup and conference talks]
- [guides/contributing/releases Releases - Maintaining CanJS]
For more details, check out the [contribution guide on CanJS.com](https://canjs.com/doc/guides/contribute.html) for information on:

- [Code of Conduct](https://canjs.com/doc/guides/contribute.html#CodeofConduct)
- [Getting Help](https://canjs.com/doc/guides/contribute.html#GettingHelp)
- [Project Organization](https://canjs.com/doc/guides/contributing/project-organization.html)
- [Reporting Bugs](https://canjs.com/doc/guides/contributing/bug-report.html)
- [Suggesting Features](https://canjs.com/doc/guides/contributing/feature-suggestion.html)
- [Finding Ways to Contribute](https://canjs.com/doc/guides/contributing/finding-ways-to-contribute.html)
- [Developing Locally](https://canjs.com/doc/guides/contributing/developing-locally.html)
- [Changing the Code](https://canjs.com/doc/guides/contributing/code.html)
- [Improving the Docs & Site](https://canjs.com/doc/guides/contributing/documentation.html)
- [Making a New Package](https://canjs.com/doc/guides/contributing/adding-ecosystem-modules.html)
- [API Design Guidelines](https://canjs.com/doc/guides/contributing/api-design-guidelines.html)
- [Releasing CanJS](https://canjs.com/doc/guides/contributing/releases.html)
- [Updating the Site](https://canjs.com/doc/guides/contributing/updating-the-site.html)
- [Evangelism](https://canjs.com/doc/guides/contributing/evangelism.html)

## 3.0 Changes

In 3.0, nearly every module has its own repository. All code changes should go there. Issues can be submitted to `canjs/canjs`, but once we know the root of the issue, we will move it to a specific repository.

128 changes: 63 additions & 65 deletions demos/can-connect/constructor-store.html
@@ -1,5 +1,5 @@
<body>
<button id='maker'>Create Todo Editor</button>
<button id='maker'>Create Todo Editor</button>

<script src="../../node_modules/steal/steal.js">
import connect from "can-connect";
Expand All @@ -9,85 +9,83 @@
import fixture from "can-fixture";
import canEvent from "can-event";

// A connection that gets todos data
var todosConnection = connect([constructorStore,constructor,dataUrl,{
updatedInstance: function(instance, props){
Object.assign(instance, props);
}
}],{
// define a Todo type with can-event event binding support
var Todo = function(props) { Object.assign(this, props); };
Todo.prototype = canEvent;

// connection that retrieves todos data
var todosConnection = connect([constructorStore, constructor, dataUrl], {
url: "/todos",
instance: function(props) {
return Object.assign(props, canEvent);
},
serializeInstance: function(instance){
return {id: instance.id, name: instance.name}
return new Todo(props);
}
});

// Trap ajax requests to return and modify the following `todo` object.
// static todo data for this example
var todo = {
id: 5,
name: "do the dishes"
id: 5,
name: "do the dishes"
};

// mock HTTP requests for the `todo` endpoint.
fixture({
"GET /todos/{id}": function(){
return todo;
},
"PUT /todos/{id}": function(request){
todo.name = request.data.name;
return {name: request.data.name};
}
"GET /todos/{id}": function(){
return todo;
},
"PUT /todos/{id}": function(request){
todo.name = request.data.name;
return {name: request.data.name};
}
});

// generate element that edits a specified todo
var todoEditor = function(id){
var element = document.createElement('div');
var todo;

var update = function(){
element.firstChild.value = todo.name;
};

element.innerHTML = "<input/><button>X</button>";

todosConnection.get({id: id}).then(function(retrievedTodo){
todo = retrievedTodo;
todo.on("name", update);
todosConnection.addInstanceReference(todo);
update();
}).catch(function(e){debugger;});

// listen to remove
element.lastChild.onclick = function(){
todo.off("name", update);
todosConnection.deleteInstanceReference(todo);
element.parentNode.removeChild(element);
};

element.firstChild.onchange = function(){
todo.name = this.value;
todo.dispatch("name");
};

element.firstChild.onkeypress = function(ev){
if(ev.keyCode === 13) {
todo.name = this.value;
todo.dispatch("name");

todosConnection.save(todo);
}
};
var todo;
var element = document.createElement('div');
element.innerHTML = "<input/><button>X</button>";

var updateElement = function(){
element.firstChild.value = todo.name;
};

// get specified todo from connection
todosConnection.get({id: id}).then(function(retrievedTodo){
todo = retrievedTodo; // keep returned todo so we can listen to changes on it
updateElement(); // update input element with retrievedTodo info
todo.on("name", updateElement); // when todo name changes update input element
todosConnection.addInstanceReference(todo); // previous line is a new usage of todo, so increase reference count
});

// listen to 'X' button click
element.lastChild.onclick = function(){
todo.off("name", updateElement); // stop listening to todo name change
todosConnection.deleteInstanceReference(todo); // previous line removed a usage of todo, so reduce reference count
element.parentNode.removeChild(element); // remove this todoEditor from page
};

var updateData = function(newName) {
todo.name = newName; // update name on todo instance
todosConnection.save(todo); // save updated name to todo data source
todo.dispatch("name"); // send name changed signal
};

// listen to input element onchange events
element.firstChild.onchange = function(){
updateData(this.value);
};

// listen to input element keypress events
element.firstChild.onkeypress = function(ev){
if(ev.keyCode === 13) { // if the enter key was pressed
updateData(this.value);
}
};

return element;
return element;
};


document.getElementById('maker').onclick = function(){
var element = todoEditor(5);
document.body.appendChild(element);
document.body.appendChild(todoEditor(5));
};




</script>
</body>
2 changes: 1 addition & 1 deletion demos/can-stache/route-url.html
Expand Up @@ -27,7 +27,7 @@ <h1>Restaurants page</h1>

var route = require("can-route");

route(':page',{page: 'home'});
route('{page}',{page: 'home'});
route.ready();

var template = stache(document.getElementById('demo-html').innerHTML);
Expand Down
34 changes: 34 additions & 0 deletions demos/react-view-model/component.counter.html
@@ -0,0 +1,34 @@
<script src="../../node_modules/steal/steal.js" main="@empty" id="demo-source">
import React from "react";
import ReactDOM from "react-dom";
import Component from "react-view-model/component";
import DefineMap from "can-define/map/map";

class AppComponent extends Component {
render() {
return React.createElement('div', {
onClick: this.viewModel.increment.bind(this.viewModel)
}, 'Count: ', this.viewModel.count, ' (Click Me)');
// return (
// <div onClick={ this.viewModel.increment.bind(this.viewModel) }>
// Count: {this.viewModel.count} (Click Me)
// </div>
// );
}
}

AppComponent.ViewModel = DefineMap.extend("AppVM", {
count: {
type: "number",
value: 0
},
increment: function() {
return this.count++;
},
});

var div = document.createElement("div");
document.body.appendChild(div);
ReactDOM.render(React.createElement(AppComponent), div);
// ReactDOM.render(<AppComponent />, div);
</script>
36 changes: 36 additions & 0 deletions demos/react-view-model/component.name.html
@@ -0,0 +1,36 @@
<script src="../../node_modules/steal/steal.js" main="@empty" id="demo-source">
import React from "react";
import ReactDOM from "react-dom";
import Component from "react-view-model/component";
import DefineMap from "can-define/map/map";

class AppComponent extends Component {
render() {
return React.createElement("div", null, this.viewModel.name);
// return (
// <div>{this.viewModel.name}</div>
// );
}
}

AppComponent.ViewModel = DefineMap.extend("AppVM", {
first: {
type: "string",
value: "Christopher"
},
last: {
type: "string",
value: "Baker"
},
name: {
get() {
return this.first + " " + this.last;
},
},
});

var div = document.createElement("div");
document.body.appendChild(div);
ReactDOM.render(React.createElement(AppComponent), div);
// ReactDOM.render(<AppComponent />, div);
</script>

0 comments on commit 6832ff7

Please sign in to comment.