├── .gitignore ├── .sencha └── workspace │ ├── plugin.xml │ └── sencha.cfg ├── .travis.yml ├── CONTRIBUTORS.md ├── LICENSE ├── README.md ├── package.json └── packages └── deft ├── .jsduck ├── jsduck.template.json └── theme │ ├── favicon.ico │ └── resources │ ├── css │ └── theme.css │ ├── images │ ├── loading.gif │ ├── logo.png │ └── tabs.png │ └── js │ └── theme.js ├── .sencha └── package │ ├── build-impl.xml │ ├── build.properties │ ├── codegen.json │ ├── defaults.properties │ ├── find-cmd-impl.xml │ ├── init-impl.xml │ ├── js-impl.xml │ ├── plugin.xml │ ├── resources-impl.xml │ ├── sass-impl.xml │ ├── sencha.cfg │ ├── slice-impl.xml │ ├── sub-builds.xml │ └── testing.properties ├── Readme.md ├── build.properties ├── build.xml ├── jsduck.json ├── licenses └── Readme.md ├── overrides └── Readme.md ├── package.json ├── resources └── Readme.md ├── src ├── Readme.md ├── coffee │ ├── core │ │ └── Class.coffee │ ├── event │ │ ├── LiveEventBus.coffee │ │ └── LiveEventListener.coffee │ ├── ioc │ │ ├── DependencyProvider.coffee │ │ └── Injector.coffee │ ├── log │ │ └── Logger.coffee │ ├── mixin │ │ ├── Controllable.coffee │ │ └── Injectable.coffee │ ├── mvc │ │ ├── Application.coffee │ │ ├── ComponentSelector.coffee │ │ ├── ComponentSelectorListener.coffee │ │ ├── Observer.coffee │ │ └── ViewController.coffee │ ├── promise │ │ ├── Chain.coffee │ │ ├── Consequence.coffee │ │ ├── Deferred.coffee │ │ ├── Promise.coffee │ │ └── Resolver.coffee │ └── util │ │ └── Function.coffee └── js │ └── .gitkeep └── test ├── TestRunner.html ├── build.properties ├── build.xml ├── coffee ├── custom-assertions.coffee ├── ioc │ └── Injector.coffee ├── log │ └── Logger.coffee ├── mixin │ ├── Controllable.coffee │ └── Injectable.coffee ├── mvc │ └── ViewController.coffee ├── promise │ ├── Chain.coffee │ └── Promise.coffee └── util │ └── Function.coffee ├── js └── .gitkeep ├── karma ├── ext │ ├── 4.0.7.conf.js │ ├── 4.1.0.conf.js │ ├── 4.1.1a.conf.js │ ├── 4.2.0.conf.js │ └── 4.2.1.conf.js └── touch │ ├── 2.0.1.conf.js │ ├── 2.1.0.conf.js │ ├── 2.1.1.conf.js │ ├── 2.2.0.conf.js │ ├── 2.2.1.conf.js │ └── 2.3.0.conf.js ├── lib ├── chai-1.8.1 │ └── chai.js ├── chai-as-promised-4.1.0 │ └── chai-as-promised.js ├── mocha-1.17.0 │ ├── mocha.css │ └── mocha.js ├── mocha-as-promised-2.0.0 │ └── mocha-as-promised.js ├── promises-aplus-tests-2.0.3 │ └── promises-aplus-tests.js ├── setImmediate-1.0.1 │ └── setImmediate.js ├── sinon-1.7.3 │ └── sinon.js ├── sinon-chai-2.4.0 │ └── sinon-chai.js └── sinon-sencha-1.0.0 │ └── sinon-sencha.js └── support ├── browser.js └── custom-assertions.js /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .idea 3 | *.iml 4 | node_modules 5 | build 6 | packages/deft/build 7 | packages/deft/coverage 8 | packages/deft/docs 9 | packages/deft/src/js 10 | packages/deft/test/js 11 | -------------------------------------------------------------------------------- /.sencha/workspace/plugin.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.sencha/workspace/sencha.cfg: -------------------------------------------------------------------------------- 1 | #Mon, 17 Jun 2013 21:55:08 +1200 2 | # ----------------------------------------------------------------------------- 3 | # This file contains configuration options that apply to all applications in 4 | # the workspace. By convention, these options start with "workspace." but any 5 | # option can be set here. Options specified in an application's sencha.cfg will 6 | # take priority over those values contained in this file. These options will 7 | # take priority over configuration values in Sencha Cmd or a framework plugin. 8 | 9 | # ----------------------------------------------------------------------------- 10 | # This configuration property (if set) is included by default in all compile 11 | # commands executed according to this formulation: 12 | # 13 | # sencha compile -classpath=...,${framework.classpath},${workspace.classpath},${app.classpath} 14 | 15 | #workspace.classpath= 16 | 17 | #------------------------------------------------------------------------------ 18 | # This is the folder for build outputs in the workspace 19 | 20 | workspace.build.dir=${workspace.dir}/build 21 | 22 | #------------------------------------------------------------------------------ 23 | # This folder contains all generated and extracted packages. 24 | 25 | workspace.packages.dir=${workspace.dir}/packages 26 | 27 | workspace.theme.dir=${workspace.packages.dir}/${args.themeName} 28 | 29 | # ============================================================================= 30 | # Customizations go below this divider to avoid merge conflicts on upgrade 31 | # ============================================================================= 32 | 33 | workspace.cmd.version=4.0.1.45 34 | 35 | #------------------------------------------------------------------------------ 36 | # This folder should contain a copy of Sencha ExtJS 37 | 38 | ext.dir=${workspace.dir}/../ext 39 | 40 | #------------------------------------------------------------------------------ 41 | # This folder should contain a copy of Sencha Touch 42 | 43 | touch.dir=${workspace.dir}/../touch 44 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - 0.8 4 | env: 5 | - DEFT_SENCHA_CMD_VERSION="4.0.1.45" 6 | before_script: 7 | # Framebuffer for Firefox 8 | - "export DISPLAY=:99.0" 9 | - "sh -e /etc/init.d/xvfb start" 10 | # Install JSDuck dependency 11 | - "gem install jsduck" 12 | # Download, unzip and symlink Sencha Ext JS dependency 13 | - "wget http://cdn.sencha.com/ext/commercial/ext-4.2.1-commercial.zip" 14 | - "unzip -q ext-4.2.1-commercial.zip" 15 | - "ln -sv `pwd`/ext-4.2.1.883 $TRAVIS_BUILD_DIR/../ext" 16 | # Install Sencha Cmd 17 | - "wget http://cdn.sencha.com/cmd/$DEFT_SENCHA_CMD_VERSION/SenchaCmd-$DEFT_SENCHA_CMD_VERSION-linux-x64.run.zip" 18 | - "unzip -q SenchaCmd-$DEFT_SENCHA_CMD_VERSION-linux-x64.run.zip" 19 | - "chmod +x SenchaCmd-$DEFT_SENCHA_CMD_VERSION-linux-x64.run" 20 | - "./SenchaCmd-$DEFT_SENCHA_CMD_VERSION-linux-x64.run --mode unattended" 21 | # Make Sencha Cmd and CoffeeScript available in the PATH 22 | - "export PATH=~/bin/Sencha/Cmd/$DEFT_SENCHA_CMD_VERSION/:$TRAVIS_BUILD_DIR/node_modules/karma/bin:$TRAVIS_BUILD_DIR/node_modules/coffee-script/bin:$PATH" 23 | # Change directory to the package and build the package 24 | - "cd $TRAVIS_BUILD_DIR/packages/deft && sencha package build" 25 | # Change directory back to the root of the repository ready for running tests 26 | - "cd $TRAVIS_BUILD_DIR" 27 | -------------------------------------------------------------------------------- /CONTRIBUTORS.md: -------------------------------------------------------------------------------- 1 | # Contributors 2 | 3 | * [John Yanarella](http://codecatalyst.com/) (Creator) 4 | * [Brian Kotek](http://www.briankotek.com/) 5 | * [Isaac Johnston](http://superstruct.co/) 6 | * [Ryan Campbell](http://www.ryancampbell.com/) 7 | * [David Tucker](http://www.davidtucker.net/) 8 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012 DeftJS Framework Contributors 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Deft JS 2 | 3 | [![Build Status](https://travis-ci.org/deftjs/DeftJS.png?branch=master)](https://travis-ci.org/deftjs/DeftJS) 4 | [![Stories in Ready](https://badge.waffle.io/deftjs/DeftJS.png?label=Ready)](http://waffle.io/deftjs/DeftJS) 5 | 6 | Essential extensions for large-scale web and mobile application development with [Ext JS](http://www.sencha.com/products/extjs/) and [Sencha Touch](http://www.sencha.com/products/touch/). 7 | 8 | # About 9 | 10 | Deft JS enhances Ext JS and Sencha Touch's APIs with additional building blocks that enable large development teams to rapidly build enterprise scale applications, leveraging best practices and proven patterns discovered by top RIA developers at some of the best consulting firms in the industry. 11 | 12 | # Goals 13 | 14 | * **Flexibility** 15 | * Coordinates dynamic assembly of object dependencies based on a configurable IoC container. 16 | * **Approachability** 17 | * Builds on familiar Ext JS API syntax conventions for 'pay-as-you-go' complexity. 18 | * **Simplicity** 19 | * Eliminates boilerplate code in favor of the simplest expression of developer intent. 20 | * **Testability** 21 | * Promotes loose coupling through class annotation driven dependency injection. 22 | * **Extensibility** 23 | * Leverages the advanced class system provided by Ext JS and Sencha Touch. 24 | * **Reusability** 25 | * Enables business layer code reuse between Ext JS and Sencha Touch applications. 26 | 27 | # Features 28 | 29 | ## IoC Container 30 | 31 | * Provides class annotation-driven dependency injection. 32 | * Maps dependencies by user-defined identifiers. 33 | * Resolves dependencies by class instance, factory function or value. 34 | * Supports singleton and prototype resolution of class instance and factory function dependencies. 35 | * Offers eager and lazy instantiation of dependencies. 36 | * Injects dependencies into Ext JS class configs and properties before the class constructor is executed. 37 | 38 | ## MVC with ViewControllers 39 | 40 | * Provides class annotation-driven association between a given view and its ViewController. 41 | * Clarifies the role of the controller - i.e. controlling a view and delegating work to injected business services (service classes, Stores, etc.). ([Martin Fowler's description of a Passive View using a controller.](http://martinfowler.com/eaaDev/PassiveScreen.html)) 42 | * Supports multiple independent instances of a given view, each with their own ViewController instance. 43 | * Reduces memory usage by automatically creating and destroying view controllers in tandem with their associated views. 44 | * Supports concise configuration for referencing view components and registering event listeners with view controller methods. 45 | * Integrates with the view destruction lifecycle to allow the view controller to potentially cancel removal and destruction. 46 | * Simplifies clean-up by automatically removing view and view component references and event listeners. 47 | 48 | ## Promises and Deferreds 49 | 50 | * Provides an elegant way to represent a ëfuture valueí resulting from an asynchronous operation. 51 | * Offers a consistent, readable API for registering success, failure, cancellation or progress callbacks. 52 | * Allows chaining of transformation and processing of future values. 53 | * Simplifies processing of a set of future values via utility functions including all(), any(), map() and reduce(). 54 | * Implements the [Promises/A+ specification](https://github.com/promises-aplus/promises-spec) and passes the [Promises/A+ Compliance Test Suite](https://github.com/promises-aplus/promises-tests). 55 | 56 | # Documentation Wiki 57 | 58 | Full documentation on the features and usage of Deft JS is available in the [Wiki](https://github.com/deftjs/DeftJS/wiki). 59 | 60 | # API Docs 61 | 62 | The latest API documentation for Deft JS is available at [http://docs.deftjs.org/deft-js/latest/](http://docs.deftjs.org/deft-js/latest/). If you're interested in API docs for a specific version, you can substitue the version in the URL (e.g. [http://docs.deftjs.org/deft-js/0-8-0/](http://docs.deftjs.org/deft-js/0-8-0/)) 63 | 64 | # Help 65 | 66 | The best place to ask for help is on the [Deft JS Google Group](https://groups.google.com/forum/?fromgroups#!forum/deftjs). 67 | 68 | # Version History 69 | 70 | * 0.9.0 - Promises and Deferreds rewritten to be Promises/A+ compliant, migrated from Jasmine to Mocha. 71 | * 0.8.0 - Moved from mixins to class preprocessors. Added: Promises API, ViewController Observer feature, Deft.Application class, hundreds of Jasmine tests, improved logging, JSDuck documentation, and numerous other improvements. 72 | * 0.6.7 - Controllable now automatically adds a `getController()` accessor to view. Fixes reported issue with Deferreds completed with 'undefined' values. 73 | * 0.6.6 - Fixes to improve error handling and reporting; especially those associated with nonexistent classes and classes that were not Ext.require()-ed. 74 | * 0.6.5 - Enhanced IoC container to support classes defined as singletons using the Sencha class system. 75 | * 0.6.4 - Hotfix for Sencha Touch Logger issue. 76 | * 0.6.3 - Added memoization feature. Fixed reported Sencha Touch issues. 77 | * 0.6.2 - Added support for View Controller event listener options. Ext JS 4.1rc3 compatibility fixes. 78 | * 0.6.1 - Sencha Touch compatibility fixes. 79 | * 0.6.0 - Introducing View Controller and Controllable. Preview release of Deferred and Promise. 80 | * 0.1.1 - Preview release, added Jasmine test suite. 81 | * 0.1.0 - Preview release, introducing an IoC container for dependency injection. 82 | 83 | # Roadmap 84 | 85 | * Promise and Deferred documentation (*in progress*) 86 | * Forums (*in progress*) 87 | * JSDuck-compliant comments and Sencha-style documentation browser. 88 | * Website 89 | * FAQ 90 | * Example Ext JS and Sencha Touch applications 91 | * Navigation - support for hierarchical views, route-aware 92 | * AOP with an Ext JS-style API (i.e. JSON style configuration) 93 | * Occasionally-Connected Store (simplifing online / offline capabilities) 94 | 95 | # Development Team 96 | 97 | * [John Yanarella](http://twitter.com/johnyanarella) (Creator) 98 | * [Brian Kotek](https://twitter.com/brian428) 99 | * [Isaac Johnston](https://twitter.com/superstructor) 100 | * [Ryan Campbell](https://twitter.com/bobjim) 101 | * [David Tucker](https://twitter.com/mindmillmedia) 102 | 103 | # Acknowledgements 104 | 105 | * Inspiration drawn from other IoC frameworks: 106 | * [Spring](http://www.springsource.org/) 107 | * [Swiz](http://swizframework.org/) 108 | * [Robotlegs](http://www.robotlegs.org/) 109 | * [Swift Suspenders](https://github.com/tschneidereit/SwiftSuspenders) 110 | * [AngularJS](http://angularjs.org/) 111 | * The Promises/A+ Community 112 | * [Kris Zyp](https://github.com/kriszyp), who proposed the original [Common JS Promises/A Specification](http://wiki.commonjs.org/wiki/Promises/A) and created [node-promise](https://github.com/kriszyp/node-promise) and [promised-io](https://github.com/kriszyp/promised-io), 113 | * [Domenic Denicola](https://github.com/domenic) for the [Promises/A+ Specification](https://github.com/promises-aplus/promises-spec) and [Promises/A+ Compliance Test Suite](https://github.com/promises-aplus/promises-tests), [mocha-as-promised](https://github.com/domenic/mocha-as-promised), [chai-as-promised](https://github.com/domenic/chai-as-promised), and for his work with: 114 | * [Kris Kowal](https://github.com/kriskowal), who created [q](https://github.com/kriskowal/q), a JavaScript promise library that pioneered many of the practices now codified in the [Promises/A+ Specification](https://github.com/promises-aplus/promises-spec), 115 | * [Brian Cavalier](https://github.com/briancavalier) for his contributions to the [Promises/A+ Specification](https://github.com/promises-aplus/promises-spec) and [Promises/A+ Compliance Test Suite](https://github.com/promises-aplus/promises-tests), the inspiration that [avow.js](https://github.com/briancavalier/avow) provided, and for permitting us to derive some of the utility methods from [when.js](https://github.com/cujojs/when) (with [John Hann](https://github.com/unscriptable)). 116 | * Special thanks to: 117 | * [Jason Barry](http://dribbble.com/artifactdesign) for creating the Deft JS logo. 118 | * [Thomas Burleson](http://twitter.com/thomasburleson) for beta-testing and providing feedback on view controllers and promises. 119 | * [David Tucker](http://www.davidtucker.net/) for reviewing several iterations of the proposed syntax. 120 | * [Claude Gauthier](mailto:claude_r_gauthier@hotmail.com) for leading the 5-day ['Fast Track to Ext JS'](http://www.sencha.com/training) training where this idea was born. 121 | * [Tim Marshall](http://twitter.com/timothymarshall) for parting with the twitter account and project name, which he'd previously used for a personal project. 122 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "DeftJS", 3 | "version": "0.10.0", 4 | "author": { 5 | "name": "John Yanarella", 6 | "email": "john.yanarella@deftjs.org" 7 | }, 8 | "description": "Essential extensions for large-scale Sencha Touch and Ext JS applications", 9 | "homepage": "http://deftjs.org/", 10 | "repository": { 11 | "type": "git", 12 | "url": "https://github.com/deftjs/DeftJS.git" 13 | }, 14 | "devDependencies": { 15 | "karma": "~0.10", 16 | "coffee-script": "1.6.3", 17 | "mocha": "~1.17.0", 18 | "karma-mocha": "~0.1.1", 19 | "karma-coverage": "~0.1.4", 20 | "karma-safari-launcher": "~0.1.1" 21 | }, 22 | "scripts": { 23 | "test": "cd packages/deft && ant test -Dkarma.browsers=PhantomJS,Firefox" 24 | }, 25 | "license": "MIT" 26 | } 27 | -------------------------------------------------------------------------------- /packages/deft/.jsduck/jsduck.template.json: -------------------------------------------------------------------------------- 1 | { 2 | "--title": "Deft JS - v${deftjs.version} API Documentation", 3 | "--ignore-global": true, 4 | "--head-html": [ 5 | "", 6 | "" 7 | ], 8 | "--output": "docs", 9 | "--": [ 10 | "src/js" 11 | ] 12 | } -------------------------------------------------------------------------------- /packages/deft/.jsduck/theme/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deftjs/DeftJS/bf5304773826b413fe54fa0804bc8f6410056797/packages/deft/.jsduck/theme/favicon.ico -------------------------------------------------------------------------------- /packages/deft/.jsduck/theme/resources/css/theme.css: -------------------------------------------------------------------------------- 1 | #loading .logo { 2 | background: url(../images/loading.gif) no-repeat center; 3 | background-size: 64px 64px; 4 | } 5 | 6 | #north-region { 7 | background: #4e4e4e; /* Old browsers */ 8 | background: -moz-linear-gradient(top, #4e4e4e 0%, #3e3e3e 100%); /* FF3.6+ */ 9 | background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#4e4e4e), color-stop(100%,#3e3e3e)); /* Chrome,Safari4+ */ 10 | background: -webkit-linear-gradient(top, #4e4e4e 0%,#3e3e3e 100%); /* Chrome10+,Safari5.1+ */ 11 | background: -o-linear-gradient(top, #4e4e4e 0%,#3e3e3e 100%); /* Opera 11.10+ */ 12 | background: -ms-linear-gradient(top, #4e4e4e 0%,#3e3e3e 100%); /* IE10+ */ 13 | background: linear-gradient(to bottom, #4e4e4e 0%,#3e3e3e 100%); /* W3C */ 14 | filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#4e4e4e', endColorstr='#3e3e3e',GradientType=0 ); /* IE6-9 */ 15 | } 16 | 17 | #north-region .dropdown { 18 | background-position: center right; 19 | } 20 | 21 | #north-region #header-content { 22 | height: 42px; 23 | background: url(../images/logo.png) 0 0 no-repeat; 24 | background-size: 32px 32px; 25 | padding-top: 8px; 26 | padding-left: 38px; 27 | font-size: 16px; 28 | } 29 | 30 | #search-container { 31 | margin: 12px 0 0 0 !important; 32 | } 33 | 34 | .doctab.overview.classes { 35 | margin-right: 182px; 36 | } 37 | 38 | .doctabs .doctab .l { 39 | background: url(../images/tabs.png) no-repeat -8px -141px; 40 | } 41 | .doctabs .doctab .m { 42 | background: url(../images/tabs.png) repeat-x 0 -173px; 43 | } 44 | .doctabs .doctab .r { 45 | background: url(../images/tabs.png) no-repeat 0 -239px; 46 | } 47 | 48 | #center-container h1, #center-container h1 .class-source-link { 49 | color: #222222; 50 | } 51 | 52 | .class-overview .new-keyword { 53 | color: #3c84c5; 54 | } 55 | 56 | a:link, a:visited { 57 | color: #3c84c5; 58 | } -------------------------------------------------------------------------------- /packages/deft/.jsduck/theme/resources/images/loading.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deftjs/DeftJS/bf5304773826b413fe54fa0804bc8f6410056797/packages/deft/.jsduck/theme/resources/images/loading.gif -------------------------------------------------------------------------------- /packages/deft/.jsduck/theme/resources/images/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deftjs/DeftJS/bf5304773826b413fe54fa0804bc8f6410056797/packages/deft/.jsduck/theme/resources/images/logo.png -------------------------------------------------------------------------------- /packages/deft/.jsduck/theme/resources/images/tabs.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deftjs/DeftJS/bf5304773826b413fe54fa0804bc8f6410056797/packages/deft/.jsduck/theme/resources/images/tabs.png -------------------------------------------------------------------------------- /packages/deft/.jsduck/theme/resources/js/theme.js: -------------------------------------------------------------------------------- 1 | Ext.define('Docs.view.CustomViewport', { 2 | override: 'Docs.view.Viewport', 3 | 4 | initComponent: function () { 5 | this.callParent(); 6 | 7 | // Resize the north region and header. 8 | var northRegion = Ext.getCmp('north-region'); 9 | northRegion.setHeight(80); 10 | northRegion.child('container').setHeight(52); 11 | } 12 | }); -------------------------------------------------------------------------------- /packages/deft/.sencha/package/build.properties: -------------------------------------------------------------------------------- 1 | # ============================================================================= 2 | # This file provides an override point for default variables defined in 3 | # defaults.properties. 4 | # 5 | # IMPORTANT - Sencha Cmd will merge your changes with its own during upgrades. 6 | # To avoid potential merge conflicts avoid making large, sweeping changes to 7 | # this file. 8 | # ============================================================================= 9 | -------------------------------------------------------------------------------- /packages/deft/.sencha/package/codegen.json: -------------------------------------------------------------------------------- 1 | { 2 | "sources": { 3 | "package.json.tpl.merge": { 4 | "12322b2f0769f491000df8ec0e012dd2d78a7eaf": "eJx1zrEKwjAQgOG9TxE6S9HV2VFcFBdxONJrDW1y8XIRSum7m2pTJzMd/3cHGQuVXunAYrlX5ei79pTmqdx8QQa/wiXNK2hGEOLZwJEbLMWQLURrgYfZzg9iUTksXqOA6bE+YNBsvBhy8+6RXKvqX1PUKA+6gxbz5Qs5LNu7altt19+Q9SDXP9oQW5BPzqknDX0qwhGXxPiMhjGkersXU/EGNatRVA\u003d\u003d" 5 | }, 6 | "theme.html.tpl.merge": { 7 | "79ec5194c052d6cc313e842c4e2763fa562c7b70": "eJydVE1vEzEQve+vmO4JEF6nhQNKd3MJRYCQqEg4cHS8k9jFay/2JE1U9b/X3l1KWoKIYln74Tdv3vh55PLs/dfp/Mf1FShqzCQrzxjLAGDq2p3XK0XwQr6Ei9H5BYuPNwXM0Eol4JOVRcZYJAw8haKeJCaUpMng5GpL8HkGc4UNwkfhLYZQ8h7r4xokEWWpZfhrrTdVPnWW0BKb71rMQfZ/VU64JZ5kLiFK+4BUfZ9/YO/ySdYnGmqGL07UIIwBnxJ6rMFo+zOAsDUE6XVLoYtLdXfEBMdgU+WBdgaDQqQcKMoPqjKEHJTHZZXjVjStwaJb4kOCPus+40ZsRL+aQ/CyyouCx3kXsW9orgWpex6/WY2L9aq4Cfmk5H388SkXzlEgL9pn/ANukEKYGS3RRz89HrbhCEmPtkb/f73kfiOsXmKgwXjlPMn1CZq9c3Emvyj1EVuIgDyIEPhwHPy32IlWHqXxuIUTReQ6kGsOmtf1XZ8pjeJW1ysklnpfaBtP7e4RS6MRfqXtGM5H7fbyCRKJpMbwdvQX0rqgSbvIip0uSG/wKe426JfG3Y5ho4NemD34PvtT2ZaFro8YxRqQXv8TgVfPinatkJp2ser9zN32+bD/ku/dHwtX76JR3Ssh3QXzACi8aeE\u003d" 8 | }, 9 | "config.rb.tpl.merge": { 10 | "33f446bd02c3fd24eb27891582eff6a2e789796b": "eJxLLi2KT8ksUrBVcMvMSdUDMvMSc1M14uPdPH1c4+M1ufJLSwpKS+KLSypzUoGqrPJSi0tSU7gALskTcA\u003d\u003d" 11 | }, 12 | "build.properties.merge": { 13 | "8b81315dbe73ce9c08478f4c1d2df84f456efcf5": "eJytkEtOxEAMRPdzipKyhbkBCzQrFnzE5AKetJNYdOzI3UnE7XGA3GC8K5f9/GnwdM84NWhHKeglM2a3VRIXkMJWdg+B2UQrenMk7mnJFSu50C1HXWREOUEUAfr3yzk4M3sVLudTE8bL68f7Z/v81uIRV9ZuJFymhE1yxsQ+ML5tcUReh6BuUkdILbBNkRYXHbDMg1P6BaI10GqSYrXKWoUOSmfaZ+mi88+f6GvvzRTmA8rGPO/6mFMtYPW4fiff97U/al6C1w\u003d\u003d" 14 | }, 15 | "all.scss.merge": { 16 | "da39a3ee5e6b4b0d3255bfef95601890afd80709": "eJwDAAAAAAE\u003d" 17 | }, 18 | "custom.js.merge": { 19 | "199e99bbd15c3c0415569425cb21e77c95e9042a": "eJxlj0FOxDAMRfdziq9ZwUjTHIAlYslquIAncdtA4lSxC8PtSdoREmIV6f/4+dmdDjjhbY6KMSZGeycWrmQcQAqCGlWLMmEpUQzXb1xY/Ex4zgFnRMNXTAlSWseovCTybbbUDl6XsJHa1FH3sYX8B03cqqlS4OPQ//2V8CQ7K5fPriEBNjPU17gYjCZE6UnmYbacfj/GsaUNslUIhbVzu5lwq/2qVjIohGixCCVkkjiyWrOFzqWaXw0sViPr0IRYGVQ7yq+55X2HdObg7meo45udt4XnKyk7Je0Z5SWxqyyB6/Cu/Uh3ODj3crNhN28ar/f1D49P/7rLXUd7+QPuPI9g" 20 | }, 21 | "testing.properties.merge": { 22 | "e65f969c42eb4f355c850fc58fea852582f20db8": "eJyVkUFywyAQBO9+xVb5oIutH/gX+QCCkbUOAooFOf59FsmqpHKKOFEwOzM0Z7r9f53O9DGx0Mge5DBygFDKMSEX1m0VOBpepLqhsndXnpPvv2Z/oefEdiKdLRNoMAJqdyqMI5lAJiXP1hSOQbbZ5msh0mskmuOvnDHHWY32JjbmDEkxOCqxBai6K5DC4d693RAWzjHMCOVCkmB5ZLhW9EWdINjJtBJv9T7cU0vXsk/2rWwxn9AisHA6AooLcgNhqi8riYXdimAn0P+07vXsCOuD8rNimLWaiDKkmBrK7UOUyR0B2RRQdzXedyp+CMVaUi0rQn3ninMxvurPspjBQ/54jjHvYLbHycGKG5Fm2SIf0u/ut9M3l43NIg\u003d\u003d" 23 | }, 24 | "sencha.cfg.tpl.merge": { 25 | "6d1982cce48163a98dc46012d1d0cdfa209fbda6": "eJzFVdFq2zAUfc9XXNzBWmicvg0GgXZlD9vDWsge96LIcqJFljRJTuqN/vuOJNvJmqbbYLASim1dnXPuuVdXZ/R5LUizRpCpKeDZMr5hK0FT8mvTqooaFvg6LRUxriDrjBUudCQ1lbM+vvzqjZ6cTYbXGDr/YTerT3h4nEzORiKPEEHB0G4tE7D0A+lrT4ubxYK4cQ5xRle+TPsqUbNWBdoy1UalgCveP4SCGsG0BwYLSWEtlfBZl2fez7zjdM50NbxvmbvoE+IKH1IwwOLehOeMCXuVJX3QZLDoaGdc5S8Ta2mZFqq8j/+hgFkIMADZc85SxCxFlJ57X2I5WmDIh06Jkbx2piGmuz3lJXkRsimwaKmY3kBFnb/gl75cZsk6hmTAY12daSE6FtC2IduaUj1QiT3PKR1rGAPLUdkc4bmOWUn0jJumYVMvLHMsiIqU9CE2Um1UJZxHiYXbZ4uaykqkinoBpOF702LXUpB4sEpyGVSH0G+tdECMJggo56qt8IrSRt5lK1V1KDVBWRbW81df2qurN++GhUq6x5js3yrHo9kK5yAYPXij1L63YimAFtloJ7ECgSu5RTkYBbaKW4ue/m6AKPpuBztrg0ELSs6U6oAzpgroldAi62EWbbXs8pGEcULz/ogCQkkdPYlBOHdv4cMZEc1m1z0WXT/lP7BqTOtZq8bVp4ZlY/qKpnYqYGvRFzWd0xzsBXN8jRRq42hxu1gAKHuXjul+nHxkW7bgTtowdkLrsa/PGsmhG2CU0UdNCebTxe7b+w8SwDjw/ykDUL+cAQLGDCL5UeuQbKxxITUOTkkkTFmls4GehHjRp3jELsJv/EPADCRpJJwwEv3XT3BDVsWZXsQuXbM8zeMdkqQUZNqAGXQoIp9f0D2rIK0OV0bPlpznRgcmMfDFA2us+sXhc3+R6nV4nxxS9lv8SdYh4EVi3y6n/S4/HscBhu40yoI7SubWKWqH4YmbY1OkeZEv1tDZX4QBEtfkaV0DHXTN/+kfNN1i8uIGus83ukROU7pPteRpRX5P3mISCWV2B8MHNWdbgzwb4VZplhtdoxQBM19iLmqxg3eYJT5un/wEixPeXA\u003d\u003d" 26 | } 27 | }, 28 | "targets": { 29 | ".sencha/package/testing.properties": { 30 | "source": "testing.properties.merge", 31 | "version": "e65f969c42eb4f355c850fc58fea852582f20db8", 32 | "parameters": { 33 | "pkgName": "deft", 34 | "senchadir": ".sencha", 35 | "touchRelPath": "../../../../joukou/sencha-touch", 36 | "extRelPath": "../../../../joukou/sencha-ext", 37 | "pkgType": "code" 38 | } 39 | }, 40 | ".sencha/package/build.properties": { 41 | "source": "build.properties.merge", 42 | "version": "8b81315dbe73ce9c08478f4c1d2df84f456efcf5", 43 | "parameters": { 44 | "pkgName": "deft", 45 | "senchadir": ".sencha", 46 | "touchRelPath": "../../../../joukou/sencha-touch", 47 | "extRelPath": "../../../../joukou/sencha-ext", 48 | "pkgType": "code" 49 | } 50 | }, 51 | "package.json": { 52 | "source": "package.json.tpl.merge", 53 | "version": "12322b2f0769f491000df8ec0e012dd2d78a7eaf", 54 | "parameters": { 55 | "pkgName": "deft", 56 | "senchadir": ".sencha", 57 | "touchRelPath": "../../../../joukou/sencha-touch", 58 | "extRelPath": "../../../../joukou/sencha-ext", 59 | "pkgType": "code" 60 | } 61 | }, 62 | "sass/etc/all.scss": { 63 | "source": "all.scss.merge", 64 | "version": "da39a3ee5e6b4b0d3255bfef95601890afd80709", 65 | "parameters": { 66 | "pkgName": "deft", 67 | "senchadir": ".sencha", 68 | "touchRelPath": "../../../../joukou/sencha-touch", 69 | "extRelPath": "../../../../joukou/sencha-ext", 70 | "pkgType": "code" 71 | } 72 | }, 73 | "sass/example/custom.js": { 74 | "source": "custom.js.merge", 75 | "version": "199e99bbd15c3c0415569425cb21e77c95e9042a", 76 | "parameters": { 77 | "pkgName": "deft", 78 | "senchadir": ".sencha", 79 | "touchRelPath": "../../../../joukou/sencha-touch", 80 | "extRelPath": "../../../../joukou/sencha-ext", 81 | "pkgType": "code" 82 | } 83 | }, 84 | "sass/example/theme.html": { 85 | "source": "theme.html.tpl.merge", 86 | "version": "79ec5194c052d6cc313e842c4e2763fa562c7b70", 87 | "parameters": { 88 | "pkgName": "deft", 89 | "senchadir": ".sencha", 90 | "touchRelPath": "../../../../joukou/sencha-touch", 91 | "extRelPath": "../../../../joukou/sencha-ext", 92 | "pkgType": "code" 93 | } 94 | }, 95 | "sass/config.rb": { 96 | "source": "config.rb.tpl.merge", 97 | "version": "33f446bd02c3fd24eb27891582eff6a2e789796b", 98 | "parameters": { 99 | "pkgName": "deft", 100 | "senchadir": ".sencha", 101 | "touchRelPath": "../../../../joukou/sencha-touch", 102 | "extRelPath": "../../../../joukou/sencha-ext", 103 | "pkgType": "code" 104 | } 105 | }, 106 | ".sencha/package/sencha.cfg": { 107 | "source": "sencha.cfg.tpl.merge", 108 | "version": "6d1982cce48163a98dc46012d1d0cdfa209fbda6", 109 | "parameters": { 110 | "pkgName": "deft", 111 | "senchadir": ".sencha", 112 | "touchRelPath": "../../../../joukou/sencha-touch", 113 | "extRelPath": "../../../../joukou/sencha-ext", 114 | "pkgType": "code" 115 | } 116 | } 117 | } 118 | } -------------------------------------------------------------------------------- /packages/deft/.sencha/package/defaults.properties: -------------------------------------------------------------------------------- 1 | # ============================================================================= 2 | # This file defines properties used by build-impl.xml and the associated 3 | # *-impl.xml files (sass-impl.xml, js-impl.xml, etc.), which are the core of 4 | # the applications build process. 5 | # 6 | # IMPORTANT - This file is not modifiable by a package, and will be overwritten 7 | # during each app upgrade. Please use build.properties for defining package 8 | # customizations to these properties. 9 | # ============================================================================= 10 | 11 | # =========================================== 12 | # properties defining various directory 13 | # locations 14 | # =========================================== 15 | build.dir=${package.build.dir} 16 | build.resources.dir=${build.dir}/resources 17 | package.resources.dir=${package.dir}/resources 18 | package.sass.dir=${package.dir}/sass 19 | package.licenses.dir=${package.dir}/licenses 20 | 21 | # =========================================== 22 | # definitions of various file name patterns 23 | # used for output artifacts 24 | # =========================================== 25 | build.name.prefix=${build.dir}/${package.name} 26 | build.name.css.prefix=${build.resources.dir}/${package.name} 27 | build.name.ruby=config.rb 28 | 29 | build.debug.suffix=-debug 30 | build.all.suffix=-all 31 | build.rtl.suffix=-rtl 32 | 33 | build.all.debug.suffix=${build.all.suffix}${build.debug.suffix} 34 | build.all.rtl.suffix=${build.all.suffix}${build.rtl.suffix} 35 | build.all.rtl.debug.suffix=${build.all.suffix}${build.rtl.suffix}${build.debug.suffix} 36 | 37 | # =========================================== 38 | # define the output js file names for dev, 39 | # debug, and compressed (no suffix) 40 | # =========================================== 41 | build.all.js=${build.name.prefix}.js 42 | build.all.debug.js=${build.name.prefix}${build.debug.suffix}.js 43 | 44 | # =========================================== 45 | # output file names for the scss files 46 | # =========================================== 47 | build.all.scss=${build.name.prefix}${build.all.debug.suffix}.scss 48 | build.all.rtl.scss=${build.name.prefix}${build.all.rtl.debug.suffix}.scss 49 | 50 | # =========================================== 51 | # output file names for the css files 52 | # generated from the scss files by running 53 | # a compass compilation 54 | # =========================================== 55 | build.all.css.debug.prefix=${package.name}${build.all.debug.suffix} 56 | build.all.css.debug=${build.resources.dir}/${build.all.css.debug.prefix}.css 57 | build.all.rtl.css.debug.prefix=${package.name}${build.all.rtl.debug.suffix} 58 | build.all.rtl.css.debug=${build.resources.dir}/${build.all.rtl.css.debug.prefix}.css 59 | build.all.css.prefix=${package.name}${build.all.suffix} 60 | build.all.css=${build.resources.dir}/${build.all.css.prefix}.css 61 | build.all.rtl.css.prefix=${package.name}${build.all.rtl.suffix} 62 | build.all.rtl.css=${build.resources.dir}/${build.all.rtl.css.prefix}.css 63 | 64 | build.all.ruby=${build.dir}/${build.name.ruby} 65 | 66 | # =========================================== 67 | # options to pass to the 'sencha fs slice' command 68 | # =========================================== 69 | build.slice.options= 70 | 71 | # =========================================== 72 | # preprocessor options used when generating 73 | # concatenated js output files 74 | # =========================================== 75 | build.compile.js.debug.options=debug:true 76 | build.compile.js.options=debug:false 77 | 78 | # enables / disables removing text references from 79 | # package js build files 80 | build.remove.references=false 81 | 82 | # This property can be modified to change general build options 83 | # such as excluding files from the set. The format expects newlines 84 | # for each argument, for example: 85 | # 86 | # build.operations=\ 87 | # exclude\n \ 88 | # -namespace=Ext\n 89 | # 90 | # NOTE: modifications to build.operations are intended to be 91 | # placed in an override of the "-after-init" target, where it 92 | # can be calculated based on other 93 | # ant properties 94 | # 95 | # build.operations= 96 | 97 | # =========================================== 98 | # compression option used to generate '-all' 99 | # js output file 100 | # =========================================== 101 | build.compile.js.compress=+yui 102 | 103 | # =========================================== 104 | # selector count threshold to use when 105 | # splitting a single css file into multiple 106 | # css files (IE selector limit workaround) 107 | # =========================================== 108 | build.css.selector.limit=4095 109 | 110 | # controls the ruby command used to execute compass. a full path 111 | # to ruby may be specified rather than allowing the system shell 112 | # to resolve the command 113 | build.ruby.path=ruby 114 | 115 | # controls the working directory of the child compass process 116 | # and the output location for the .sass-cache folder 117 | compass.working.dir=${build.dir} 118 | 119 | # enables / disables console highlighting for compass 120 | compass.compile.boring=false 121 | 122 | # enables / disables forced rebuilds for compass 123 | compass.compile.force=true 124 | 125 | # enables / disables stack traces in compass failure output 126 | compass.compile.trace=true 127 | 128 | # =========================================== 129 | # Options for sub-packages 130 | 131 | # Set to true/1 to enable build.version inheritance by sub-pacakges 132 | build.subpkgs.inherit.version=0 133 | 134 | # =========================================== 135 | # theme slicing example page settings 136 | # =========================================== 137 | package.example.dir=${package.dir}/sass/example 138 | package.example.base=${build.all.rtl.css.debug.prefix} 139 | package.example.css.rel=resources/${package.example.base}.css 140 | package.example.css=${build.dir}/${package.example.css.rel} 141 | package.example.scss=${build.dir}/${package.example.base}.scss 142 | package.example.theme.html=${package.example.dir}/theme.html 143 | 144 | bootstrap.base.path=${package.example.dir} 145 | bootstrap.example.js=${package.example.dir}/bootstrap.js 146 | 147 | 148 | # =========================================== 149 | # options controlling output packaging 150 | # operations for output '.pkg' file 151 | # =========================================== 152 | pkg.build.dir=${workspace.build.dir}/${package.name} 153 | pkg.file.name=${package.name}.pkg 154 | pkg.includes=**/* 155 | pkg.excludes=package.json 156 | -------------------------------------------------------------------------------- /packages/deft/.sencha/package/find-cmd-impl.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 27 | 28 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 50 | 51 | 52 | source ~/.bash_profile; sencha which -p cmd.dir -o '$cmddir$' 53 | 54 | 55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /packages/deft/.sencha/package/init-impl.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 11 | 12 | 13 | 19 | 41 | 42 | 43 | 44 | 46 | 47 | 50 | 51 | 52 | 53 | Switch package version to ${build.version} 54 | 55 | 56 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 71 | 72 | 73 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 171 | 172 | 173 | 177 | 178 | 179 | 180 | 181 | 182 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 205 | 206 | 207 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 233 | 234 | 238 | 248 | 249 | 250 | -------------------------------------------------------------------------------- /packages/deft/.sencha/package/js-impl.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 16 | 17 | 18 | 19 | 20 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 45 | 46 | 47 | 48 | 49 | 50 | 63 | 64 | 65 | 66 | 67 | 68 | 70 | 71 | -------------------------------------------------------------------------------- /packages/deft/.sencha/package/plugin.xml: -------------------------------------------------------------------------------- 1 | 2 | 22 | 23 | 24 | 32 | 33 | -------------------------------------------------------------------------------- /packages/deft/.sencha/package/resources-impl.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | Merging resources from base package ${base.path} 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | Merging resources from current package ${package.resources.dir} 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /packages/deft/.sencha/package/sass-impl.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | 8 | 9 | 10 | 27 | 28 | 29 | 30 | 31 | 32 | 53 | 54 | 55 | 56 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 79 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 96 | 97 | 98 | 99 | 103 | 104 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | -------------------------------------------------------------------------------- /packages/deft/.sencha/package/sencha.cfg: -------------------------------------------------------------------------------- 1 | # The name of the package - should match the "name" property in ./package.json 2 | # 3 | package.name=deft 4 | 5 | # The namespace to which this package's SASS corresponds. The default value of 6 | # "Ext" means that the files in ./sass/src (and ./sass/var) match classes in 7 | # the Ext" root namespace. In other words, "Ext.panel.Panel" maps to 8 | # ./sass/src/panel/Panel.scss. 9 | # 10 | # To style classes from any namespace, set this to blank. If this is blank, 11 | # then to style "Ext.panel.Panel" you would put SASS in 12 | # ./sass/src/Ext/panel/Panel.scss. 13 | # 14 | package.sass.namespace=Ext 15 | 16 | # This is the comma-separated list of folders where classes reside. These 17 | # classes must be explicitly required to be included in the build. 18 | # 19 | package.classpath=${package.dir}/src 20 | 21 | # This is the comma-separated list of folders of overrides. All files in this 22 | # path will be given a tag of "packageOverrides" which is automatically 23 | # required in generated apps by the presence of this line in app.js: 24 | # 25 | # //@require @packageOverrides 26 | # 27 | package.overrides=${package.dir}/overrides 28 | 29 | # This is the folder where SASS "src" resides. This is searched for SCSS 30 | # files that match the JavaScript classes used by the application. 31 | # 32 | package.sass.srcpath=${package.dir}/sass/src 33 | 34 | # This is the folder where SASS "vars" resides. This is searched for SCSS 35 | # files that match the JavaScript classes used by the application. 36 | # 37 | package.sass.varpath=${package.dir}/sass/var 38 | 39 | # This file is automatically imported into the SASS build before "vars". 40 | # 41 | package.sass.etcpath=${package.dir}/sass/etc/all.scss 42 | 43 | # This is the folder in which to place "sencha packaage build" output. 44 | # 45 | package.build.dir=${package.dir}/build 46 | 47 | # The folder that contains example application(s) for this package. 48 | # 49 | package.examples.dir=${package.dir}/examples 50 | 51 | # The folder that contains sub-packages of this package. Only valid for "framework" 52 | # package type. 53 | # 54 | package.subpkgs.dir=${package.dir}/packages 55 | 56 | #============================================================================== 57 | # Custom Properties - Place customizations below this line to avoid merge 58 | # conflicts with newer versions 59 | 60 | package.cmd.version=4.0.1.45 61 | 62 | # Automatically include ExtJS in the classpath 63 | # 64 | package.framework=ext 65 | -------------------------------------------------------------------------------- /packages/deft/.sencha/package/slice-impl.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | /** 6 | * This file is generated by Sencha Cmd and should NOT be edited. It is 7 | * provided to support globbing requires, custom xtypes, and other 8 | * metadata-driven class system features 9 | */ 10 | 11 | 12 | 55 | 56 | 57 | 58 | 59 | 64 | 65 | 66 | 67 | /* 68 | * This file is generated by Sencha Cmd and should NOT be edited. It redirects 69 | * to the most recently built CSS file for the application to allow theme.html 70 | * to load properly for image slicing (required to support non-CSS3 browsers 71 | * such as IE9 and below). 72 | */ 73 | @import '${package.example.css.path}'; 74 | 75 | 76 | 77 | 78 | 80 | Capture theme image to ${build.dir}/theme-capture.png 81 | 82 | 89 | 90 | 91 | 92 | 93 | Slicing theme images to ${build.resources.dir} 94 | 95 | 103 | 104 | 105 | 106 | 107 | 108 | 110 | 111 | -------------------------------------------------------------------------------- /packages/deft/.sencha/package/sub-builds.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 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 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 82 | 86 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | package 143 | upgrade 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | Building example in @{example-dir} 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | Upgrading example in @{example-dir} 163 | 164 | 165 | app 166 | upgrade 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | Cleaning example in @{example-dir} 177 | 179 | 180 | 181 | 182 | -------------------------------------------------------------------------------- /packages/deft/.sencha/package/testing.properties: -------------------------------------------------------------------------------- 1 | # =========================================== 2 | # This file defines properties used by 3 | # build-impl.xml, which is the base impl 4 | # of an applications build process. The 5 | # properties from this file correspond to the 6 | # 'testing' build environment, specified 7 | # by 'sencha app build testing'. These will 8 | # take precedence over defaults provided by 9 | # build.properties. 10 | # =========================================== 11 | 12 | # =========================================== 13 | # compression option used to generate '-all' 14 | # js output file. this value disables 15 | # compression for testing builds 16 | # =========================================== 17 | build.compile.js.compress= 18 | -------------------------------------------------------------------------------- /packages/deft/Readme.md: -------------------------------------------------------------------------------- 1 | # deft - Read Me 2 | 3 | -------------------------------------------------------------------------------- /packages/deft/build.properties: -------------------------------------------------------------------------------- 1 | deftjs.version=0.9.1 2 | deftjs.copyright.notice=/*!\n\ 3 | DeftJS ${deftjs.version}\n\ 4 | \n\ 5 | Copyright (c) 2012-2013 [DeftJS Framework Contributors](http://deftjs.org)\n\ 6 | Open source under the [MIT License](http://en.wikipedia.org/wiki/MIT_License).\n\ 7 | */\n\n -------------------------------------------------------------------------------- /packages/deft/build.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 13 | 14 | 15 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 |
${deftjs.copyright.notice}
71 | 72 |
73 | 74 | 75 | 76 |
77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 |
147 | -------------------------------------------------------------------------------- /packages/deft/jsduck.json: -------------------------------------------------------------------------------- 1 | { 2 | "--title": "Deft JS - v0.9.1 API Documentation", 3 | "--ignore-global": true, 4 | "--head-html": [ 5 | "", 6 | "" 7 | ], 8 | "--output": "docs", 9 | "--": [ 10 | "src/js" 11 | ] 12 | } -------------------------------------------------------------------------------- /packages/deft/licenses/Readme.md: -------------------------------------------------------------------------------- 1 | # deft/licenses 2 | 3 | This folder contains the supported licenses for third-party use. 4 | -------------------------------------------------------------------------------- /packages/deft/overrides/Readme.md: -------------------------------------------------------------------------------- 1 | # deft/overrides 2 | 3 | This folder contains overrides which will automatically be required by package users. 4 | -------------------------------------------------------------------------------- /packages/deft/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "deft", 3 | "type": "code", 4 | "creator": "Deft JS", 5 | "summary": "Extensions for Large-Scale Sencha Touch and Ext JS Applications", 6 | "detailedDescription": "Deft JS extends Sencha Touch and Ext JS to add an Inversion of Control (IoC) container, for dependency injection and dynamic application assembly; an alternative MVC implementation, for per-view-instance ViewControllers; and a Promises/A+ compliant implementation of Promises and Deferreds, for simplified coordination, aggregation and transformation of asynchronous operations and their resulting values.", 7 | "version": "0.9.1", 8 | "compatVersion": "0.9.0", 9 | "format": "1", 10 | "local": true, 11 | "requires": [] 12 | } 13 | -------------------------------------------------------------------------------- /packages/deft/resources/Readme.md: -------------------------------------------------------------------------------- 1 | # deft/resources 2 | 3 | This folder contains static resources (typically an `"images"` folder as well). 4 | -------------------------------------------------------------------------------- /packages/deft/src/Readme.md: -------------------------------------------------------------------------------- 1 | # deft/src 2 | 3 | This folder contains source code that will automatically be added to the classpath when 4 | the package is used. 5 | -------------------------------------------------------------------------------- /packages/deft/src/coffee/core/Class.coffee: -------------------------------------------------------------------------------- 1 | ### 2 | Copyright (c) 2012-2013 [DeftJS Framework Contributors](http://deftjs.org) 3 | Open source under the [MIT License](http://en.wikipedia.org/wiki/MIT_License). 4 | ### 5 | 6 | ###* 7 | * A collection of useful static methods for interacting with (and normalizing differences between) the Sencha Touch and Ext JS class systems. 8 | * @private 9 | ### 10 | Ext.define( 'Deft.core.Class', 11 | alternateClassName: [ 'Deft.Class' ] 12 | 13 | statics: 14 | ###* 15 | * Register a new pre-processor to be used during the class creation process. 16 | * 17 | * (Normalizes API differences between the various Sencha frameworks and versions.) 18 | * 19 | * @param {String} name The pre-processor's name. 20 | * @param {Function} fn The callback function to be executed. 21 | * @param {String} position Optional insertion position for this pre-processor - valid options: 'first', 'last', 'before' or 'after'. 22 | * @param {String} relativeTo Optional name of a previously registered pre-processor, for 'before' and 'after' relative positioning. 23 | ### 24 | registerPreprocessor: ( name, fn, position, relativeTo ) -> 25 | if Ext.getVersion( 'extjs' ) and Ext.getVersion( 'core' ).isLessThan( '4.1.0' ) 26 | # Ext JS 4.0 27 | Ext.Class.registerPreprocessor( 28 | name 29 | ( Class, data, callback ) -> 30 | return fn.call( @, Class, data, data, callback ) 31 | 32 | ).setDefaultPreprocessorPosition( name, position, relativeTo ) 33 | else 34 | # Sencha Touch 2.0+, Ext JS 4.1+ 35 | Ext.Class.registerPreprocessor( 36 | name 37 | ( Class, data, hooks, callback ) -> 38 | return fn.call( @, Class, data, hooks, callback ) 39 | [ name ] 40 | position 41 | relativeTo 42 | ) 43 | return 44 | 45 | ###* 46 | * Intercept class creation. 47 | * 48 | * (Normalizes API differences between the various Sencha frameworks and versions.) 49 | ### 50 | hookOnClassCreated: ( hooks, fn ) -> 51 | if Ext.getVersion( 'extjs' ) and Ext.getVersion( 'core' ).isLessThan( '4.1.0' ) 52 | # Ext JS 4.0 53 | Ext.Function.interceptBefore( hooks, 'onClassCreated', fn ) 54 | else 55 | # Sencha Touch 2.0+, Ext JS 4.1+ 56 | Ext.Function.interceptBefore( hooks, 'onCreated', fn ) 57 | return 58 | 59 | ###* 60 | * Intercept class extension. 61 | * 62 | * (Normalizes API differences between the various Sencha frameworks and versions.) 63 | ### 64 | hookOnClassExtended: ( data, fn ) -> 65 | if Ext.getVersion( 'extjs' ) and Ext.getVersion( 'core' ).isLessThan( '4.1.0' ) 66 | # Ext JS 4.0 67 | onClassExtended = ( Class, data ) -> 68 | return fn.call( @, Class, data, data ) 69 | else 70 | # Sencha Touch 2.0+, Ext JS 4.1+ 71 | onClassExtended = fn 72 | 73 | if data.onClassExtended? 74 | Ext.Function.interceptBefore( data, 'onClassExtended', onClassExtended ) 75 | else 76 | data.onClassExtended = onClassExtended 77 | return 78 | 79 | ###* 80 | * Determines whether the passed Class reference is or extends the specified Class (by name). 81 | * 82 | * @return {Boolean} A Boolean indicating whether the specified Class reference is or extends the specified Class (by name) 83 | ### 84 | extendsClass: ( targetClass, className ) -> 85 | try 86 | return true if Ext.getClassName( targetClass ) is className 87 | if targetClass?.superclass 88 | if Ext.getClassName( targetClass.superclass ) is className 89 | return true 90 | else 91 | return Deft.Class.extendsClass( Ext.getClass( targetClass.superclass ), className ) 92 | else return false 93 | catch error 94 | return false 95 | ) -------------------------------------------------------------------------------- /packages/deft/src/coffee/event/LiveEventBus.coffee: -------------------------------------------------------------------------------- 1 | ### 2 | Copyright (c) 2012-2013 [DeftJS Framework Contributors](http://deftjs.org) 3 | Open source under the [MIT License](http://en.wikipedia.org/wiki/MIT_License). 4 | ### 5 | 6 | ###* 7 | * Event bus for live component selectors. 8 | * @private 9 | ### 10 | Ext.define( 'Deft.event.LiveEventBus', 11 | alternateClassName: [ 'Deft.LiveEventBus' ] 12 | requires: [ 13 | 'Ext.Component' 14 | 'Ext.ComponentManager' 15 | 16 | 'Deft.event.LiveEventListener' 17 | ] 18 | singleton: true 19 | 20 | constructor: -> 21 | @listeners = [] 22 | return 23 | 24 | destroy: -> 25 | for listener in @listeners 26 | listener.destroy() 27 | @listeners = null 28 | return 29 | 30 | addListener: ( container, selector, eventName, fn, scope, options ) -> 31 | listener = Ext.create( 'Deft.event.LiveEventListener', 32 | container: container 33 | selector: selector 34 | eventName: eventName 35 | fn: fn 36 | scope: scope 37 | options: options 38 | ) 39 | @listeners.push( listener ) 40 | return 41 | 42 | removeListener: ( container, selector, eventName, fn, scope ) -> 43 | listener = @findListener( container, selector, eventName, fn, scope ) 44 | if listener? 45 | Ext.Array.remove( @listeners, listener ) 46 | listener.destroy() 47 | return 48 | 49 | on: ( container, selector, eventName, fn, scope, options ) -> 50 | return @addListener( container, selector, eventName, fn, scope, options ) 51 | 52 | un: ( container, selector, eventName, fn, scope ) -> 53 | return @removeListener( container, selector, eventName, fn, scope ) 54 | 55 | # @private 56 | findListener: ( container, selector, eventName, fn, scope ) -> 57 | for listener in @listeners 58 | # NOTE: Evaluating here rather than refactoring as a `Deft.event.LiveEventListener` method in order to reduce the number of function calls executed (for performance reasons). 59 | # TODO: Optimize via an index by selector, eventName (and maybe container id?). 60 | if listener.container is container and listener.selector is selector and listener.eventName is eventName and listener.fn is fn and listener.scope is scope 61 | return listener 62 | return null 63 | 64 | # @private 65 | register: ( component ) -> 66 | component.on( 'added', @onComponentAdded, @ ) 67 | component.on( 'removed', @onComponentRemoved, @ ) 68 | return 69 | 70 | # @private 71 | unregister: ( component ) -> 72 | component.un( 'added', @onComponentAdded, @ ) 73 | component.un( 'removed', @onComponentRemoved, @ ) 74 | return 75 | 76 | # @private 77 | onComponentAdded: ( component, container, eOpts ) -> 78 | for listener in @listeners 79 | listener.register( component ) 80 | return 81 | 82 | # @private 83 | onComponentRemoved: ( component, container, eOpts ) -> 84 | for listener in @listeners 85 | listener.unregister( component ) 86 | return 87 | , 88 | -> 89 | if Ext.getVersion( 'touch' )? 90 | Ext.define( 'Deft.Component', 91 | override: 'Ext.Component' 92 | 93 | setParent: ( newParent ) -> 94 | oldParent = @getParent() 95 | 96 | result = @callParent( arguments ) 97 | 98 | if oldParent is null and newParent isnt null 99 | @fireEvent( 'added', @, newParent ) 100 | else if oldParent isnt null and newParent isnt null 101 | @fireEvent( 'removed', @, oldParent ) 102 | @fireEvent( 'added', @, newParent ) 103 | else if oldParent isnt null and newParent is null 104 | @fireEvent( 'removed', @, oldParent ) 105 | 106 | return result 107 | 108 | isDescendantOf: ( container ) -> 109 | ancestor = @getParent() 110 | while ancestor? 111 | if ancestor is container 112 | return true 113 | ancestor = ancestor.getParent() 114 | return false 115 | ) 116 | 117 | Ext.Function.interceptAfter( 118 | Ext.ComponentManager, 119 | 'register', 120 | ( component ) -> 121 | Deft.event.LiveEventBus.register( component ) 122 | return 123 | ) 124 | 125 | Ext.Function.interceptAfter( 126 | Ext.ComponentManager, 127 | 'unregister', 128 | ( component ) -> 129 | Deft.event.LiveEventBus.unregister( component ) 130 | return 131 | ) 132 | 133 | return 134 | ) -------------------------------------------------------------------------------- /packages/deft/src/coffee/event/LiveEventListener.coffee: -------------------------------------------------------------------------------- 1 | ### 2 | Copyright (c) 2012-2013 [DeftJS Framework Contributors](http://deftjs.org) 3 | Open source under the [MIT License](http://en.wikipedia.org/wiki/MIT_License). 4 | ### 5 | 6 | ###* 7 | * Event listener for events fired via the Deft.event.LiveEventBus. 8 | * @private 9 | ### 10 | Ext.define( 'Deft.event.LiveEventListener', 11 | alternateClassName: [ 'Deft.LiveEventListener' ] 12 | requires: [ 13 | 'Ext.ComponentQuery' 14 | ] 15 | 16 | constructor: ( config ) -> 17 | Ext.apply( @, config ) 18 | 19 | @components = [] 20 | components = Ext.ComponentQuery.query( @selector, @container ) 21 | for component in components 22 | @components.push( component ) 23 | component.on( @eventName, @fn, @scope, @options ) 24 | return 25 | 26 | destroy: -> 27 | for component in @components 28 | component.un( @eventName, @fn, @scope ) 29 | @components = null 30 | return 31 | 32 | # Register a candidate component as a source of 'live' events (typically called when a component is added to a container). 33 | register: ( component ) -> 34 | if @matches( component ) 35 | @components.push( component ) 36 | component.on( @eventName, @fn, @scope, @options ) 37 | return 38 | 39 | # Unregister a candidate component as a source of 'live' events (typically called when a component is removed from a container). 40 | unregister: ( component ) -> 41 | index = Ext.Array.indexOf( @components, component ) 42 | if index isnt -1 43 | component.un( @eventName, @fn, @scope ) 44 | Ext.Array.erase( @components, index, 1 ) 45 | return 46 | 47 | # @private 48 | matches: ( component ) -> 49 | if @selector is null and @container is component 50 | return true 51 | if @container is null and Ext.Array.contains( Ext.ComponentQuery.query( @selector ), component ) 52 | return true 53 | if component.isDescendantOf( @container ) and Ext.Array.contains( @container.query( @selector ), component ) 54 | return true 55 | return false 56 | ) -------------------------------------------------------------------------------- /packages/deft/src/coffee/ioc/DependencyProvider.coffee: -------------------------------------------------------------------------------- 1 | ### 2 | Copyright (c) 2012-2013 [DeftJS Framework Contributors](http://deftjs.org) 3 | Open source under the [MIT License](http://en.wikipedia.org/wiki/MIT_License). 4 | ### 5 | 6 | ###* 7 | * Used by Deft.ioc.Injector. 8 | * @private 9 | ### 10 | Ext.define( 'Deft.ioc.DependencyProvider', 11 | requires: [ 12 | 'Deft.log.Logger' 13 | ] 14 | 15 | config: 16 | identifier: null 17 | ###* 18 | Class to be instantiated, by either full name, alias or alternate name, to resolve this dependency. 19 | ### 20 | className: null 21 | 22 | ###* 23 | Optional arguments to pass to the class' constructor when instantiating a class to resolve this dependency. 24 | ### 25 | parameters: null 26 | 27 | ###* 28 | Factory function to be executed to obtain the corresponding object instance or value to resolve this dependency. 29 | 30 | NOTE: For lazily instantiated dependencies, this function will be passed the object instance for which the dependency is being resolved. 31 | ### 32 | fn: null 33 | 34 | ###* 35 | Value to use to resolve this dependency. 36 | ### 37 | value: undefined 38 | 39 | ###* 40 | Indicates whether this dependency should be resolved as a singleton, or as a transient value for each resolution request. 41 | ### 42 | singleton: true 43 | 44 | ###* 45 | Indicates whether this dependency should be 'eagerly' instantiated when this provider is defined, rather than 'lazily' instantiated when later requested. 46 | 47 | NOTE: Only valid when either a factory function or class is specified as a singleton. 48 | ### 49 | eager: false 50 | 51 | constructor: ( config ) -> 52 | @initConfig( config ) 53 | 54 | # NOTE: Internally, @initConfig() clones Object values before calling the corresponding setter. 55 | # As a workaround, detect this situation and set value to the original passed instance. 56 | if config.value? and config.value.constructor is Object 57 | @setValue( config.value ) 58 | 59 | if @getEager() 60 | if @getValue()? 61 | Ext.Error.raise( msg: "Error while configuring '#{ @getIdentifier() }': a 'value' cannot be created eagerly." ) 62 | if not @getSingleton() 63 | Ext.Error.raise( msg: "Error while configuring '#{ @getIdentifier() }': only singletons can be created eagerly." ) 64 | 65 | if @getClassName()? 66 | classDefinition = Ext.ClassManager.get( @getClassName() ) 67 | 68 | if not classDefinition? 69 | Deft.Logger.warn( "Synchronously loading '#{ @getClassName() }'; consider adding Ext.require('#{ @getClassName() }') above Ext.onReady." ) 70 | Ext.syncRequire( @getClassName() ) 71 | classDefinition = Ext.ClassManager.get( @getClassName() ) 72 | 73 | if not classDefinition? 74 | Ext.Error.raise( msg: "Error while configuring rule for '#{ @getIdentifier() }': unrecognized class name or alias: '#{ @getClassName() }'" ) 75 | 76 | if not @getSingleton() 77 | if @getClassName()? 78 | if Ext.ClassManager.get( @getClassName() ).singleton 79 | Ext.Error.raise( msg: "Error while configuring rule for '#{ @getIdentifier() }': singleton classes cannot be configured for injection as a prototype. Consider removing 'singleton: true' from the class definition." ) 80 | if @getValue()? 81 | Ext.Error.raise( msg: "Error while configuring '#{ @getIdentifier() }': a 'value' can only be configured as a singleton." ) 82 | else 83 | if @getClassName()? and @getParameters()? 84 | if Ext.ClassManager.get( @getClassName() ).singleton 85 | Ext.Error.raise( msg: "Error while configuring rule for '#{ @getIdentifier() }': parameters cannot be applied to singleton classes. Consider removing 'singleton: true' from the class definition." ) 86 | 87 | return @ 88 | 89 | ###* 90 | Resolve a target instance's dependency with an object instance or value generated by this dependency provider. 91 | ### 92 | resolve: ( targetInstance, targetInstanceConstructorArguments ) -> 93 | Deft.Logger.log( "Resolving '#{ @getIdentifier() }'." ) 94 | if @getValue() isnt undefined 95 | return @getValue() 96 | 97 | instance = null 98 | if @getFn()? 99 | Deft.Logger.log( "Executing factory function." ) 100 | if targetInstanceConstructorArguments 101 | fnArguments = [ targetInstance ].concat( Ext.toArray( targetInstanceConstructorArguments ) ) 102 | else 103 | fnArguments = [ targetInstance ] 104 | instance = @getFn().apply( Deft.Injector, fnArguments ) 105 | else if @getClassName()? 106 | if Ext.ClassManager.get( @getClassName() ).singleton 107 | Deft.Logger.log( "Using existing singleton instance of '#{ @getClassName() }'." ) 108 | instance = Ext.ClassManager.get( @getClassName() ) 109 | else 110 | Deft.Logger.log( "Creating instance of '#{ @getClassName() }'." ) 111 | parameters = if @getParameters()? then [ @getClassName() ].concat( @getParameters() ) else [ @getClassName() ] 112 | instance = Ext.create.apply( @, parameters ) 113 | else 114 | Ext.Error.raise( msg: "Error while configuring rule for '#{ @getIdentifier() }': no 'value', 'fn', or 'className' was specified." ) 115 | 116 | if @getSingleton() 117 | @setValue( instance ) 118 | 119 | return instance 120 | ) 121 | -------------------------------------------------------------------------------- /packages/deft/src/coffee/log/Logger.coffee: -------------------------------------------------------------------------------- 1 | ### 2 | Copyright (c) 2012-2013 [DeftJS Framework Contributors](http://deftjs.org) 3 | Open source under the [MIT License](http://en.wikipedia.org/wiki/MIT_License). 4 | ### 5 | 6 | ###* 7 | * Logger used by DeftJS. 8 | * 9 | * Output is displayed in the console when using `ext-dev`/`ext-all-dev` or `sencha-debug`/`sencha-all-debug`. 10 | * 11 | * @private 12 | ### 13 | Ext.define( 'Deft.log.Logger', 14 | alternateClassName: [ 'Deft.Logger' ] 15 | requires: [ 16 | 'Deft.util.Function' 17 | ] 18 | singleton: true 19 | 20 | ###* 21 | * Logs a message with the specified priority. 22 | * 23 | * @param {String} message The message to log. 24 | * @param {String} priority The priority of the log message. Valid values are: `verbose`, `info`, `deprecate`, `warn` and `error`. 25 | ### 26 | log: ( message, priority = 'info' ) -> 27 | # NOTE: Stubbed implementation, replaced in class creation callback below. 28 | return 29 | 30 | ###* 31 | * Logs a message with 'verbose' priority. 32 | * 33 | * @param {String} message The message to log. 34 | ### 35 | verbose: ( message ) -> 36 | @log( message, 'verbose' ) 37 | return 38 | 39 | ###* 40 | * Logs a message with 'info' priority. 41 | * 42 | * @param {String} message The message to log. 43 | ### 44 | info: ( message ) -> 45 | @log( message, 'info' ) 46 | return 47 | 48 | ###* 49 | * Logs a message with 'deprecate' priority. 50 | * 51 | * @param {String} message The message to log. 52 | ### 53 | deprecate: ( message ) -> 54 | @log( message, 'deprecate' ) 55 | return 56 | 57 | ###* 58 | * Logs a message with 'warn' priority. 59 | * 60 | * @param {String} message The message to log. 61 | ### 62 | warn: ( message ) -> 63 | @log( message, 'warn' ) 64 | return 65 | 66 | ###* 67 | * Logs a message with 'error' priority. 68 | * 69 | * @param {String} message The message to log. 70 | ### 71 | error: ( message ) -> 72 | @log( message, 'error' ) 73 | return 74 | , 75 | -> 76 | if Ext.getVersion( 'extjs' )? 77 | # Ext JS 78 | @log = ( message, priority = 'info' ) -> 79 | if priority is 'verbose' 80 | priority = 'info' 81 | if priority is 'deprecate' 82 | priority = 'warn' 83 | Ext.log( 84 | msg: message 85 | level: priority 86 | ) 87 | return 88 | else 89 | # Sencha Touch 90 | @log = ( message, priority = 'info' ) -> 91 | if Ext.Logger? and Deft.isFunction( Ext.Logger.log ) 92 | Ext.Logger.log( message, priority ) 93 | return 94 | return 95 | ) 96 | -------------------------------------------------------------------------------- /packages/deft/src/coffee/mixin/Controllable.coffee: -------------------------------------------------------------------------------- 1 | ### 2 | Copyright (c) 2012-2013 [DeftJS Framework Contributors](http://deftjs.org) 3 | Open source under the [MIT License](http://en.wikipedia.org/wiki/MIT_License). 4 | ### 5 | 6 | ###* 7 | * A mixin that creates and attaches the specified view controller(s) to the target view. Used in conjunction with Deft.mvc.ViewController. 8 | * @deprecated 0.8 Deft.mixin.Controllable has been deprecated and can now be omitted - simply use the \'controller\' class annotation on its own. 9 | ### 10 | Ext.define( 'Deft.mixin.Controllable', 11 | requires: [ 12 | 'Ext.Component' 13 | 14 | 'Deft.core.Class' 15 | 'Deft.log.Logger' 16 | ] 17 | 18 | ###* 19 | @private 20 | ### 21 | onClassMixedIn: ( targetClass ) -> 22 | Deft.Logger.deprecate( 'Deft.mixin.Controllable has been deprecated and can now be omitted - simply use the \'controller\' class annotation on its own.' ) 23 | return 24 | , 25 | -> 26 | if Ext.getVersion( 'extjs' ) and Ext.getVersion( 'core' ).isLessThan( '4.1.0' ) 27 | # Ext JS 4.0 28 | createControllerInterceptor = -> 29 | return ( config = {} ) -> 30 | if @ instanceof Ext.ClassManager.get( 'Ext.Component' ) and not @$controlled 31 | try 32 | controller = Ext.create( @controller, config.controllerConfig || @controllerConfig || {} ) 33 | catch error 34 | # NOTE: Ext.Logger.error() will throw an error, masking the error we intend to rethrow, so warn instead. 35 | Deft.Logger.warn( "Error initializing view controller: an error occurred while creating an instance of the specified controller: '#{ @controller }'." ) 36 | throw error 37 | 38 | if @getController is undefined 39 | @getController = -> 40 | return controller 41 | 42 | @$controlled = true 43 | 44 | @callOverridden( arguments ) 45 | 46 | controller.controlView( @ ) 47 | 48 | return @ 49 | 50 | return @callOverridden( arguments ) 51 | else 52 | # Sencha Touch 2.0+, Ext JS 4.1+ 53 | createControllerInterceptor = -> 54 | return ( config = {} ) -> 55 | if @ instanceof Ext.ClassManager.get( 'Ext.Component' ) and not @$controlled 56 | try 57 | controller = Ext.create( @controller, config.controllerConfig || @controllerConfig || {} ) 58 | catch error 59 | # NOTE: Ext.Logger.error() will throw an error, masking the error we intend to rethrow, so warn instead. 60 | Deft.Logger.warn( "Error initializing view controller: an error occurred while creating an instance of the specified controller: '#{ @controller }'." ) 61 | throw error 62 | 63 | if @getController is undefined 64 | @getController = -> 65 | return controller 66 | 67 | @$controlled = true 68 | 69 | @callParent( arguments ) 70 | 71 | controller.controlView( @ ) 72 | 73 | return @ 74 | 75 | return @callParent( arguments ) 76 | 77 | 78 | Deft.Class.registerPreprocessor( 79 | 'controller' 80 | ( Class, data, hooks, callback ) -> 81 | # Override the constructor for this class with a controller interceptor. 82 | Deft.Class.hookOnClassCreated( hooks, ( Class ) -> 83 | Class.override( 84 | constructor: createControllerInterceptor() 85 | ) 86 | return 87 | ) 88 | 89 | # Process any classes that extend this class. 90 | Deft.Class.hookOnClassExtended( data, ( Class, data, hooks ) -> 91 | # Override the constructor for this class with a controller interceptor. 92 | Deft.Class.hookOnClassCreated( hooks, ( Class ) -> 93 | Class.override( 94 | constructor: createControllerInterceptor() 95 | ) 96 | return 97 | ) 98 | return 99 | ) 100 | 101 | # Automatically require the controller class. 102 | self = @ 103 | Ext.require( [ data.controller ], -> 104 | if callback? 105 | callback.call( self, Class, data, hooks ) 106 | return 107 | ) 108 | return false 109 | 'before' 110 | 'extend' 111 | ) 112 | 113 | return 114 | ) 115 | 116 | -------------------------------------------------------------------------------- /packages/deft/src/coffee/mixin/Injectable.coffee: -------------------------------------------------------------------------------- 1 | ### 2 | Copyright (c) 2012-2013 [DeftJS Framework Contributors](http://deftjs.org) 3 | Open source under the [MIT License](http://en.wikipedia.org/wiki/MIT_License). 4 | ### 5 | 6 | ###* 7 | * A mixin that marks a class as participating in dependency injection. Used in conjunction with Deft.ioc.Injector. 8 | * @deprecated 0.8 Deft.mixin.Injectable has been deprecated and can now be omitted - simply use the \'inject\' class annotation on its own. 9 | ### 10 | Ext.define( 'Deft.mixin.Injectable', 11 | requires: [ 12 | 'Deft.core.Class' 13 | 'Deft.ioc.Injector' 14 | 'Deft.log.Logger' 15 | ] 16 | 17 | ###* 18 | @private 19 | ### 20 | onClassMixedIn: ( targetClass ) -> 21 | Deft.Logger.deprecate( 'Deft.mixin.Injectable has been deprecated and can now be omitted - simply use the \'inject\' class annotation on its own.' ) 22 | return 23 | , 24 | -> 25 | if Ext.getVersion( 'extjs' ) and Ext.getVersion( 'core' ).isLessThan( '4.1.0' ) 26 | # Ext JS 4.0 27 | createInjectionInterceptor = -> 28 | return -> 29 | if not @$injected 30 | Deft.Injector.inject( @inject, @, arguments, false ) 31 | @$injected = true 32 | return @callOverridden( arguments ) 33 | else 34 | # Sencha Touch 2.0+, Ext JS 4.1+ 35 | createInjectionInterceptor = -> 36 | return -> 37 | if not @$injected 38 | Deft.Injector.inject( @inject, @, arguments, false ) 39 | @$injected = true 40 | return @callParent( arguments ) 41 | 42 | Deft.Class.registerPreprocessor( 43 | 'inject' 44 | ( Class, data, hooks, callback ) -> 45 | # Convert a String or Array of Strings specified for data.inject into an Object. 46 | data.inject = [ data.inject ] if Ext.isString( data.inject ) 47 | if Ext.isArray( data.inject ) 48 | dataInjectObject = {} 49 | for identifier in data.inject 50 | dataInjectObject[ identifier ] = identifier 51 | data.inject = dataInjectObject 52 | 53 | # Override the constructor for this class with an injection interceptor. 54 | Deft.Class.hookOnClassCreated( hooks, ( Class ) -> 55 | Class.override( 56 | constructor: createInjectionInterceptor() 57 | ) 58 | return 59 | ) 60 | 61 | # Process any classes that extend this class. 62 | Deft.Class.hookOnClassExtended( data, ( Class, data, hooks ) -> 63 | # Override the constructor for this class with an injection interceptor. 64 | Deft.Class.hookOnClassCreated( hooks, ( Class ) -> 65 | Class.override( 66 | constructor: createInjectionInterceptor() 67 | ) 68 | return 69 | ) 70 | 71 | # Merge identifiers, ensuring that identifiers in data override identifiers in superclass. 72 | data.inject ?= {} 73 | Ext.applyIf( data.inject, Class.superclass.inject ) 74 | return 75 | ) 76 | 77 | return 78 | 'before' 79 | 'extend' 80 | ) 81 | 82 | return 83 | ) 84 | 85 | -------------------------------------------------------------------------------- /packages/deft/src/coffee/mvc/Application.coffee: -------------------------------------------------------------------------------- 1 | ### 2 | Copyright (c) 2012-2013 [DeftJS Framework Contributors](http://deftjs.org) 3 | Open source under the [MIT License](http://en.wikipedia.org/wiki/MIT_License). 4 | ### 5 | 6 | ###* 7 | * A lightweight Application template class for use with Ext JS. 8 | ### 9 | Ext.define( 'Deft.mvc.Application', 10 | alternateClassName: [ 'Deft.Application' ] 11 | 12 | ###* 13 | * Indicates whether this Application instance has been initialized. 14 | ### 15 | initialized: false 16 | 17 | ###* 18 | * @param {Object} [config] Configuration object. 19 | ### 20 | constructor: ( config = {} ) -> 21 | @initConfig( config ) 22 | Ext.onReady( 23 | -> 24 | @init() 25 | @initialized = true 26 | return 27 | @ 28 | ) 29 | return @ 30 | 31 | ###* 32 | * Initialize the Application 33 | ### 34 | init: -> 35 | return 36 | ) 37 | -------------------------------------------------------------------------------- /packages/deft/src/coffee/mvc/ComponentSelector.coffee: -------------------------------------------------------------------------------- 1 | ### 2 | Copyright (c) 2012-2013 [DeftJS Framework Contributors](http://deftjs.org) 3 | Open source under the [MIT License](http://en.wikipedia.org/wiki/MIT_License). 4 | ### 5 | 6 | ###* 7 | * @private 8 | * Models a component selector used by Deft.mvc.ViewController to locate view components and attach event listeners. 9 | ### 10 | Ext.define( 'Deft.mvc.ComponentSelector', 11 | requires: [ 12 | 'Ext.ComponentQuery' 13 | 'Deft.log.Logger' 14 | 'Deft.mvc.ComponentSelectorListener' 15 | 'Deft.util.Function' 16 | ] 17 | 18 | constructor: ( config ) -> 19 | Ext.apply( @, config ) 20 | 21 | if not @live 22 | @components = if @selector? then Ext.ComponentQuery.query( @selector, @view ) else [ @view ] 23 | 24 | @selectorListeners = [] 25 | 26 | if Ext.isObject( @listeners ) 27 | for eventName, listener of @listeners 28 | fn = listener 29 | scope = @scope 30 | options = null 31 | 32 | # Parse `options` if present. 33 | if Ext.isObject( listener ) 34 | options = Ext.apply( {}, listener ) 35 | if options.fn? 36 | fn = options.fn 37 | delete options.fn 38 | if options.scope? 39 | scope = options.scope 40 | delete options.scope 41 | 42 | # Parse `fn`. 43 | if Ext.isString( fn ) and Deft.isFunction( scope[ fn ] ) 44 | fn = scope[ fn ] 45 | if not Deft.isFunction ( fn ) 46 | Ext.Error.raise( msg: "Error adding '#{ eventName }' listener: the specified handler '#{ fn }' is not a Function or does not exist." ) 47 | 48 | @addListener( eventName, fn, scope, options ) 49 | return @ 50 | 51 | destroy: -> 52 | for selectorListener in @selectorListeners 53 | selectorListener.destroy() 54 | @selectorListeners = [] 55 | return 56 | 57 | ###* 58 | Add an event listener to this component selector. 59 | ### 60 | addListener: ( eventName, fn, scope, options ) -> 61 | if @findListener( eventName, fn, scope )? 62 | Ext.Error.raise( msg: "Error adding '#{ eventName }' listener: an existing listener for the specified function was already registered for '#{ @selector }." ) 63 | 64 | Deft.Logger.log( "Adding '#{ eventName }' listener to '#{ @selector }'." ) 65 | selectorListener = Ext.create( 'Deft.mvc.ComponentSelectorListener', 66 | componentSelector: @ 67 | eventName: eventName 68 | fn: fn 69 | scope: scope 70 | options: options 71 | ) 72 | @selectorListeners.push( selectorListener ) 73 | return 74 | 75 | ###* 76 | Remove an event listener from this component selector. 77 | ### 78 | removeListener: ( eventName, fn, scope ) -> 79 | selectorListener = @findListener( eventName, fn, scope ) 80 | if selectorListener? 81 | Deft.Logger.log( "Removing '#{ eventName }' listener from '#{ @selector }'." ) 82 | selectorListener.destroy() 83 | Ext.Array.remove( @selectorListeners, selectorListener ) 84 | return 85 | 86 | # @private 87 | findListener: ( eventName, fn, scope ) -> 88 | for selectorListener in @selectorListeners 89 | if selectorListener.eventName is eventName and selectorListener.fn is fn and selectorListener.scope is scope 90 | return selectorListener 91 | return null 92 | ) -------------------------------------------------------------------------------- /packages/deft/src/coffee/mvc/ComponentSelectorListener.coffee: -------------------------------------------------------------------------------- 1 | ### 2 | Copyright (c) 2012-2013 [DeftJS Framework Contributors](http://deftjs.org) 3 | Open source under the [MIT License](http://en.wikipedia.org/wiki/MIT_License). 4 | ### 5 | 6 | ###* 7 | * Manages live events attached to component selectors. Used by Deft.mvc.ComponentSelector. 8 | * @private 9 | ### 10 | Ext.define( 'Deft.mvc.ComponentSelectorListener', 11 | requires: [ 12 | 'Deft.event.LiveEventBus' 13 | ] 14 | 15 | constructor: ( config ) -> 16 | Ext.apply( @, config ) 17 | 18 | if @componentSelector.live 19 | Deft.LiveEventBus.addListener( @componentSelector.view, @componentSelector.selector, @eventName, @fn, @scope, @options ) 20 | else 21 | for component in @componentSelector.components 22 | component.on( @eventName, @fn, @scope, @options ) 23 | return @ 24 | 25 | destroy: -> 26 | if @componentSelector.live 27 | Deft.LiveEventBus.removeListener( @componentSelector.view, @componentSelector.selector, @eventName, @fn, @scope ) 28 | else 29 | for component in @componentSelector.components 30 | component.un( @eventName, @fn, @scope ) 31 | return 32 | ) -------------------------------------------------------------------------------- /packages/deft/src/coffee/promise/Chain.coffee: -------------------------------------------------------------------------------- 1 | ### 2 | Copyright (c) 2012-2013 [DeftJS Framework Contributors](http://deftjs.org) 3 | Open source under the [MIT License](http://en.wikipedia.org/wiki/MIT_License). 4 | 5 | sequence(), parallel(), pipeline() methods adapted from: 6 | [when.js](https://github.com/cujojs/when) 7 | Copyright (c) B Cavalier & J Hann 8 | Open source under the [MIT License](http://en.wikipedia.org/wiki/MIT_License). 9 | ### 10 | 11 | ###* 12 | * A collection of useful static methods for chaining execution of an Array of Functions using {@link Deft.promise.Promise Promises}. 13 | ### 14 | Ext.define( 'Deft.promise.Chain', 15 | alternateClassName: [ 'Deft.Chain' ] 16 | requires: [ 17 | 'Deft.promise.Promise' 18 | 'Deft.util.Function' 19 | ] 20 | 21 | statics: 22 | ###* 23 | * Execute an Array (or {@link Deft.promise.Promise Promise} of an Array) of functions sequentially. 24 | * 25 | * The specified functions may optionally return their results as {@link Deft.promise.Promise Promises}. 26 | * 27 | * @param {Function[]/Deft.promise.Promise} fns The Array (or Promise of an Array) of functions to execute. 28 | * @param {Object} scope Optional scope in which to execute the specified functions. 29 | * @return {Deft.promise.Promise} Promise of an Array of results for each function call (in the same order). 30 | ### 31 | sequence: ( fns, scope = null ) -> 32 | args = [].slice.call( arguments, 2 ) 33 | return Deft.Promise.reduce( 34 | fns 35 | ( results, fn ) -> 36 | if not Deft.isFunction( fn ) 37 | throw new Error( 'Invalid parameter: expected a function.' ) 38 | return Deft.Promise.when( fn.apply( scope, args ) ).then( ( result ) -> 39 | results.push( result ) 40 | return results 41 | ) 42 | [] 43 | ) 44 | 45 | ###* 46 | * Execute an Array (or {@link Deft.promise.Promise Promise} of an Array) of functions in parallel. 47 | * 48 | * The specified functions may optionally return their results as {@link Deft.promise.Promise Promises}. 49 | * 50 | * @param {Function[]/Deft.promise.Promise} fns The Array (or Promise of an Array) of functions to execute. 51 | * @param {Object} scope Optional scope in which to execute the specified functions. 52 | * @return {Deft.promise.Promise} Promise of an Array of results for each function call (in the same order). 53 | ### 54 | parallel: ( fns, scope = null ) -> 55 | args = [].slice.call( arguments, 2 ) 56 | return Deft.Promise.map( 57 | fns 58 | ( fn ) -> 59 | if not Ext.isFunction( fn ) 60 | throw new Error( 'Invalid parameter: expected a function.' ) 61 | return fn.apply( scope, args ) 62 | ) 63 | 64 | ###* 65 | * Execute an Array (or {@link Deft.promise.Promise Promise} of an Array) of functions as a pipeline, where each function's result is passed to the subsequent function as input. 66 | * 67 | * The specified functions may optionally return their results as {@link Deft.promise.Promise Promises}. 68 | * 69 | * @param {Function[]/Deft.promise.Promise} fns The Array (or Promise of an Array) of functions to execute. 70 | * @param {Object} initialValue Initial value to be passed to the first function in the pipeline. 71 | * @param {Object} scope Optional scope in which to execute the specified functions. 72 | * @return {Deft.promise.Promise} Promise of the result value for the final function in the pipeline. 73 | ### 74 | pipeline: ( fns, initialValue, scope = null ) -> 75 | return Deft.Promise.reduce( 76 | fns 77 | ( value, fn ) -> 78 | if not Ext.isFunction( fn ) 79 | throw new Error( 'Invalid parameter: expected a function.' ) 80 | return fn.call( scope, value ) 81 | initialValue 82 | ) 83 | ) -------------------------------------------------------------------------------- /packages/deft/src/coffee/promise/Consequence.coffee: -------------------------------------------------------------------------------- 1 | ### 2 | Copyright (c) 2012-2014 [DeftJS Framework Contributors](http://deftjs.org) 3 | Open source under the [MIT License](http://en.wikipedia.org/wiki/MIT_License). 4 | ### 5 | 6 | ###* 7 | * @private 8 | * Consequences are used internally by a Resolver to capture and notify 9 | * callbacks, and propagate their transformed results as fulfillment or 10 | * rejection. 11 | * 12 | * Developers never directly interact with a Consequence. 13 | * 14 | * A Consequence forms a chain between two Resolvers, where the result of 15 | * the first Resolver is transformed by the corresponding callback before 16 | * being applied to the second Resolver. 17 | * 18 | * Each time a Resolver's then() method is called, it creates a new 19 | * Consequence that will be triggered once its originating Resolver has 20 | * been fulfilled or rejected. A Consequence captures a pair of optional 21 | * onFulfilled and onRejected callbacks. 22 | * 23 | * Each Consequence has its own Resolver (which in turn has a Promise) 24 | * that is resolved or rejected when the Consequence is triggered. When a 25 | * Consequence is triggered by its originating Resolver, it calls the 26 | * corresponding callback and propagates the transformed result to its own 27 | * Resolver; resolved with the callback return value or rejected with any 28 | * error thrown by the callback. 29 | ### 30 | Ext.define( 'Deft.promise.Consequence', 31 | alternateClassName: [ 'Deft.Consequence' ] 32 | requires: [ 33 | 'Deft.util.Function' 34 | ] 35 | 36 | ###* 37 | * @property {Deft.promise.Promise} 38 | * Promise of the future value of this Consequence. 39 | ### 40 | promise: null 41 | 42 | ###* 43 | * @private 44 | * @property {Deft.promise.Resolver} 45 | * Internal Resolver for this Consequence. 46 | ### 47 | resolver: null 48 | 49 | ###* 50 | * @private 51 | * @property {Function} 52 | Callback to execute when this Consequence is triggered with a fulfillment value. 53 | ### 54 | onFulfilled: null 55 | 56 | ###* 57 | * @private 58 | * @property {Function} 59 | Callback to execute when this Consequence is triggered with a rejection reason. 60 | ### 61 | onRejected: null 62 | 63 | ###* 64 | * @private 65 | * @property {Function} 66 | Callback to execute when this Consequence is updated with a progress value. 67 | ### 68 | onProgress: null 69 | 70 | ###* 71 | * @param {Function} onFulfilled Callback to execute to transform a fulfillment value. 72 | * @param {Function} onRejected Callback to execute to transform a rejection reason. 73 | ### 74 | constructor: ( @onFulfilled, @onRejected, @onProgress ) -> 75 | @resolver = Ext.create( 'Deft.promise.Resolver' ) 76 | @promise = @resolver.promise 77 | return @ 78 | 79 | ###* 80 | * Trigger this Consequence with the specified action and value. 81 | * 82 | * @param {String} action Completion action (i.e. fulfill or reject). 83 | * @param {Mixed} value Fulfillment value or rejection reason. 84 | ### 85 | trigger: ( action, value ) -> 86 | switch action 87 | when 'fulfill' 88 | @propagate( value, @onFulfilled, @resolver, @resolver.resolve ) 89 | when 'reject' 90 | @propagate( value, @onRejected, @resolver, @resolver.reject ) 91 | return 92 | 93 | ###* 94 | * Update this Consequence with the specified progress value. 95 | * 96 | * @param {Mixed} value Progress value. 97 | ### 98 | update: ( progress ) -> 99 | progress = @onProgress( progress ) if Deft.isFunction( @onProgress ) 100 | @resolver.update( progress ) 101 | return 102 | 103 | ###* 104 | * @private 105 | * Transform and propagate the specified value using the 106 | * optional callback and propagate the transformed result. 107 | * 108 | * @param {Mixed} value Value to transform and/or propagate. 109 | * @param {Function} callback (Optional) callback to use to transform the value. 110 | * @param {Function} resolver Resolver to use to propagate the value, if no callback was specified. 111 | * @param {Function} resolverMethod Resolver method to call to propagate the value, if no callback was specified. 112 | ### 113 | propagate: ( value, callback, resolver, resolverMethod ) -> 114 | if Deft.isFunction( callback ) 115 | @schedule( -> 116 | try 117 | resolver.resolve( callback( value ) ) 118 | catch error 119 | resolver.reject( error ) 120 | return 121 | ) 122 | else 123 | resolverMethod.call( @resolver, value ) 124 | return 125 | 126 | ###* 127 | * @private 128 | * @method 129 | * Schedules the specified callback function to be executed on 130 | * the next turn of the event loop. 131 | * 132 | * @param {Function} callback Callback function. 133 | * @param {Mixed[]} parameters Optional callback parameters. 134 | * @param {Object} scope Optional scope for the callback. 135 | ### 136 | schedule: Ext.emptyFn 137 | , 138 | -> 139 | nextTick = if setImmediate? then setImmediate else ( task ) -> setTimeout( task, 0 ) 140 | 141 | class CallbackQueue 142 | constructor: -> 143 | queuedCallbacks = new Array(1e4) 144 | queuedCallbackCount = 0 145 | execute = -> 146 | index = 0 147 | while index < queuedCallbackCount 148 | queuedCallbacks[ index ]() 149 | queuedCallbacks[ index ] = null 150 | index++ 151 | queuedCallbackCount = 0 152 | return 153 | @schedule = ( callback ) -> 154 | queuedCallbacks[ queuedCallbackCount++ ] = callback 155 | nextTick( execute ) if queuedCallbackCount is 1 156 | return 157 | 158 | callbackQueue = new CallbackQueue() 159 | 160 | @::schedule = ( callback, parameters, scope ) -> 161 | callbackQueue.schedule( callback, parameters, scope ) 162 | return 163 | 164 | return 165 | ) 166 | -------------------------------------------------------------------------------- /packages/deft/src/coffee/promise/Deferred.coffee: -------------------------------------------------------------------------------- 1 | ### 2 | Copyright (c) 2012-2014 [DeftJS Framework Contributors](http://deftjs.org) 3 | Open source under the [MIT License](http://en.wikipedia.org/wiki/MIT_License). 4 | ### 5 | 6 | ###* 7 | * A Deferred is typically used within the body of a function that performs 8 | * an asynchronous operation. When that operation succeeds, the Deferred 9 | * should be resolved; if that operation fails, the Deferred should be rejected. 10 | * 11 | * Deferreds are the mechanism used to create new Promises. A Deferred has a 12 | * single associated Promise that can be safely returned to external consumers 13 | * to ensure they do not interfere with the resolution or rejection of the 14 | * deferred operation. 15 | ### 16 | Ext.define( 'Deft.promise.Deferred', 17 | alternateClassName: [ 'Deft.Deferred' ] 18 | requires: [ 19 | 'Deft.promise.Resolver' 20 | ] 21 | 22 | statics: 23 | ###* 24 | * Convenience method that returns a Promise resolved with the specified value. 25 | * 26 | * @param {Mixed} value Value to resolve as either a fulfillment value or rejection reason. 27 | * @return {Deft.promise.Promise} Resolved Promise. 28 | ### 29 | resolve: ( value ) -> 30 | deferred = Ext.create( 'Deft.promise.Deferred' ) 31 | deferred.resolve( value ) 32 | return deferred.promise 33 | 34 | ###* 35 | * Convenience method that returns a new Promise rejected with the specified reason. 36 | * 37 | * @param {Error} reason Rejection reason. 38 | * @return {Deft.promise.Promise} Rejected Promise. 39 | ### 40 | reject: ( reason ) -> 41 | deferred = Ext.create( 'Deft.promise.Deferred' ) 42 | deferred.reject( reason ) 43 | return deferred.promise 44 | 45 | ###* 46 | * @property {Deft.promise.Promise} 47 | * Promise of the future value of this Deferred. 48 | ### 49 | promise: null 50 | 51 | ###* 52 | * @private 53 | * @property {Deft.promise.Resolver} 54 | * Internal Resolver for this Deferred. 55 | ### 56 | resolver: null 57 | 58 | constructor: -> 59 | @resolver = Ext.create( 'Deft.promise.Resolver' ) 60 | @promise = @resolver.promise 61 | return @ 62 | 63 | ###* 64 | * Resolve this Deferred with the specified value. 65 | * 66 | * Once a Deferred has been fulfilled or rejected, it is considered to be complete 67 | * and subsequent calls to resolve() or reject() are ignored. 68 | * 69 | * @param {Mixed} value Value to resolve as either a fulfillment value or rejection reason. 70 | ### 71 | resolve: ( value ) -> 72 | @resolver.resolve( value ) 73 | return 74 | 75 | ###* 76 | * Reject this Deferred with the specified error. 77 | * 78 | * Once a Deferred has been rejected, it is considered to be complete 79 | * and subsequent calls to resolve() or reject() are ignored. 80 | * 81 | * @param {Error} reason Rejection reason. 82 | ### 83 | reject: ( reason ) -> 84 | @resolver.reject( reason ) 85 | return 86 | 87 | ###* 88 | * Update progress for this Deferred, if it is still pending. 89 | * 90 | * @param {Mixed} progress Progress value. 91 | ### 92 | update: ( progress ) -> 93 | @resolver.update( progress ) 94 | return 95 | 96 | ###* 97 | * Return the Promise of the future value of this Deferred. 98 | * 99 | * @return {Deft.promise.Promise} Promise of the future value. 100 | ### 101 | getPromise: -> 102 | return @promise 103 | ) -------------------------------------------------------------------------------- /packages/deft/src/coffee/promise/Resolver.coffee: -------------------------------------------------------------------------------- 1 | ### 2 | Copyright (c) 2012-2014 [DeftJS Framework Contributors](http://deftjs.org) 3 | Open source under the [MIT License](http://en.wikipedia.org/wiki/MIT_License). 4 | ### 5 | 6 | ###* 7 | * @private 8 | * Resolvers are used internally by Deferreds to create, resolve and reject 9 | * Promises, and to propagate fulfillment and rejection. 10 | * 11 | * Developers never directly interact with a Resolver. 12 | * 13 | * Each Deferred has an associated Resolver, and each Resolver has an 14 | * associated Promise. A Deferred delegates resolve() and reject() calls to 15 | * its Resolver's resolve() and reject() methods. A Promise delegates 16 | * then() calls to its Resolver's then() method. In this way, access to 17 | * Resolver operations are divided between producer (Deferred) and consumer 18 | * (Promise) roles. 19 | * 20 | * When a Resolver's resolve() method is called, it fulfills with the 21 | * optionally specified value. If resolve() is called with a then-able 22 | * (i.e.a Function or Object with a then() function, such as another 23 | * Promise) it assimilates the then-able's result; the Resolver provides 24 | * its own resolve() and reject() methods as the onFulfilled or onRejected 25 | * arguments in a call to that then-able's then() function. If an error is 26 | * thrown while calling the then-able's then() function (prior to any call 27 | * back to the specified resolve() or reject() methods), the Resolver 28 | * rejects with that error. If a Resolver's resolve() method is called with 29 | * its own Promise, it rejects with a TypeError. 30 | * 31 | * When a Resolver's reject() method is called, it rejects with the 32 | * optionally specified reason. 33 | * 34 | * Each time a Resolver's then() method is called, it captures a pair of 35 | * optional onFulfilled and onRejected callbacks and returns a Promise of 36 | * the Resolver's future value as transformed by those callbacks. 37 | ### 38 | Ext.define( 'Deft.promise.Resolver', 39 | alternateClassName: [ 'Deft.Resolver' ] 40 | requires: [ 41 | 'Deft.promise.Consequence' 42 | ] 43 | 44 | ###* 45 | * @property {Deft.promise.Promise} 46 | * Promise of the future value of this Deferred. 47 | ### 48 | promise: null 49 | 50 | ###* 51 | * @private 52 | * @property {Deft.promise.Consequence[]} 53 | * Pending Consequences chained to this Resolver. 54 | ### 55 | consequences: [] 56 | 57 | ###* 58 | * @private 59 | * @property {Boolean} 60 | * Indicates whether this Resolver has been completed. 61 | ### 62 | completed: false 63 | 64 | ###* 65 | * @private 66 | * @property {String} 67 | * The completion action (i.e. 'fulfill' or 'reject'). 68 | ### 69 | completionAction: null 70 | 71 | ###* 72 | * @private 73 | * @property {Mixed} 74 | * The completion value (i.e. resolution value or rejection error). 75 | ### 76 | completionValue: null 77 | 78 | constructor: -> 79 | @promise = Ext.create( 'Deft.promise.Promise', @ ) 80 | @consequences = [] 81 | @completed = false 82 | @completionAction = null 83 | @completionValue = null 84 | return @ 85 | 86 | ###* 87 | * Used to specify onFulfilled and onRejected callbacks that will be 88 | * notified when the future value becomes available. 89 | * 90 | * Those callbacks can subsequently transform the value that was 91 | * fulfilled or the error that was rejected. Each call to then() 92 | * returns a new Promise of that transformed value; i.e., a Promise 93 | * that is fulfilled with the callback return value or rejected with 94 | * any error thrown by the callback. 95 | * 96 | * @param {Function} onFulfilled (Optional) callback to execute to transform a fulfillment value. 97 | * @param {Function} onRejected (Optional) callback to execute to transform a rejection reason. 98 | * @param {Function} onProgress (Optional) callback to execute to transform a progress value. 99 | * 100 | * @return Promise that is fulfilled with the callback return value or rejected with any error thrown by the callback. 101 | ### 102 | then: ( onFulfilled, onRejected, onProgress ) -> 103 | consequence = Ext.create( 'Deft.promise.Consequence', onFulfilled, onRejected, onProgress ) 104 | if @completed 105 | consequence.trigger( @completionAction, @completionValue ) 106 | else 107 | @consequences.push( consequence ) 108 | return consequence.promise 109 | 110 | ###* 111 | * Resolve this Resolver with the (optional) specified value. 112 | * 113 | * If called with a then-able (i.e.a Function or Object with a then() 114 | * function, such as another Promise) it assimilates the then-able's 115 | * result; the Resolver provides its own resolve() and reject() methods 116 | * as the onFulfilled or onRejected arguments in a call to that 117 | * then-able's then() function. If an error is thrown while calling 118 | * the then-able's then() function (prior to any call back to the 119 | * specified resolve() or reject() methods), the Resolver rejects with 120 | * that error. If a Resolver's resolve() method is called with its own 121 | * Promise, it rejects with a TypeError. 122 | * 123 | * Once a Resolver has been fulfilled or rejected, it is considered to be complete 124 | * and subsequent calls to resolve() or reject() are ignored. 125 | * 126 | * @param {Mixed} value Value to resolve as either a fulfillment value or rejection reason. 127 | ### 128 | resolve: ( value ) -> 129 | if @completed 130 | return 131 | try 132 | if value is @promise 133 | throw new TypeError( 'A Promise cannot be resolved with itself.' ) 134 | if ( Ext.isObject( value ) or Deft.isFunction( value ) ) and Deft.isFunction( thenFn = value.then ) 135 | isHandled = false 136 | try 137 | self = @ 138 | thenFn.call( 139 | value 140 | ( value ) -> 141 | if not isHandled 142 | isHandled = true 143 | self.resolve( value ) 144 | return 145 | ( error ) -> 146 | if not isHandled 147 | isHandled = true 148 | self.reject( error ) 149 | return 150 | ) 151 | catch error 152 | @reject( error ) if not isHandled 153 | else 154 | @complete( 'fulfill', value ) 155 | catch error 156 | @reject( error ) 157 | return 158 | 159 | ###* 160 | * Reject this Resolver with the specified reason. 161 | * 162 | * Once a Resolver has been rejected, it is considered to be complete 163 | * and subsequent calls to resolve() or reject() are ignored. 164 | * 165 | * @param {Error} reason Rejection reason. 166 | ### 167 | reject: ( reason ) -> 168 | if @completed 169 | return 170 | @complete( 'reject', reason ) 171 | return 172 | 173 | ###* 174 | * Updates progress for this Resolver, if it is still pending, triggering it to execute the 'onProgress' callback and propagate the resulting transformed progress value to Resolvers that originate from this Resolver. 175 | * 176 | * @param {Mixed} progress The progress value. 177 | ### 178 | update: ( progress ) -> 179 | if @completed 180 | return 181 | for consequence in @consequences 182 | consequence.update( progress ) 183 | return 184 | 185 | ###* 186 | * @private 187 | * Complete this Resolver with the specified action and value. 188 | * 189 | * @param {String} action Completion action (i.e. 'fufill' or 'reject'). 190 | * @param {Mixed} value Fulfillment value or rejection reason. 191 | ### 192 | complete: ( action, value ) -> 193 | @completionAction = action 194 | @completionValue = value 195 | @completed = true 196 | for consequence in @consequences 197 | consequence.trigger( @completionAction, @completionValue ) 198 | @consequences = null 199 | return 200 | ) -------------------------------------------------------------------------------- /packages/deft/src/coffee/util/Function.coffee: -------------------------------------------------------------------------------- 1 | ### 2 | Copyright (c) 2012-2014 [DeftJS Framework Contributors](http://deftjs.org) 3 | Open source under the [MIT License](http://en.wikipedia.org/wiki/MIT_License). 4 | ### 5 | 6 | ###* 7 | * A collection of useful static methods for interacting with Functions. 8 | ### 9 | Ext.define( 'Deft.util.Function', 10 | alternateClassName: [ 'Deft.Function' ] 11 | 12 | statics: 13 | ###* 14 | * Returns a new wrapper function that caches the return value for previously processed function argument(s). 15 | * 16 | * @param {Function} fn Function to wrap. 17 | * @param {Object} scope Optional scope in which to execute the wrapped function. 18 | * @param {Function} hashFn Optional function used to compute a hash key for storing the result, based on the arguments to the original function. 19 | * @return {Function} The new wrapper function. 20 | ### 21 | memoize: ( fn, scope, hashFn ) -> 22 | memo = {} 23 | return ( value ) -> 24 | key = if Deft.isFunction( hashFn ) then hashFn.apply( scope, arguments ) else value 25 | memo[ key ] = fn.apply( scope, arguments ) unless key of memo 26 | return memo[ key ] 27 | 28 | ###* 29 | * @method 30 | * Schedules the specified callback function to be executed on the next turn of the event loop. 31 | * 32 | * @param {Function} fn Callback function. 33 | * @param {Object} scope Optional scope for the callback. 34 | * @param {Mixed[]} parameters Optional callback parameters. 35 | ### 36 | nextTick: Ext.emptyFn 37 | 38 | ###* 39 | * @method 40 | * Evalutes whether the specified value is a Function. 41 | * Also available as Deft.isFunction(). 42 | * **NOTE:** Ext JS 4.2.0 and 4.2.1 shipped with a broken version of Ext.isFunction. 43 | * @param {Mixed} value Value to evaluate. 44 | * @return {Boolean} 45 | ### 46 | isFunction: Ext.emptyFn 47 | 48 | ###* 49 | * Creates a new wrapper function that spreads the passed Array over the target function arguments. 50 | * 51 | * @param {Function} fn Function to wrap. 52 | * @param {Object} scope Optional scope in which to execute the wrapped function. 53 | * @return {Function} The new wrapper function. 54 | ### 55 | spread: ( fn, scope ) -> 56 | return ( array ) -> 57 | if not Ext.isArray( array ) 58 | Ext.Error.raise( msg: "Error spreading passed Array over target function arguments: passed a non-Array." ) 59 | return fn.apply( scope, array ) 60 | , 61 | -> 62 | if setImmediate? 63 | @nextTick = ( fn, scope, parameters ) -> 64 | if scope? or parameters? 65 | fn = Ext.Function.bind( fn, scope, parameters) 66 | setImmediate( fn ) 67 | return 68 | else 69 | @nextTick = ( fn, scope, parameters ) -> 70 | if scope? or parameters? 71 | fn = Ext.Function.bind( fn, scope, parameters ) 72 | setTimeout( fn, 0 ) 73 | return 74 | 75 | if (typeof document isnt 'undefined' and typeof document.getElementsByTagName( 'body' ) is 'function') 76 | # Safari 3.x and 4.x return 'function' for typeof - fall back to Object.prototype.toString (slower) 77 | @isFunction = (value) -> !!value and toString.call(value) is '[object Function]' 78 | else 79 | @isFunction = (value) -> !!value and typeof value is 'function' 80 | 81 | Deft.isFunction = @isFunction 82 | 83 | return 84 | ) -------------------------------------------------------------------------------- /packages/deft/src/js/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deftjs/DeftJS/bf5304773826b413fe54fa0804bc8f6410056797/packages/deft/src/js/.gitkeep -------------------------------------------------------------------------------- /packages/deft/test/TestRunner.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Deft JS Test Suite 6 | 7 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 174 | 175 | 186 | 187 | 188 | 189 |
190 |

Choose Target Framework:

191 | 213 |
214 |
215 |
216 | 217 | 218 | -------------------------------------------------------------------------------- /packages/deft/test/build.properties: -------------------------------------------------------------------------------- 1 | karma.browsers=Chrome,Safari,Firefox -------------------------------------------------------------------------------- /packages/deft/test/build.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 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 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | -------------------------------------------------------------------------------- /packages/deft/test/coffee/custom-assertions.coffee: -------------------------------------------------------------------------------- 1 | ### 2 | Copyright (c) 2013 [DeftJS Framework Contributors](http://deftjs.org) 3 | Open source under the [MIT License](http://en.wikipedia.org/wiki/MIT_License). 4 | ### 5 | 6 | describe( 'Custom Assertions', -> 7 | 8 | specify( 'memberOf', -> 9 | expect( 1 ).to.be.a.memberOf( [ 1, 2, 3 ] ) 10 | expect( 0 ).not.to.be.a.memberOf( [ 1, 2, 3 ] ) 11 | return 12 | ) 13 | 14 | specify( 'membersOf', -> 15 | expect( [ 1 ] ).to.be.membersOf( [ 1, 2, 3 ] ) 16 | expect( [ 1, 2 ] ).to.be.membersOf( [ 1, 2, 3 ] ) 17 | expect( [ 0 ] ).not.to.be.membersOf( [ 1, 2, 3 ] ) 18 | expect( [ 0, 5 ] ).not.to.be.membersOf( [ 1, 2, 3 ] ) 19 | return 20 | ) 21 | 22 | specify( 'unique', -> 23 | expect( [ 1, 2, 3 ] ).to.be.unique 24 | expect( [ 1, 2, 1 ] ).not.to.be.unique 25 | return 26 | ) 27 | 28 | specify( 'eventuallyThrow', ( done ) -> 29 | @slow( 250 ) 30 | setTimeout( 31 | -> 32 | throw new Error( 'error message' ) 33 | 0 34 | ) 35 | assert.eventuallyThrows( new Error( 'error message' ), done, 100 ) 36 | return 37 | ) 38 | 39 | return 40 | ) -------------------------------------------------------------------------------- /packages/deft/test/coffee/log/Logger.coffee: -------------------------------------------------------------------------------- 1 | ### 2 | Copyright (c) 2012 [DeftJS Framework Contributors](http://deftjs.org) 3 | Open source under the [MIT License](http://en.wikipedia.org/wiki/MIT_License). 4 | ### 5 | 6 | describe( 'Deft.log.Logger', -> 7 | 8 | describe( 'log()', -> 9 | 10 | if Ext.getVersion( 'extjs' )? 11 | # Ext JS 12 | 13 | describe( 'logs a message with the specified priority', -> 14 | logFunction = null 15 | 16 | beforeEach( -> 17 | logFunction = sinon.stub( Ext, 'log' ) 18 | return 19 | ) 20 | 21 | afterEach( -> 22 | logFunction.restore() 23 | return 24 | ) 25 | 26 | specify( 'no priority specified', -> 27 | Deft.Logger.log( 'message', 'info' ) 28 | 29 | expect( logFunction ).to.be.calledOnce.and.calledWith( { level: 'info', msg: 'message' } ) 30 | return 31 | ) 32 | 33 | specify( 'verbose', -> 34 | Deft.Logger.log( 'message', 'verbose' ) 35 | 36 | expect( logFunction ).to.be.calledOnce.and.calledWith( { level: 'info', msg: 'message' } ) 37 | return 38 | ) 39 | 40 | specify( 'deprecate', -> 41 | Deft.Logger.log( 'message', 'deprecate' ) 42 | 43 | expect( logFunction ).to.be.calledOnce.and.calledWith( { level: 'warn', msg: 'message' } ) 44 | return 45 | ) 46 | 47 | specify( 'warn', -> 48 | Deft.Logger.log( 'message', 'warn' ) 49 | 50 | expect( logFunction ).to.be.calledOnce.and.calledWith( { level: 'warn', msg: 'message' } ) 51 | return 52 | ) 53 | 54 | specify( 'error', -> 55 | Deft.Logger.log( 'message', 'error' ) 56 | 57 | expect( logFunction ).to.be.calledOnce.and.calledWith( { level: 'error', msg: 'message' } ) 58 | return 59 | ) 60 | 61 | return 62 | ) 63 | 64 | else 65 | # Sencha Touch 66 | 67 | describe( 'logs a message with the specified priority, when Ext.Logger is available', -> 68 | logFunction = null 69 | 70 | beforeEach( -> 71 | if not Ext.Logger? 72 | Ext.define( 'Ext.Logger', 73 | singleton: true 74 | log: Ext.emptyFn 75 | isMock: true 76 | ) 77 | logFunction = sinon.stub( Ext.Logger, 'log' ) 78 | ) 79 | 80 | afterEach( -> 81 | logFunction.restore() 82 | if Ext.Logger.isMock 83 | Ext.Logger = null 84 | ) 85 | 86 | specify( 'no priority specified', -> 87 | Deft.Logger.log( 'message', 'info' ) 88 | 89 | expect( logFunction ).to.be.calledOnce.and.calledWith( 'message', 'info' ) 90 | return 91 | ) 92 | 93 | specify( 'verbose', -> 94 | Deft.Logger.log( 'message', 'verbose' ) 95 | 96 | expect( logFunction ).to.be.calledOnce.and.calledWith( 'message', 'verbose' ) 97 | return 98 | ) 99 | 100 | specify( 'info', -> 101 | Deft.Logger.log( 'message', 'info' ) 102 | 103 | expect( logFunction ).to.be.calledOnce.and.calledWith( 'message', 'info' ) 104 | return 105 | ) 106 | 107 | specify( 'deprecate', -> 108 | Deft.Logger.log( 'message', 'deprecate' ) 109 | 110 | expect( logFunction ).to.be.calledOnce.and.calledWith( 'message', 'deprecate' ) 111 | return 112 | ) 113 | 114 | specify( 'warn', -> 115 | Deft.Logger.log( 'message', 'warn' ) 116 | 117 | expect( logFunction ).to.be.calledOnce.and.calledWith( 'message', 'warn' ) 118 | return 119 | ) 120 | 121 | specify( 'error', -> 122 | Deft.Logger.log( 'message', 'error' ) 123 | 124 | expect( logFunction ).to.be.calledOnce.and.calledWith( 'message', 'error' ) 125 | return 126 | ) 127 | 128 | return 129 | ) 130 | 131 | describe( 'silently ignores messages when Ext.Logger is unavailable', -> 132 | logger = null 133 | 134 | beforeEach( -> 135 | logger = Ext.Logger 136 | Ext.Logger = null 137 | return 138 | ) 139 | 140 | afterEach( -> 141 | Ext.Logger = logger 142 | return 143 | ) 144 | 145 | specify( 'no priority specified', -> 146 | expect( -> Deft.Logger.log( 'message', 'info' ) ).to.not.throw( Error ) 147 | return 148 | ) 149 | 150 | specify( 'verbose', -> 151 | expect( -> Deft.Logger.log( 'message', 'verbose' ) ).to.not.throw( Error ) 152 | return 153 | ) 154 | 155 | specify( 'deprecate', -> 156 | expect( -> Deft.Logger.log( 'message', 'deprecate' ) ).to.not.throw( Error ) 157 | return 158 | ) 159 | 160 | specify( 'warn', -> 161 | expect( -> Deft.Logger.log( 'message', 'warn' ) ).to.not.throw( Error ) 162 | return 163 | ) 164 | 165 | specify( 'error', -> 166 | expect( -> Deft.Logger.log( 'message', 'error' ) ).to.not.throw( Error ) 167 | return 168 | ) 169 | 170 | return 171 | ) 172 | ) 173 | 174 | describe( 'verbose()', -> 175 | logFunction = null 176 | 177 | beforeEach( -> 178 | logFunction = sinon.stub( Deft.Logger, 'log' ) 179 | ) 180 | 181 | afterEach( -> 182 | logFunction.restore() 183 | ) 184 | 185 | specify( 'calls log() with specified message with verbose priority', -> 186 | Deft.Logger.verbose( 'message' ) 187 | 188 | expect( logFunction ).to.be.calledOnce.and.calledWith( 'message', 'verbose' ) 189 | return 190 | ) 191 | 192 | return 193 | ) 194 | 195 | describe( 'info()', -> 196 | logFunction = null 197 | 198 | beforeEach( -> 199 | logFunction = sinon.stub( Deft.Logger, 'log' ) 200 | ) 201 | 202 | afterEach( -> 203 | logFunction.restore() 204 | ) 205 | 206 | specify( 'calls log() with specified message with info priority', -> 207 | Deft.Logger.info( 'message' ) 208 | 209 | expect( logFunction ).to.be.calledOnce.and.calledWith( 'message', 'info' ) 210 | return 211 | ) 212 | 213 | return 214 | ) 215 | 216 | describe( 'deprecate()', -> 217 | logFunction = null 218 | 219 | beforeEach( -> 220 | logFunction = sinon.stub( Deft.Logger, 'log' ) 221 | ) 222 | 223 | afterEach( -> 224 | logFunction.restore() 225 | ) 226 | 227 | specify( 'calls log() with specified message with deprecate priority', -> 228 | Deft.Logger.deprecate( 'message' ) 229 | 230 | expect( logFunction ).to.be.calledOnce.and.calledWith( 'message', 'deprecate' ) 231 | return 232 | ) 233 | 234 | return 235 | ) 236 | 237 | describe( 'warn()', -> 238 | logFunction = null 239 | 240 | beforeEach( -> 241 | logFunction = sinon.stub( Deft.Logger, 'log' ) 242 | ) 243 | 244 | afterEach( -> 245 | logFunction.restore() 246 | ) 247 | 248 | specify( 'calls log() with specified message with warn priority', -> 249 | Deft.Logger.warn( 'message' ) 250 | 251 | expect( logFunction ).to.be.calledOnce.and.calledWith( 'message', 'warn' ) 252 | return 253 | ) 254 | 255 | return 256 | ) 257 | 258 | describe( 'error()', -> 259 | logFunction = null 260 | 261 | beforeEach( -> 262 | logFunction = sinon.stub( Deft.Logger, 'log' ) 263 | ) 264 | 265 | afterEach( -> 266 | logFunction.restore() 267 | ) 268 | 269 | specify( 'calls log() with specified message with error priority', -> 270 | Deft.Logger.error( 'message' ) 271 | 272 | expect( logFunction ).to.be.calledOnce.and.calledWith( 'message', 'error' ) 273 | return 274 | ) 275 | 276 | return 277 | ) 278 | 279 | return 280 | ) -------------------------------------------------------------------------------- /packages/deft/test/coffee/util/Function.coffee: -------------------------------------------------------------------------------- 1 | ### 2 | Copyright (c) 2012 [DeftJS Framework Contributors](http://deftjs.org) 3 | Open source under the [MIT License](http://en.wikipedia.org/wiki/MIT_License). 4 | ### 5 | 6 | describe( 'Deft.util.Function', -> 7 | 8 | describe( 'memoize()', -> 9 | fibonacci = ( n ) -> 10 | ( if n < 2 then n else fibonacci( n - 1 ) + fibonacci( n - 2 ) ) 11 | 12 | sum = -> 13 | Ext.Array.toArray( arguments ).reduce( 14 | ( total, value ) -> total + value 15 | 0 16 | ) 17 | 18 | specify( 'returns a new function that wraps the specified function (omitting the optional scope and hash function parameters) and caches the results for previously processed inputs', -> 19 | targetFunction = sinon.spy( fibonacci ) 20 | 21 | memoFunction = Deft.util.Function.memoize( targetFunction ) 22 | 23 | expect( memoFunction( 12 ) ).to.equal( fibonacci( 12 ) ) 24 | expect( memoFunction( 12 ) ).to.equal( fibonacci( 12 ) ) 25 | expect( targetFunction ).to.be.calledOnce.and.calledOn( window ) 26 | 27 | return 28 | ) 29 | 30 | specify( 'returns a new function that wraps the specified function (to be executed in the scope specified via the scope parameter) and caches the results for previously processed inputs', -> 31 | targetScope = {} 32 | targetFunction = sinon.spy( fibonacci ) 33 | 34 | memoFunction = Deft.util.Function.memoize( targetFunction, targetScope ) 35 | 36 | expect( memoFunction( 12 ) ).to.equal( fibonacci( 12 ) ) 37 | expect( memoFunction( 12 ) ).to.equal( fibonacci( 12 ) ) 38 | expect( targetFunction ).to.be.calledOnce.and.calledOn( targetScope ) 39 | 40 | return 41 | ) 42 | 43 | specify( 'supports memoizing functions that take multiple parameters using a hash function (specified via an optional parameter) to produce a unique caching key for those parameters', -> 44 | targetScope = {} 45 | targetFunction = sinon.spy( sum ) 46 | hashFunction = sinon.spy( ( a, b, c ) -> Ext.Array.toArray( arguments ).join( '|' ) ) 47 | 48 | memoFunction = Deft.util.Function.memoize( targetFunction, targetScope, hashFunction ) 49 | 50 | expect( memoFunction( 1, 2, 3 ) ).to.equal( sum( 1, 2, 3 ) ) 51 | expect( memoFunction( 1, 2, 3 ) ).to.equal( sum( 1, 2, 3 ) ) 52 | expect( hashFunction ).to.be.calledTwice.and.calledOn( targetScope ) 53 | expect( targetFunction ).to.be.calledOnce.and.calledOn( targetScope ) 54 | 55 | return 56 | ) 57 | 58 | return 59 | ) 60 | 61 | describe( 'nextTick()', -> 62 | 63 | specify( 'schedules the specified function to be executed in the next turn of the event loop', ( done ) -> 64 | targetFunction = sinon.stub() 65 | 66 | Deft.util.Function.nextTick( targetFunction ) 67 | 68 | setTimeout( 69 | -> 70 | expect( targetFunction ).to.be.calledOnce 71 | done() 72 | return 73 | 0 74 | ) 75 | return 76 | ) 77 | 78 | specify( 'schedules the specified functionto be executed in the specified scope in the next turn of the event loop', ( done ) -> 79 | targetScope = {} 80 | targetFunction = sinon.stub() 81 | 82 | Deft.util.Function.nextTick( targetFunction, targetScope ) 83 | 84 | setTimeout( 85 | -> 86 | expect( targetFunction ).to.be.calledOnce.and.calledOn( targetScope ) 87 | done() 88 | return 89 | 0 90 | ) 91 | return 92 | ) 93 | 94 | specify( 'schedules the specified functionto be executed in the specified scope with the specified parameters in the next turn of the event loop', ( done ) -> 95 | targetScope = {} 96 | targetFunction = sinon.stub() 97 | 98 | Deft.util.Function.nextTick( targetFunction, targetScope, [ 'a', 'b','c' ] ) 99 | 100 | setTimeout( 101 | -> 102 | expect( targetFunction ).to.be.calledOnce.and.calledOn( targetScope ) 103 | expect( targetFunction ).to.be.calledOnce.and.calledWith( 'a', 'b','c' ) 104 | done() 105 | return 106 | 0 107 | ) 108 | return 109 | ) 110 | 111 | return 112 | ) 113 | 114 | describe( 'spread()', -> 115 | 116 | specify( 'creates a new wrapper function that spreads the passed Array over the target function arguments', -> 117 | targetFunction = sinon.spy( ( a, b, c ) -> "#{a},#{b},#{c}" ) 118 | 119 | wrapperFunction = Deft.util.Function.spread( targetFunction ) 120 | 121 | expect( Ext.isFunction( wrapperFunction ) ).to.be.true 122 | expect( wrapperFunction( [ 'a', 'b','c' ] ) ).to.equal( 'a,b,c' ) 123 | expect( targetFunction ).to.be.calledOnce.and.calledWith( 'a', 'b', 'c' ) 124 | 125 | return 126 | ) 127 | 128 | specify( 'creates a new wrapper that fails when passed a non-Array', -> 129 | targetFunction = sinon.stub() 130 | 131 | wrapperFunction = Deft.util.Function.spread( targetFunction ) 132 | 133 | expect( Ext.isFunction( wrapperFunction ) ).to.be.true 134 | expect( -> wrapperFunction( 'value' ) ).to.throw( Error, 'Error spreading passed Array over target function arguments: passed a non-Array.' ) 135 | expect( targetFunction ).not.to.be.called 136 | 137 | return 138 | ) 139 | 140 | return 141 | ) 142 | 143 | return 144 | ) -------------------------------------------------------------------------------- /packages/deft/test/js/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deftjs/DeftJS/bf5304773826b413fe54fa0804bc8f6410056797/packages/deft/test/js/.gitkeep -------------------------------------------------------------------------------- /packages/deft/test/karma/ext/4.0.7.conf.js: -------------------------------------------------------------------------------- 1 | // Karma configuration 2 | // Generated on Mon Jan 20 2014 05:41:33 GMT-0500 (EST) 3 | 4 | module.exports = function(config) { 5 | config.set({ 6 | 7 | // base path, that will be used to resolve files and exclude 8 | basePath: '../../..', 9 | 10 | 11 | // frameworks to use 12 | frameworks: ['mocha'], 13 | 14 | 15 | // list of files / patterns to load in the browser 16 | files: [ 17 | 'http://cdn.sencha.io/ext-4.0.7-gpl/ext-all.js', 18 | 'build/deft-debug.js', 19 | 20 | 'test/lib/chai-1.8.1/chai.js', 21 | 'test/lib/sinon-1.7.3/sinon.js', 22 | 'test/lib/sinon-chai-2.4.0/sinon-chai.js', 23 | 'test/lib/sinon-sencha-1.0.0/sinon-sencha.js', 24 | 25 | 'test/support/browser.js', 26 | 'test/support/custom-assertions.js', 27 | 28 | 'test/lib/mocha-as-promised-2.0.0/mocha-as-promised.js', 29 | 'test/lib/chai-as-promised-4.1.0/chai-as-promised.js', 30 | 31 | 'test/js/custom-assertions.js', 32 | 33 | 'test/js/util/Function.js', 34 | 'test/js/log/Logger.js', 35 | 'test/js/ioc/Injector.js', 36 | 'test/js/mixin/Injectable.js', 37 | 'test/js/mixin/Controllable.js', 38 | 'test/js/mvc/ViewController.js', 39 | 'test/lib/promises-aplus-tests-2.0.3/promises-aplus-tests.js', 40 | 'test/js/promise/Promise.js', 41 | 'test/js/promise/Chain.js' 42 | ], 43 | 44 | 45 | // list of files to exclude 46 | exclude: [ 47 | ], 48 | 49 | preprocessors: { 50 | 'build/deft-debug.js': ['coverage'] 51 | }, 52 | 53 | coverageReporter: { 54 | type: 'html', 55 | dir: 'test/coverage/ext/4.0.7' 56 | }, 57 | 58 | // test results reporter to use 59 | // possible values: 'dots', 'progress', 'junit', 'growl', 'coverage' 60 | reporters: ['dots'], 61 | 62 | 63 | // web server port 64 | port: 9876, 65 | 66 | 67 | // enable / disable colors in the output (reporters and logs) 68 | colors: true, 69 | 70 | 71 | // level of logging 72 | // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG 73 | logLevel: config.LOG_INFO, 74 | 75 | 76 | // enable / disable watching file and executing tests whenever any file changes 77 | autoWatch: true, 78 | 79 | 80 | // Start these browsers, currently available: 81 | // - Chrome 82 | // - ChromeCanary 83 | // - Firefox 84 | // - Opera (has to be installed with `npm install karma-opera-launcher`) 85 | // - Safari (only Mac; has to be installed with `npm install karma-safari-launcher`) 86 | // - PhantomJS 87 | // - IE (only Windows; has to be installed with `npm install karma-ie-launcher`) 88 | browsers: ['Chrome'], 89 | 90 | 91 | // If browser does not capture in given timeout [ms], kill it 92 | captureTimeout: 60000, 93 | 94 | 95 | // Continuous Integration mode 96 | // if true, it capture browsers, run tests and exit 97 | singleRun: false 98 | }); 99 | }; 100 | -------------------------------------------------------------------------------- /packages/deft/test/karma/ext/4.1.0.conf.js: -------------------------------------------------------------------------------- 1 | // Karma configuration 2 | // Generated on Mon Jan 20 2014 05:41:33 GMT-0500 (EST) 3 | 4 | module.exports = function(config) { 5 | config.set({ 6 | 7 | // base path, that will be used to resolve files and exclude 8 | basePath: '../../..', 9 | 10 | 11 | // frameworks to use 12 | frameworks: ['mocha'], 13 | 14 | 15 | // list of files / patterns to load in the browser 16 | files: [ 17 | 'http://cdn.sencha.io/ext-4.1.0-gpl/ext-all.js', 18 | 'build/deft-debug.js', 19 | 20 | 'test/lib/chai-1.8.1/chai.js', 21 | 'test/lib/sinon-1.7.3/sinon.js', 22 | 'test/lib/sinon-chai-2.4.0/sinon-chai.js', 23 | 'test/lib/sinon-sencha-1.0.0/sinon-sencha.js', 24 | 25 | 'test/support/browser.js', 26 | 'test/support/custom-assertions.js', 27 | 28 | 'test/lib/mocha-as-promised-2.0.0/mocha-as-promised.js', 29 | 'test/lib/chai-as-promised-4.1.0/chai-as-promised.js', 30 | 31 | 'test/js/custom-assertions.js', 32 | 33 | 'test/js/util/Function.js', 34 | 'test/js/log/Logger.js', 35 | 'test/js/ioc/Injector.js', 36 | 'test/js/mixin/Injectable.js', 37 | 'test/js/mixin/Controllable.js', 38 | 'test/js/mvc/ViewController.js', 39 | 'test/lib/promises-aplus-tests-2.0.3/promises-aplus-tests.js', 40 | 'test/js/promise/Promise.js', 41 | 'test/js/promise/Chain.js' 42 | ], 43 | 44 | 45 | // list of files to exclude 46 | exclude: [ 47 | ], 48 | 49 | preprocessors: { 50 | 'build/deft-debug.js': ['coverage'] 51 | }, 52 | 53 | coverageReporter: { 54 | type: 'html', 55 | dir: 'test/coverage/ext/4.1.0' 56 | }, 57 | 58 | // test results reporter to use 59 | // possible values: 'dots', 'progress', 'junit', 'growl', 'coverage' 60 | reporters: ['dots'], 61 | 62 | 63 | // web server port 64 | port: 9876, 65 | 66 | 67 | // enable / disable colors in the output (reporters and logs) 68 | colors: true, 69 | 70 | 71 | // level of logging 72 | // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG 73 | logLevel: config.LOG_INFO, 74 | 75 | 76 | // enable / disable watching file and executing tests whenever any file changes 77 | autoWatch: true, 78 | 79 | 80 | // Start these browsers, currently available: 81 | // - Chrome 82 | // - ChromeCanary 83 | // - Firefox 84 | // - Opera (has to be installed with `npm install karma-opera-launcher`) 85 | // - Safari (only Mac; has to be installed with `npm install karma-safari-launcher`) 86 | // - PhantomJS 87 | // - IE (only Windows; has to be installed with `npm install karma-ie-launcher`) 88 | browsers: ['Chrome'], 89 | 90 | 91 | // If browser does not capture in given timeout [ms], kill it 92 | captureTimeout: 60000, 93 | 94 | 95 | // Continuous Integration mode 96 | // if true, it capture browsers, run tests and exit 97 | singleRun: false 98 | }); 99 | }; 100 | -------------------------------------------------------------------------------- /packages/deft/test/karma/ext/4.1.1a.conf.js: -------------------------------------------------------------------------------- 1 | // Karma configuration 2 | // Generated on Mon Jan 20 2014 05:41:33 GMT-0500 (EST) 3 | 4 | module.exports = function(config) { 5 | config.set({ 6 | 7 | // base path, that will be used to resolve files and exclude 8 | basePath: '../../..', 9 | 10 | 11 | // frameworks to use 12 | frameworks: ['mocha'], 13 | 14 | 15 | // list of files / patterns to load in the browser 16 | files: [ 17 | 'http://cdn.sencha.io/ext-4.1.1a-gpl/ext-all.js', 18 | 'build/deft-debug.js', 19 | 20 | 'test/lib/chai-1.8.1/chai.js', 21 | 'test/lib/sinon-1.7.3/sinon.js', 22 | 'test/lib/sinon-chai-2.4.0/sinon-chai.js', 23 | 'test/lib/sinon-sencha-1.0.0/sinon-sencha.js', 24 | 25 | 'test/support/browser.js', 26 | 'test/support/custom-assertions.js', 27 | 28 | 'test/lib/mocha-as-promised-2.0.0/mocha-as-promised.js', 29 | 'test/lib/chai-as-promised-4.1.0/chai-as-promised.js', 30 | 31 | 'test/js/custom-assertions.js', 32 | 33 | 'test/js/util/Function.js', 34 | 'test/js/log/Logger.js', 35 | 'test/js/ioc/Injector.js', 36 | 'test/js/mixin/Injectable.js', 37 | 'test/js/mixin/Controllable.js', 38 | 'test/js/mvc/ViewController.js', 39 | 'test/lib/promises-aplus-tests-2.0.3/promises-aplus-tests.js', 40 | 'test/js/promise/Promise.js', 41 | 'test/js/promise/Chain.js' 42 | ], 43 | 44 | 45 | // list of files to exclude 46 | exclude: [ 47 | ], 48 | 49 | preprocessors: { 50 | 'build/deft-debug.js': ['coverage'] 51 | }, 52 | 53 | coverageReporter: { 54 | type: 'html', 55 | dir: 'test/coverage/ext/4.1.1a' 56 | }, 57 | 58 | // test results reporter to use 59 | // possible values: 'dots', 'progress', 'junit', 'growl', 'coverage' 60 | reporters: ['dots'], 61 | 62 | 63 | // web server port 64 | port: 9876, 65 | 66 | 67 | // enable / disable colors in the output (reporters and logs) 68 | colors: true, 69 | 70 | 71 | // level of logging 72 | // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG 73 | logLevel: config.LOG_INFO, 74 | 75 | 76 | // enable / disable watching file and executing tests whenever any file changes 77 | autoWatch: true, 78 | 79 | 80 | // Start these browsers, currently available: 81 | // - Chrome 82 | // - ChromeCanary 83 | // - Firefox 84 | // - Opera (has to be installed with `npm install karma-opera-launcher`) 85 | // - Safari (only Mac; has to be installed with `npm install karma-safari-launcher`) 86 | // - PhantomJS 87 | // - IE (only Windows; has to be installed with `npm install karma-ie-launcher`) 88 | browsers: ['Chrome'], 89 | 90 | 91 | // If browser does not capture in given timeout [ms], kill it 92 | captureTimeout: 60000, 93 | 94 | 95 | // Continuous Integration mode 96 | // if true, it capture browsers, run tests and exit 97 | singleRun: false 98 | }); 99 | }; 100 | 101 | -------------------------------------------------------------------------------- /packages/deft/test/karma/ext/4.2.0.conf.js: -------------------------------------------------------------------------------- 1 | // Karma configuration 2 | // Generated on Mon Jan 20 2014 05:41:33 GMT-0500 (EST) 3 | 4 | module.exports = function(config) { 5 | config.set({ 6 | 7 | // base path, that will be used to resolve files and exclude 8 | basePath: '../../..', 9 | 10 | 11 | // frameworks to use 12 | frameworks: ['mocha'], 13 | 14 | 15 | // list of files / patterns to load in the browser 16 | files: [ 17 | 'http://cdn.sencha.io/ext-4.2.0-gpl/ext-all.js', 18 | 'build/deft-debug.js', 19 | 20 | 'test/lib/chai-1.8.1/chai.js', 21 | 'test/lib/sinon-1.7.3/sinon.js', 22 | 'test/lib/sinon-chai-2.4.0/sinon-chai.js', 23 | 'test/lib/sinon-sencha-1.0.0/sinon-sencha.js', 24 | 25 | 'test/support/browser.js', 26 | 'test/support/custom-assertions.js', 27 | 28 | 'test/lib/mocha-as-promised-2.0.0/mocha-as-promised.js', 29 | 'test/lib/chai-as-promised-4.1.0/chai-as-promised.js', 30 | 31 | 'test/js/custom-assertions.js', 32 | 33 | 'test/js/util/Function.js', 34 | 'test/js/log/Logger.js', 35 | 'test/js/ioc/Injector.js', 36 | 'test/js/mixin/Injectable.js', 37 | 'test/js/mixin/Controllable.js', 38 | 'test/js/mvc/ViewController.js', 39 | 'test/lib/promises-aplus-tests-2.0.3/promises-aplus-tests.js', 40 | 'test/js/promise/Promise.js', 41 | 'test/js/promise/Chain.js' 42 | ], 43 | 44 | 45 | // list of files to exclude 46 | exclude: [ 47 | ], 48 | 49 | preprocessors: { 50 | 'build/deft-debug.js': ['coverage'] 51 | }, 52 | 53 | coverageReporter: { 54 | type: 'html', 55 | dir: 'test/coverage/ext/4.2.0' 56 | }, 57 | 58 | // test results reporter to use 59 | // possible values: 'dots', 'progress', 'junit', 'growl', 'coverage' 60 | reporters: ['dots'], 61 | 62 | 63 | // web server port 64 | port: 9876, 65 | 66 | 67 | // enable / disable colors in the output (reporters and logs) 68 | colors: true, 69 | 70 | 71 | // level of logging 72 | // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG 73 | logLevel: config.LOG_INFO, 74 | 75 | 76 | // enable / disable watching file and executing tests whenever any file changes 77 | autoWatch: true, 78 | 79 | 80 | // Start these browsers, currently available: 81 | // - Chrome 82 | // - ChromeCanary 83 | // - Firefox 84 | // - Opera (has to be installed with `npm install karma-opera-launcher`) 85 | // - Safari (only Mac; has to be installed with `npm install karma-safari-launcher`) 86 | // - PhantomJS 87 | // - IE (only Windows; has to be installed with `npm install karma-ie-launcher`) 88 | browsers: ['Chrome'], 89 | 90 | 91 | // If browser does not capture in given timeout [ms], kill it 92 | captureTimeout: 60000, 93 | 94 | 95 | // Continuous Integration mode 96 | // if true, it capture browsers, run tests and exit 97 | singleRun: false 98 | }); 99 | }; 100 | -------------------------------------------------------------------------------- /packages/deft/test/karma/ext/4.2.1.conf.js: -------------------------------------------------------------------------------- 1 | // Karma configuration 2 | // Generated on Mon Jan 20 2014 05:41:33 GMT-0500 (EST) 3 | 4 | module.exports = function(config) { 5 | config.set({ 6 | 7 | // base path, that will be used to resolve files and exclude 8 | basePath: '../../..', 9 | 10 | 11 | // frameworks to use 12 | frameworks: ['mocha'], 13 | 14 | 15 | // list of files / patterns to load in the browser 16 | files: [ 17 | 'http://cdn.sencha.com/ext/gpl/4.2.1/ext-all.js', 18 | 'build/deft-debug.js', 19 | 20 | 'test/lib/chai-1.8.1/chai.js', 21 | 'test/lib/sinon-1.7.3/sinon.js', 22 | 'test/lib/sinon-chai-2.4.0/sinon-chai.js', 23 | 'test/lib/sinon-sencha-1.0.0/sinon-sencha.js', 24 | 25 | 'test/support/browser.js', 26 | 'test/support/custom-assertions.js', 27 | 28 | 'test/lib/mocha-as-promised-2.0.0/mocha-as-promised.js', 29 | 'test/lib/chai-as-promised-4.1.0/chai-as-promised.js', 30 | 31 | 'test/js/custom-assertions.js', 32 | 33 | 'test/js/util/Function.js', 34 | 'test/js/log/Logger.js', 35 | 'test/js/ioc/Injector.js', 36 | 'test/js/mixin/Injectable.js', 37 | 'test/js/mixin/Controllable.js', 38 | 'test/js/mvc/ViewController.js', 39 | 'test/lib/promises-aplus-tests-2.0.3/promises-aplus-tests.js', 40 | 'test/js/promise/Promise.js', 41 | 'test/js/promise/Chain.js' 42 | ], 43 | 44 | 45 | // list of files to exclude 46 | exclude: [ 47 | ], 48 | 49 | preprocessors: { 50 | 'build/deft-debug.js': ['coverage'] 51 | }, 52 | 53 | coverageReporter: { 54 | type: 'html', 55 | dir: 'test/coverage/ext/4.2.1' 56 | }, 57 | 58 | // test results reporter to use 59 | // possible values: 'dots', 'progress', 'junit', 'growl', 'coverage' 60 | reporters: ['dots'], 61 | 62 | 63 | // web server port 64 | port: 9876, 65 | 66 | 67 | // enable / disable colors in the output (reporters and logs) 68 | colors: true, 69 | 70 | 71 | // level of logging 72 | // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG 73 | logLevel: config.LOG_INFO, 74 | 75 | 76 | // enable / disable watching file and executing tests whenever any file changes 77 | autoWatch: true, 78 | 79 | 80 | // Start these browsers, currently available: 81 | // - Chrome 82 | // - ChromeCanary 83 | // - Firefox 84 | // - Opera (has to be installed with `npm install karma-opera-launcher`) 85 | // - Safari (only Mac; has to be installed with `npm install karma-safari-launcher`) 86 | // - PhantomJS 87 | // - IE (only Windows; has to be installed with `npm install karma-ie-launcher`) 88 | browsers: ['Chrome'], 89 | 90 | 91 | // If browser does not capture in given timeout [ms], kill it 92 | captureTimeout: 60000, 93 | 94 | 95 | // Continuous Integration mode 96 | // if true, it capture browsers, run tests and exit 97 | singleRun: false 98 | }); 99 | }; 100 | -------------------------------------------------------------------------------- /packages/deft/test/karma/touch/2.0.1.conf.js: -------------------------------------------------------------------------------- 1 | // Karma configuration 2 | // Generated on Mon Jan 20 2014 05:41:33 GMT-0500 (EST) 3 | 4 | module.exports = function(config) { 5 | config.set({ 6 | 7 | // base path, that will be used to resolve files and exclude 8 | basePath: '../../..', 9 | 10 | 11 | // frameworks to use 12 | frameworks: ['mocha'], 13 | 14 | 15 | // list of files / patterns to load in the browser 16 | files: [ 17 | 'http://cdn.sencha.io/touch/sencha-touch-2.0.1/sencha-touch-all.js', 18 | 'build/deft-debug.js', 19 | 20 | 'test/lib/chai-1.8.1/chai.js', 21 | 'test/lib/sinon-1.7.3/sinon.js', 22 | 'test/lib/sinon-chai-2.4.0/sinon-chai.js', 23 | 'test/lib/sinon-sencha-1.0.0/sinon-sencha.js', 24 | 25 | 'test/support/browser.js', 26 | 'test/support/custom-assertions.js', 27 | 28 | 'test/lib/mocha-as-promised-2.0.0/mocha-as-promised.js', 29 | 'test/lib/chai-as-promised-4.1.0/chai-as-promised.js', 30 | 31 | 'test/js/custom-assertions.js', 32 | 33 | 'test/js/util/Function.js', 34 | 'test/js/log/Logger.js', 35 | 'test/js/ioc/Injector.js', 36 | 'test/js/mixin/Injectable.js', 37 | 'test/js/mixin/Controllable.js', 38 | 'test/js/mvc/ViewController.js', 39 | 'test/lib/promises-aplus-tests-2.0.3/promises-aplus-tests.js', 40 | 'test/js/promise/Promise.js', 41 | 'test/js/promise/Chain.js' 42 | ], 43 | 44 | 45 | // list of files to exclude 46 | exclude: [ 47 | ], 48 | 49 | preprocessors: { 50 | 'build/deft-debug.js': ['coverage'] 51 | }, 52 | 53 | coverageReporter: { 54 | type: 'html', 55 | dir: 'test/coverage/touch/2.0.1' 56 | }, 57 | 58 | // test results reporter to use 59 | // possible values: 'dots', 'progress', 'junit', 'growl', 'coverage' 60 | reporters: ['dots'], 61 | 62 | 63 | // web server port 64 | port: 9876, 65 | 66 | 67 | // enable / disable colors in the output (reporters and logs) 68 | colors: true, 69 | 70 | 71 | // level of logging 72 | // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG 73 | logLevel: config.LOG_INFO, 74 | 75 | 76 | // enable / disable watching file and executing tests whenever any file changes 77 | autoWatch: true, 78 | 79 | 80 | // Start these browsers, currently available: 81 | // - Chrome 82 | // - ChromeCanary 83 | // - Firefox 84 | // - Opera (has to be installed with `npm install karma-opera-launcher`) 85 | // - Safari (only Mac; has to be installed with `npm install karma-safari-launcher`) 86 | // - PhantomJS 87 | // - IE (only Windows; has to be installed with `npm install karma-ie-launcher`) 88 | browsers: ['Chrome'], 89 | 90 | 91 | // If browser does not capture in given timeout [ms], kill it 92 | captureTimeout: 60000, 93 | 94 | 95 | // Continuous Integration mode 96 | // if true, it capture browsers, run tests and exit 97 | singleRun: false 98 | }); 99 | }; 100 | -------------------------------------------------------------------------------- /packages/deft/test/karma/touch/2.1.0.conf.js: -------------------------------------------------------------------------------- 1 | // Karma configuration 2 | // Generated on Mon Jan 20 2014 05:41:33 GMT-0500 (EST) 3 | 4 | module.exports = function(config) { 5 | config.set({ 6 | 7 | // base path, that will be used to resolve files and exclude 8 | basePath: '../../..', 9 | 10 | 11 | // frameworks to use 12 | frameworks: ['mocha'], 13 | 14 | 15 | // list of files / patterns to load in the browser 16 | files: [ 17 | 'http://cdn.sencha.io/touch/sencha-touch-2.1.0/sencha-touch-all.js', 18 | 'build/deft-debug.js', 19 | 20 | 'test/lib/chai-1.8.1/chai.js', 21 | 'test/lib/sinon-1.7.3/sinon.js', 22 | 'test/lib/sinon-chai-2.4.0/sinon-chai.js', 23 | 'test/lib/sinon-sencha-1.0.0/sinon-sencha.js', 24 | 25 | 'test/support/browser.js', 26 | 'test/support/custom-assertions.js', 27 | 28 | 'test/lib/mocha-as-promised-2.0.0/mocha-as-promised.js', 29 | 'test/lib/chai-as-promised-4.1.0/chai-as-promised.js', 30 | 31 | 'test/js/custom-assertions.js', 32 | 33 | 'test/js/util/Function.js', 34 | 'test/js/log/Logger.js', 35 | 'test/js/ioc/Injector.js', 36 | 'test/js/mixin/Injectable.js', 37 | 'test/js/mixin/Controllable.js', 38 | 'test/js/mvc/ViewController.js', 39 | 'test/lib/promises-aplus-tests-2.0.3/promises-aplus-tests.js', 40 | 'test/js/promise/Promise.js', 41 | 'test/js/promise/Chain.js' 42 | ], 43 | 44 | 45 | // list of files to exclude 46 | exclude: [ 47 | ], 48 | 49 | preprocessors: { 50 | 'build/deft-debug.js': ['coverage'] 51 | }, 52 | 53 | coverageReporter: { 54 | type: 'html', 55 | dir: 'test/coverage/touch/2.1.0' 56 | }, 57 | 58 | // test results reporter to use 59 | // possible values: 'dots', 'progress', 'junit', 'growl', 'coverage' 60 | reporters: ['dots'], 61 | 62 | 63 | // web server port 64 | port: 9876, 65 | 66 | 67 | // enable / disable colors in the output (reporters and logs) 68 | colors: true, 69 | 70 | 71 | // level of logging 72 | // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG 73 | logLevel: config.LOG_INFO, 74 | 75 | 76 | // enable / disable watching file and executing tests whenever any file changes 77 | autoWatch: true, 78 | 79 | 80 | // Start these browsers, currently available: 81 | // - Chrome 82 | // - ChromeCanary 83 | // - Firefox 84 | // - Opera (has to be installed with `npm install karma-opera-launcher`) 85 | // - Safari (only Mac; has to be installed with `npm install karma-safari-launcher`) 86 | // - PhantomJS 87 | // - IE (only Windows; has to be installed with `npm install karma-ie-launcher`) 88 | browsers: ['Chrome'], 89 | 90 | 91 | // If browser does not capture in given timeout [ms], kill it 92 | captureTimeout: 60000, 93 | 94 | 95 | // Continuous Integration mode 96 | // if true, it capture browsers, run tests and exit 97 | singleRun: false 98 | }); 99 | }; 100 | -------------------------------------------------------------------------------- /packages/deft/test/karma/touch/2.1.1.conf.js: -------------------------------------------------------------------------------- 1 | // Karma configuration 2 | // Generated on Mon Jan 20 2014 05:41:33 GMT-0500 (EST) 3 | 4 | module.exports = function(config) { 5 | config.set({ 6 | 7 | // base path, that will be used to resolve files and exclude 8 | basePath: '../../..', 9 | 10 | 11 | // frameworks to use 12 | frameworks: ['mocha'], 13 | 14 | 15 | // list of files / patterns to load in the browser 16 | files: [ 17 | 'http://cdn.sencha.io/touch/sencha-touch-2.1.1/sencha-touch-all.js', 18 | 'build/deft-debug.js', 19 | 20 | 'test/lib/chai-1.8.1/chai.js', 21 | 'test/lib/sinon-1.7.3/sinon.js', 22 | 'test/lib/sinon-chai-2.4.0/sinon-chai.js', 23 | 'test/lib/sinon-sencha-1.0.0/sinon-sencha.js', 24 | 25 | 'test/support/browser.js', 26 | 'test/support/custom-assertions.js', 27 | 28 | 'test/lib/mocha-as-promised-2.0.0/mocha-as-promised.js', 29 | 'test/lib/chai-as-promised-4.1.0/chai-as-promised.js', 30 | 31 | 'test/js/custom-assertions.js', 32 | 33 | 'test/js/util/Function.js', 34 | 'test/js/log/Logger.js', 35 | 'test/js/ioc/Injector.js', 36 | 'test/js/mixin/Injectable.js', 37 | 'test/js/mixin/Controllable.js', 38 | 'test/js/mvc/ViewController.js', 39 | 'test/lib/promises-aplus-tests-2.0.3/promises-aplus-tests.js', 40 | 'test/js/promise/Promise.js', 41 | 'test/js/promise/Chain.js' 42 | ], 43 | 44 | 45 | // list of files to exclude 46 | exclude: [ 47 | ], 48 | 49 | preprocessors: { 50 | 'build/deft-debug.js': ['coverage'] 51 | }, 52 | 53 | coverageReporter: { 54 | type: 'html', 55 | dir: 'test/coverage/touch/2.1.1' 56 | }, 57 | 58 | // test results reporter to use 59 | // possible values: 'dots', 'progress', 'junit', 'growl', 'coverage' 60 | reporters: ['dots'], 61 | 62 | 63 | // web server port 64 | port: 9876, 65 | 66 | 67 | // enable / disable colors in the output (reporters and logs) 68 | colors: true, 69 | 70 | 71 | // level of logging 72 | // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG 73 | logLevel: config.LOG_INFO, 74 | 75 | 76 | // enable / disable watching file and executing tests whenever any file changes 77 | autoWatch: true, 78 | 79 | 80 | // Start these browsers, currently available: 81 | // - Chrome 82 | // - ChromeCanary 83 | // - Firefox 84 | // - Opera (has to be installed with `npm install karma-opera-launcher`) 85 | // - Safari (only Mac; has to be installed with `npm install karma-safari-launcher`) 86 | // - PhantomJS 87 | // - IE (only Windows; has to be installed with `npm install karma-ie-launcher`) 88 | browsers: ['Chrome'], 89 | 90 | 91 | // If browser does not capture in given timeout [ms], kill it 92 | captureTimeout: 60000, 93 | 94 | 95 | // Continuous Integration mode 96 | // if true, it capture browsers, run tests and exit 97 | singleRun: false 98 | }); 99 | }; 100 | 101 | -------------------------------------------------------------------------------- /packages/deft/test/karma/touch/2.2.0.conf.js: -------------------------------------------------------------------------------- 1 | // Karma configuration 2 | // Generated on Mon Jan 20 2014 05:41:33 GMT-0500 (EST) 3 | 4 | module.exports = function(config) { 5 | config.set({ 6 | 7 | // base path, that will be used to resolve files and exclude 8 | basePath: '../../..', 9 | 10 | 11 | // frameworks to use 12 | frameworks: ['mocha'], 13 | 14 | 15 | // list of files / patterns to load in the browser 16 | files: [ 17 | 'http://cdn.sencha.io/touch/sencha-touch-2.2.0/sencha-touch-all.js', 18 | 'build/deft-debug.js', 19 | 20 | 'test/lib/chai-1.8.1/chai.js', 21 | 'test/lib/sinon-1.7.3/sinon.js', 22 | 'test/lib/sinon-chai-2.4.0/sinon-chai.js', 23 | 'test/lib/sinon-sencha-1.0.0/sinon-sencha.js', 24 | 25 | 'test/support/browser.js', 26 | 'test/support/custom-assertions.js', 27 | 28 | 'test/lib/mocha-as-promised-2.0.0/mocha-as-promised.js', 29 | 'test/lib/chai-as-promised-4.1.0/chai-as-promised.js', 30 | 31 | 'test/js/custom-assertions.js', 32 | 33 | 'test/js/util/Function.js', 34 | 'test/js/log/Logger.js', 35 | 'test/js/ioc/Injector.js', 36 | 'test/js/mixin/Injectable.js', 37 | 'test/js/mixin/Controllable.js', 38 | 'test/js/mvc/ViewController.js', 39 | 'test/lib/promises-aplus-tests-2.0.3/promises-aplus-tests.js', 40 | 'test/js/promise/Promise.js', 41 | 'test/js/promise/Chain.js' 42 | ], 43 | 44 | 45 | // list of files to exclude 46 | exclude: [ 47 | ], 48 | 49 | preprocessors: { 50 | 'build/deft-debug.js': ['coverage'] 51 | }, 52 | 53 | coverageReporter: { 54 | type: 'html', 55 | dir: 'test/coverage/touch/2.2.0' 56 | }, 57 | 58 | // test results reporter to use 59 | // possible values: 'dots', 'progress', 'junit', 'growl', 'coverage' 60 | reporters: ['dots'], 61 | 62 | 63 | // web server port 64 | port: 9876, 65 | 66 | 67 | // enable / disable colors in the output (reporters and logs) 68 | colors: true, 69 | 70 | 71 | // level of logging 72 | // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG 73 | logLevel: config.LOG_INFO, 74 | 75 | 76 | // enable / disable watching file and executing tests whenever any file changes 77 | autoWatch: true, 78 | 79 | 80 | // Start these browsers, currently available: 81 | // - Chrome 82 | // - ChromeCanary 83 | // - Firefox 84 | // - Opera (has to be installed with `npm install karma-opera-launcher`) 85 | // - Safari (only Mac; has to be installed with `npm install karma-safari-launcher`) 86 | // - PhantomJS 87 | // - IE (only Windows; has to be installed with `npm install karma-ie-launcher`) 88 | browsers: ['Chrome'], 89 | 90 | 91 | // If browser does not capture in given timeout [ms], kill it 92 | captureTimeout: 60000, 93 | 94 | 95 | // Continuous Integration mode 96 | // if true, it capture browsers, run tests and exit 97 | singleRun: false 98 | }); 99 | }; 100 | -------------------------------------------------------------------------------- /packages/deft/test/karma/touch/2.2.1.conf.js: -------------------------------------------------------------------------------- 1 | // Karma configuration 2 | // Generated on Mon Jan 20 2014 05:41:33 GMT-0500 (EST) 3 | 4 | module.exports = function(config) { 5 | config.set({ 6 | 7 | // base path, that will be used to resolve files and exclude 8 | basePath: '../../..', 9 | 10 | 11 | // frameworks to use 12 | frameworks: ['mocha'], 13 | 14 | 15 | // list of files / patterns to load in the browser 16 | files: [ 17 | 'http://cdn.sencha.io/touch/sencha-touch-2.2.1/sencha-touch-all.js', 18 | 'build/deft-debug.js', 19 | 20 | 'test/lib/chai-1.8.1/chai.js', 21 | 'test/lib/sinon-1.7.3/sinon.js', 22 | 'test/lib/sinon-chai-2.4.0/sinon-chai.js', 23 | 'test/lib/sinon-sencha-1.0.0/sinon-sencha.js', 24 | 25 | 'test/support/browser.js', 26 | 'test/support/custom-assertions.js', 27 | 28 | 'test/lib/mocha-as-promised-2.0.0/mocha-as-promised.js', 29 | 'test/lib/chai-as-promised-4.1.0/chai-as-promised.js', 30 | 31 | 'test/js/custom-assertions.js', 32 | 33 | 'test/js/util/Function.js', 34 | 'test/js/log/Logger.js', 35 | 'test/js/ioc/Injector.js', 36 | 'test/js/mixin/Injectable.js', 37 | 'test/js/mixin/Controllable.js', 38 | 'test/js/mvc/ViewController.js', 39 | 'test/lib/promises-aplus-tests-2.0.3/promises-aplus-tests.js', 40 | 'test/js/promise/Promise.js', 41 | 'test/js/promise/Chain.js' 42 | ], 43 | 44 | 45 | // list of files to exclude 46 | exclude: [ 47 | ], 48 | 49 | preprocessors: { 50 | 'build/deft-debug.js': ['coverage'] 51 | }, 52 | 53 | coverageReporter: { 54 | type: 'html', 55 | dir: 'test/coverage/touch/2.2.1' 56 | }, 57 | 58 | // test results reporter to use 59 | // possible values: 'dots', 'progress', 'junit', 'growl', 'coverage' 60 | reporters: ['dots'], 61 | 62 | 63 | // web server port 64 | port: 9876, 65 | 66 | 67 | // enable / disable colors in the output (reporters and logs) 68 | colors: true, 69 | 70 | 71 | // level of logging 72 | // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG 73 | logLevel: config.LOG_INFO, 74 | 75 | 76 | // enable / disable watching file and executing tests whenever any file changes 77 | autoWatch: true, 78 | 79 | 80 | // Start these browsers, currently available: 81 | // - Chrome 82 | // - ChromeCanary 83 | // - Firefox 84 | // - Opera (has to be installed with `npm install karma-opera-launcher`) 85 | // - Safari (only Mac; has to be installed with `npm install karma-safari-launcher`) 86 | // - PhantomJS 87 | // - IE (only Windows; has to be installed with `npm install karma-ie-launcher`) 88 | browsers: ['Chrome'], 89 | 90 | 91 | // If browser does not capture in given timeout [ms], kill it 92 | captureTimeout: 60000, 93 | 94 | 95 | // Continuous Integration mode 96 | // if true, it capture browsers, run tests and exit 97 | singleRun: false 98 | }); 99 | }; 100 | -------------------------------------------------------------------------------- /packages/deft/test/karma/touch/2.3.0.conf.js: -------------------------------------------------------------------------------- 1 | // Karma configuration 2 | // Generated on Mon Jan 20 2014 05:41:33 GMT-0500 (EST) 3 | 4 | module.exports = function(config) { 5 | config.set({ 6 | 7 | // base path, that will be used to resolve files and exclude 8 | basePath: '../../..', 9 | 10 | 11 | // frameworks to use 12 | frameworks: ['mocha'], 13 | 14 | 15 | // list of files / patterns to load in the browser 16 | files: [ 17 | 'http://cdn.sencha.io/touch/sencha-touch-2.3.0/sencha-touch-all.js', 18 | 'build/deft-debug.js', 19 | 20 | 'test/lib/chai-1.8.1/chai.js', 21 | 'test/lib/sinon-1.7.3/sinon.js', 22 | 'test/lib/sinon-chai-2.4.0/sinon-chai.js', 23 | 'test/lib/sinon-sencha-1.0.0/sinon-sencha.js', 24 | 25 | 'test/support/browser.js', 26 | 'test/support/custom-assertions.js', 27 | 28 | 'test/lib/mocha-as-promised-2.0.0/mocha-as-promised.js', 29 | 'test/lib/chai-as-promised-4.1.0/chai-as-promised.js', 30 | 31 | 'test/js/custom-assertions.js', 32 | 33 | 'test/js/util/Function.js', 34 | 'test/js/log/Logger.js', 35 | 'test/js/ioc/Injector.js', 36 | 'test/js/mixin/Injectable.js', 37 | 'test/js/mixin/Controllable.js', 38 | 'test/js/mvc/ViewController.js', 39 | 'test/lib/promises-aplus-tests-2.0.3/promises-aplus-tests.js', 40 | 'test/js/promise/Promise.js', 41 | 'test/js/promise/Chain.js' 42 | ], 43 | 44 | 45 | // list of files to exclude 46 | exclude: [ 47 | ], 48 | 49 | preprocessors: { 50 | 'build/deft-debug.js': ['coverage'] 51 | }, 52 | 53 | coverageReporter: { 54 | type: 'html', 55 | dir: 'test/coverage/touch/2.2.1' 56 | }, 57 | 58 | // test results reporter to use 59 | // possible values: 'dots', 'progress', 'junit', 'growl', 'coverage' 60 | reporters: ['dots'], 61 | 62 | 63 | // web server port 64 | port: 9876, 65 | 66 | 67 | // enable / disable colors in the output (reporters and logs) 68 | colors: true, 69 | 70 | 71 | // level of logging 72 | // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG 73 | logLevel: config.LOG_INFO, 74 | 75 | 76 | // enable / disable watching file and executing tests whenever any file changes 77 | autoWatch: true, 78 | 79 | 80 | // Start these browsers, currently available: 81 | // - Chrome 82 | // - ChromeCanary 83 | // - Firefox 84 | // - Opera (has to be installed with `npm install karma-opera-launcher`) 85 | // - Safari (only Mac; has to be installed with `npm install karma-safari-launcher`) 86 | // - PhantomJS 87 | // - IE (only Windows; has to be installed with `npm install karma-ie-launcher`) 88 | browsers: ['Chrome'], 89 | 90 | 91 | // If browser does not capture in given timeout [ms], kill it 92 | captureTimeout: 60000, 93 | 94 | 95 | // Continuous Integration mode 96 | // if true, it capture browsers, run tests and exit 97 | singleRun: false 98 | }); 99 | }; 100 | -------------------------------------------------------------------------------- /packages/deft/test/lib/mocha-1.17.0/mocha.css: -------------------------------------------------------------------------------- 1 | @charset "utf-8"; 2 | 3 | body { 4 | margin:0; 5 | } 6 | 7 | #mocha { 8 | font: 20px/1.5 "Helvetica Neue", Helvetica, Arial, sans-serif; 9 | margin: 60px 50px; 10 | } 11 | 12 | #mocha ul, 13 | #mocha li { 14 | margin: 0; 15 | padding: 0; 16 | } 17 | 18 | #mocha ul { 19 | list-style: none; 20 | } 21 | 22 | #mocha h1, 23 | #mocha h2 { 24 | margin: 0; 25 | } 26 | 27 | #mocha h1 { 28 | margin-top: 15px; 29 | font-size: 1em; 30 | font-weight: 200; 31 | } 32 | 33 | #mocha h1 a { 34 | text-decoration: none; 35 | color: inherit; 36 | } 37 | 38 | #mocha h1 a:hover { 39 | text-decoration: underline; 40 | } 41 | 42 | #mocha .suite .suite h1 { 43 | margin-top: 0; 44 | font-size: .8em; 45 | } 46 | 47 | #mocha .hidden { 48 | display: none; 49 | } 50 | 51 | #mocha h2 { 52 | font-size: 12px; 53 | font-weight: normal; 54 | cursor: pointer; 55 | } 56 | 57 | #mocha .suite { 58 | margin-left: 15px; 59 | } 60 | 61 | #mocha .test { 62 | margin-left: 15px; 63 | overflow: hidden; 64 | } 65 | 66 | #mocha .test.pending:hover h2::after { 67 | content: '(pending)'; 68 | font-family: arial, sans-serif; 69 | } 70 | 71 | #mocha .test.pass.medium .duration { 72 | background: #c09853; 73 | } 74 | 75 | #mocha .test.pass.slow .duration { 76 | background: #b94a48; 77 | } 78 | 79 | #mocha .test.pass::before { 80 | content: '✓'; 81 | font-size: 12px; 82 | display: block; 83 | float: left; 84 | margin-right: 5px; 85 | color: #00d6b2; 86 | } 87 | 88 | #mocha .test.pass .duration { 89 | font-size: 9px; 90 | margin-left: 5px; 91 | padding: 2px 5px; 92 | color: #fff; 93 | -webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.2); 94 | -moz-box-shadow: inset 0 1px 1px rgba(0,0,0,.2); 95 | box-shadow: inset 0 1px 1px rgba(0,0,0,.2); 96 | -webkit-border-radius: 5px; 97 | -moz-border-radius: 5px; 98 | -ms-border-radius: 5px; 99 | -o-border-radius: 5px; 100 | border-radius: 5px; 101 | } 102 | 103 | #mocha .test.pass.fast .duration { 104 | display: none; 105 | } 106 | 107 | #mocha .test.pending { 108 | color: #0b97c4; 109 | } 110 | 111 | #mocha .test.pending::before { 112 | content: '◦'; 113 | color: #0b97c4; 114 | } 115 | 116 | #mocha .test.fail { 117 | color: #c00; 118 | } 119 | 120 | #mocha .test.fail pre { 121 | color: black; 122 | } 123 | 124 | #mocha .test.fail::before { 125 | content: '✖'; 126 | font-size: 12px; 127 | display: block; 128 | float: left; 129 | margin-right: 5px; 130 | color: #c00; 131 | } 132 | 133 | #mocha .test pre.error { 134 | color: #c00; 135 | max-height: 300px; 136 | overflow: auto; 137 | } 138 | 139 | /** 140 | * (1): approximate for browsers not supporting calc 141 | * (2): 42 = 2*15 + 2*10 + 2*1 (padding + margin + border) 142 | * ^^ seriously 143 | */ 144 | #mocha .test pre { 145 | display: block; 146 | float: left; 147 | clear: left; 148 | font: 12px/1.5 monaco, monospace; 149 | margin: 5px; 150 | padding: 15px; 151 | border: 1px solid #eee; 152 | max-width: 85%; /*(1)*/ 153 | max-width: calc(100% - 42px); /*(2)*/ 154 | word-wrap: break-word; 155 | border-bottom-color: #ddd; 156 | -webkit-border-radius: 3px; 157 | -webkit-box-shadow: 0 1px 3px #eee; 158 | -moz-border-radius: 3px; 159 | -moz-box-shadow: 0 1px 3px #eee; 160 | border-radius: 3px; 161 | } 162 | 163 | #mocha .test h2 { 164 | position: relative; 165 | } 166 | 167 | #mocha .test a.replay { 168 | position: absolute; 169 | top: 3px; 170 | right: 0; 171 | text-decoration: none; 172 | vertical-align: middle; 173 | display: block; 174 | width: 15px; 175 | height: 15px; 176 | line-height: 15px; 177 | text-align: center; 178 | background: #eee; 179 | font-size: 15px; 180 | -moz-border-radius: 15px; 181 | border-radius: 15px; 182 | -webkit-transition: opacity 200ms; 183 | -moz-transition: opacity 200ms; 184 | transition: opacity 200ms; 185 | opacity: 0.3; 186 | color: #888; 187 | } 188 | 189 | #mocha .test:hover a.replay { 190 | opacity: 1; 191 | } 192 | 193 | #mocha-report.pass .test.fail { 194 | display: none; 195 | } 196 | 197 | #mocha-report.fail .test.pass { 198 | display: none; 199 | } 200 | 201 | #mocha-report.pending .test.pass, 202 | #mocha-report.pending .test.fail { 203 | display: none; 204 | } 205 | #mocha-report.pending .test.pass.pending { 206 | display: block; 207 | } 208 | 209 | #mocha-error { 210 | color: #c00; 211 | font-size: 1.5em; 212 | font-weight: 100; 213 | letter-spacing: 1px; 214 | } 215 | 216 | #mocha-stats { 217 | position: fixed; 218 | top: 15px; 219 | right: 10px; 220 | font-size: 12px; 221 | margin: 0; 222 | color: #888; 223 | z-index: 1; 224 | } 225 | 226 | #mocha-stats .progress { 227 | float: right; 228 | padding-top: 0; 229 | } 230 | 231 | #mocha-stats em { 232 | color: black; 233 | } 234 | 235 | #mocha-stats a { 236 | text-decoration: none; 237 | color: inherit; 238 | } 239 | 240 | #mocha-stats a:hover { 241 | border-bottom: 1px solid #eee; 242 | } 243 | 244 | #mocha-stats li { 245 | display: inline-block; 246 | margin: 0 5px; 247 | list-style: none; 248 | padding-top: 11px; 249 | } 250 | 251 | #mocha-stats canvas { 252 | width: 40px; 253 | height: 40px; 254 | } 255 | 256 | #mocha code .comment { color: #ddd; } 257 | #mocha code .init { color: #2f6fad; } 258 | #mocha code .string { color: #5890ad; } 259 | #mocha code .keyword { color: #8a6343; } 260 | #mocha code .number { color: #2f6fad; } 261 | 262 | @media screen and (max-device-width: 480px) { 263 | #mocha { 264 | margin: 60px 0px; 265 | } 266 | 267 | #mocha #stats { 268 | position: absolute; 269 | } 270 | } 271 | -------------------------------------------------------------------------------- /packages/deft/test/lib/mocha-as-promised-2.0.0/mocha-as-promised.js: -------------------------------------------------------------------------------- 1 | (function (mochaAsPromised) { 2 | "use strict"; 3 | 4 | function findNodeJSMocha(moduleToTest, suffix, accumulator) { 5 | if (accumulator === undefined) { 6 | accumulator = []; 7 | } 8 | 9 | if (moduleToTest.id.indexOf(suffix, moduleToTest.id.length - suffix.length) !== -1 && moduleToTest.exports) { 10 | accumulator.push(moduleToTest.exports); 11 | } 12 | 13 | moduleToTest.children.forEach(function (child) { 14 | findNodeJSMocha(child, suffix, accumulator); 15 | }); 16 | 17 | return accumulator; 18 | } 19 | 20 | // Module systems magic dance. 21 | 22 | if (typeof require === "function" && typeof exports === "object" && typeof module === "object") { 23 | // Node.js: plug in automatically, if no argument is provided. This is a good idea since one can run Mocha tests 24 | // using the Mocha test runner from either a locally-installed package, or from a globally-installed one. 25 | // In the latter case, naively plugging in `require("mocha")` would end up duck-punching the wrong instance, 26 | // so we provide this shortcut to auto-detect which Mocha package needs to be duck-punched. 27 | module.exports = function (mochaModules) { 28 | if (mochaModules === undefined) { 29 | if (typeof process === "object" && Object.prototype.toString.call(process) === "[object process]") { 30 | // We're in *real* Node.js, not in a browserify-like environment. Do automatic detection logic. 31 | 32 | // Funky syntax prevents Browserify from detecting the require, since it's needed for Node.js-only 33 | // stuff. 34 | var path = (require)("path"); 35 | var suffix = path.join("mocha", "lib", "mocha.js"); 36 | mochaModules = findNodeJSMocha(require.main, suffix); 37 | 38 | if (mochaModules === undefined) { 39 | throw new Error("Attempted to automatically plug in to Mocha, but could not detect a " + 40 | "running Mocha module."); 41 | } 42 | 43 | } else if (typeof Mocha !== "undefined") { 44 | // We're in a browserify-like emulation environment. Try the `Mocha` global. 45 | mochaModules = [Mocha]; 46 | } else { 47 | throw new Error("Attempted to automatically plug in to Mocha, but could not detect the " + 48 | "environment. Plug in manually by passing the running Mocha module."); 49 | } 50 | } 51 | 52 | mochaModules.forEach(mochaAsPromised); 53 | }; 54 | } else if (typeof define === "function" && define.amd) { 55 | // AMD 56 | define(function () { 57 | return mochaAsPromised; 58 | }); 59 | } else { 60 | // Other environment (usually