├── .circleci └── config.yml ├── .editorconfig ├── .eslintrc.json ├── .gitignore ├── .npmignore ├── CONTRIBUTING.md ├── ISSUE_TEMPLATE.md ├── LICENSE ├── README.md ├── bower.json ├── build ├── args.js ├── babel-options.js ├── paths.js ├── tasks │ ├── build.js │ ├── clean.js │ ├── dev.js │ ├── doc.js │ ├── lint.js │ ├── prepare-release.js │ └── test.js └── typescript-options.js ├── config.js ├── dist ├── amd │ ├── aurelia-pal.js │ └── index.js ├── aurelia-pal.d.ts ├── aurelia-pal.js ├── commonjs │ ├── aurelia-pal.js │ └── index.js ├── es2015 │ ├── aurelia-pal.js │ └── index.js ├── index.d.ts ├── native-modules │ ├── aurelia-pal.js │ └── index.js └── system │ ├── aurelia-pal.js │ └── index.js ├── doc ├── CHANGELOG.md └── api.json ├── gulpfile.js ├── karma.conf.js ├── package-lock.json ├── package.json ├── src └── index.js ├── test └── dom.spec.js ├── tsconfig.json └── typings.json /.circleci/config.yml: -------------------------------------------------------------------------------- 1 | version: 2.1 2 | 3 | map-1: &filter_only_develop 4 | filters: 5 | branches: 6 | only: develop 7 | 8 | map-2: &filter_only_tag 9 | filters: 10 | branches: 11 | ignore: /.*/ 12 | tags: 13 | only: /^v?[0-9]+(\.[0-9]+)*$/ 14 | 15 | orbs: 16 | v1: aurelia/v1@volatile 17 | 18 | workflows: 19 | main: 20 | jobs: 21 | - v1/build_test 22 | - v1/build_merge: 23 | <<: *filter_only_develop 24 | requires: 25 | - v1/build_test 26 | - v1/npm_publish: 27 | <<: *filter_only_tag 28 | name: npm_publish_dry 29 | args: "--dry-run" 30 | - request_publish_latest: 31 | <<: *filter_only_tag 32 | type: approval 33 | requires: 34 | - npm_publish_dry 35 | - v1/npm_publish: 36 | <<: *filter_only_tag 37 | name: npm_publish 38 | context: Aurelia 39 | requires: 40 | - request_publish_latest 41 | - v1/merge_back: 42 | <<: *filter_only_tag 43 | requires: 44 | - npm_publish 45 | 46 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # EditorConfig is awesome: http://EditorConfig.org 2 | 3 | # top-most EditorConfig file 4 | root = true 5 | 6 | # Unix-style newlines with a newline ending every file 7 | [*] 8 | end_of_line = lf 9 | insert_final_newline = true 10 | 11 | # 2 space indentation 12 | [**.*] 13 | indent_style = space 14 | indent_size = 2 -------------------------------------------------------------------------------- /.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./node_modules/aurelia-tools/.eslintrc.json", 3 | "rules": { 4 | "no-new-func": 0 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | jspm_packages 3 | bower_components 4 | .idea 5 | .DS_STORE 6 | build/reports 7 | dist 8 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | jspm_packages 2 | bower_components 3 | .idea -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | We'd love for you to contribute and to make this project even better than it is today! If this interests you, please begin by reading [our contributing guidelines](https://github.com/DurandalProject/about/blob/master/CONTRIBUTING.md). The contributing document will provide you with all the information you need to get started. Once you have read that, you will need to also [sign our CLA](http://goo.gl/forms/dI8QDDSyKR) before we can accept a Pull Request from you. More information on the process is included in the [contributor's guide](https://github.com/DurandalProject/about/blob/master/CONTRIBUTING.md). 4 | -------------------------------------------------------------------------------- /ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 19 | **I'm submitting a bug report** 20 | **I'm submitting a feature request** 21 | 22 | * **Library Version:** 23 | major.minor.patch-pre 24 | 25 | 26 | **Please tell us about your environment:** 27 | * **Operating System:** 28 | OSX 10.x|Linux (distro)|Windows [7|8|8.1|10] 29 | 30 | * **Node Version:** 31 | 6.2.0 32 | 36 | 37 | * **NPM Version:** 38 | 3.8.9 39 | 43 | 44 | * **JSPM OR Webpack AND Version** 45 | JSPM 0.16.32 | webpack 2.1.0-beta.17 46 | 52 | 53 | * **Browser:** 54 | all | Chrome XX | Firefox XX | Edge XX | IE XX | Safari XX | Mobile Chrome XX | Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView 55 | 56 | * **Language:** 57 | all | TypeScript X.X | ESNext 58 | 59 | 60 | **Current behavior:** 61 | 62 | 63 | **Expected/desired behavior:** 64 | 71 | 72 | 73 | * **What is the expected behavior?** 74 | 75 | 76 | * **What is the motivation / use case for changing the behavior?** 77 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2010 - 2018 Blue Spire Inc. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # aurelia-pal 2 | 3 | [![npm Version](https://img.shields.io/npm/v/aurelia-pal.svg)](https://www.npmjs.com/package/aurelia-pal) 4 | [![ZenHub](https://raw.githubusercontent.com/ZenHubIO/support/master/zenhub-badge.png)](https://zenhub.io) 5 | [![Join the chat at https://gitter.im/aurelia/discuss](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/aurelia/discuss?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) 6 | [![CircleCI](https://circleci.com/gh/aurelia/pal.svg?style=shield)](https://circleci.com/gh/aurelia/pal) 7 | 8 | This library is part of the [Aurelia](http://www.aurelia.io/) platform and contains the platform abstraction layer. 9 | 10 | > To keep up to date on [Aurelia](http://www.aurelia.io/), please visit and subscribe to [the official blog](http://blog.aurelia.io/) and [our email list](http://eepurl.com/ces50j). We also invite you to [follow us on twitter](https://twitter.com/aureliaeffect). If you have questions, please [join our community on Gitter](https://gitter.im/aurelia/discuss) or use [stack overflow](http://stackoverflow.com/search?q=aurelia). Documentation can be found [in our developer hub](http://aurelia.io/hub.html). If you would like to have deeper insight into our development process, please install the [ZenHub](https://zenhub.io) Chrome or Firefox Extension and visit any of our repository's boards. 11 | 12 | ## Platform Support 13 | 14 | This library can be used in the **browser** as well as on the **server**. 15 | 16 | ## Building The Code 17 | 18 | To build the code, follow these steps. 19 | 20 | 1. Ensure that [NodeJS](http://nodejs.org/) is installed. This provides the platform on which the build tooling runs. 21 | 2. From the project folder, execute the following command: 22 | 23 | ```shell 24 | npm install 25 | ``` 26 | 3. Ensure that [Gulp](http://gulpjs.com/) is installed. If you need to install it, use the following command: 27 | 28 | ```shell 29 | npm install -g gulp 30 | ``` 31 | 4. To build the code, you can now run: 32 | 33 | ```shell 34 | gulp build 35 | ``` 36 | 5. You will find the compiled code in the `dist` folder, available in three module formats: AMD, CommonJS and ES6. 37 | 38 | 6. See `gulpfile.js` for other tasks related to generating the docs and linting. 39 | 40 | ## Running The Tests 41 | 42 | To run the unit tests, first ensure that you have followed the steps above in order to install all dependencies and successfully build the library. Once you have done that, proceed with these additional steps: 43 | 44 | 1. Ensure that the [Karma](http://karma-runner.github.io/) CLI is installed. If you need to install it, use the following command: 45 | 46 | ```shell 47 | npm install -g karma-cli 48 | ``` 49 | 2. Ensure that [jspm](http://jspm.io/) is installed. If you need to install it, use the following commnand: 50 | 51 | ```shell 52 | npm install -g jspm 53 | ``` 54 | 3. Download the [SystemJS](https://github.com/systemjs/systemjs) module loader: 55 | 56 | ```shell 57 | jspm dl-loader 58 | ``` 59 | 60 | 4. You can now run the tests with this command: 61 | 62 | ```shell 63 | karma start 64 | ``` 65 | -------------------------------------------------------------------------------- /bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "aurelia-pal", 3 | "version": "1.8.3", 4 | "description": "Aurelia's platform abstraction layer (PAL).", 5 | "keywords": [ 6 | "aurelia", 7 | "pal" 8 | ], 9 | "homepage": "http://aurelia.io", 10 | "main": "dist/commonjs/aurelia-pal.js", 11 | "moduleType": "node", 12 | "license": "MIT", 13 | "authors": [ 14 | "Rob Eisenberg (http://robeisenberg.com/)" 15 | ], 16 | "repository": { 17 | "type": "git", 18 | "url": "http://github.com/aurelia/pal" 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /build/args.js: -------------------------------------------------------------------------------- 1 | var yargs = require('yargs'); 2 | 3 | var argv = yargs.argv, 4 | validBumpTypes = "major|minor|patch|prerelease".split("|"), 5 | bump = (argv.bump || 'patch').toLowerCase(); 6 | 7 | if(validBumpTypes.indexOf(bump) === -1) { 8 | throw new Error('Unrecognized bump "' + bump + '".'); 9 | } 10 | 11 | module.exports = { 12 | bump: bump 13 | }; 14 | -------------------------------------------------------------------------------- /build/babel-options.js: -------------------------------------------------------------------------------- 1 | var path = require('path'); 2 | var paths = require('./paths'); 3 | 4 | exports.base = function() { 5 | var config = { 6 | filename: '', 7 | filenameRelative: '', 8 | sourceMap: true, 9 | sourceRoot: '', 10 | moduleRoot: path.resolve('src').replace(/\\/g, '/'), 11 | moduleIds: false, 12 | comments: false, 13 | compact: false, 14 | code: true, 15 | presets: [ 'es2015-loose', 'stage-1' ], 16 | plugins: [ 17 | 'syntax-flow', 18 | 'transform-decorators-legacy', 19 | ] 20 | }; 21 | if (!paths.useTypeScriptForDTS) { 22 | config.plugins.push( 23 | ['babel-dts-generator', { 24 | packageName: paths.packageName, 25 | typings: '', 26 | suppressModulePath: true, 27 | suppressComments: false, 28 | memberOutputFilter: /^_.*/, 29 | suppressAmbientDeclaration: true 30 | }] 31 | ); 32 | }; 33 | config.plugins.push('transform-flow-strip-types'); 34 | return config; 35 | } 36 | 37 | exports.commonjs = function() { 38 | var options = exports.base(); 39 | options.plugins.push('transform-es2015-modules-commonjs'); 40 | return options; 41 | }; 42 | 43 | exports.amd = function() { 44 | var options = exports.base(); 45 | options.plugins.push('transform-es2015-modules-amd'); 46 | return options; 47 | }; 48 | 49 | exports.system = function() { 50 | var options = exports.base(); 51 | options.plugins.push('transform-es2015-modules-systemjs'); 52 | return options; 53 | }; 54 | 55 | exports.es2015 = function() { 56 | var options = exports.base(); 57 | options.presets = ['stage-1'] 58 | return options; 59 | }; 60 | 61 | exports['native-modules'] = function() { 62 | var options = exports.base(); 63 | options.presets[0] = 'es2015-loose-native-modules'; 64 | return options; 65 | } 66 | -------------------------------------------------------------------------------- /build/paths.js: -------------------------------------------------------------------------------- 1 | var path = require('path'); 2 | var fs = require('fs'); 3 | 4 | // hide warning // 5 | var emitter = require('events'); 6 | emitter.defaultMaxListeners = 20; 7 | 8 | var appRoot = 'src/'; 9 | var pkg = JSON.parse(fs.readFileSync('./package.json', 'utf-8')); 10 | 11 | var paths = { 12 | root: appRoot, 13 | source: appRoot + '**/*.js', 14 | html: appRoot + '**/*.html', 15 | style: 'styles/**/*.css', 16 | output: 'dist/', 17 | doc:'./doc', 18 | e2eSpecsSrc: 'test/e2e/src/*.js', 19 | e2eSpecsDist: 'test/e2e/dist/', 20 | packageName: pkg.name, 21 | ignore: [], 22 | useTypeScriptForDTS: false, 23 | importsToAdd: [], 24 | sort: false 25 | }; 26 | 27 | paths.files = ['index.js'].map(function(file){ 28 | return paths.root + file; 29 | }); 30 | 31 | module.exports = paths; 32 | -------------------------------------------------------------------------------- /build/tasks/build.js: -------------------------------------------------------------------------------- 1 | var gulp = require('gulp'); 2 | var runSequence = require('run-sequence'); 3 | var to5 = require('gulp-babel'); 4 | var paths = require('../paths'); 5 | var compilerOptions = require('../babel-options'); 6 | var compilerTsOptions = require('../typescript-options'); 7 | var assign = Object.assign || require('object.assign'); 8 | var through2 = require('through2'); 9 | var concat = require('gulp-concat'); 10 | var insert = require('gulp-insert'); 11 | var rename = require('gulp-rename'); 12 | var tools = require('aurelia-tools'); 13 | var ts = require('gulp-typescript'); 14 | var gutil = require('gulp-util'); 15 | var gulpIgnore = require('gulp-ignore'); 16 | var merge = require('merge2'); 17 | var jsName = paths.packageName + '.js'; 18 | var compileToModules = ['es2015', 'commonjs', 'amd', 'system', 'native-modules']; 19 | 20 | function cleanGeneratedCode() { 21 | return through2.obj(function(file, enc, callback) { 22 | file.contents = new Buffer(tools.cleanGeneratedCode(file.contents.toString('utf8'))); 23 | this.push(file); 24 | return callback(); 25 | }); 26 | } 27 | 28 | gulp.task('build-index', function() { 29 | var importsToAdd = paths.importsToAdd.slice(); 30 | 31 | var src = gulp.src(paths.files); 32 | 33 | if (paths.sort) { 34 | src = src.pipe(tools.sortFiles()); 35 | } 36 | 37 | if (paths.ignore) { 38 | paths.ignore.forEach(function(filename){ 39 | src = src.pipe(gulpIgnore.exclude(filename)); 40 | }); 41 | } 42 | 43 | return src.pipe(through2.obj(function(file, enc, callback) { 44 | file.contents = new Buffer(tools.extractImports(file.contents.toString('utf8'), importsToAdd)); 45 | this.push(file); 46 | return callback(); 47 | })) 48 | .pipe(concat(jsName)) 49 | .pipe(insert.transform(function(contents) { 50 | return tools.createImportBlock(importsToAdd) + contents; 51 | })) 52 | .pipe(gulp.dest(paths.output)); 53 | }); 54 | 55 | function gulpFileFromString(filename, string) { 56 | var src = require('stream').Readable({ objectMode: true }); 57 | src._read = function() { 58 | this.push(new gutil.File({ cwd: paths.appRoot, base: paths.output, path: filename, contents: new Buffer(string) })) 59 | this.push(null) 60 | } 61 | return src; 62 | } 63 | 64 | function srcForBabel() { 65 | return merge( 66 | gulp.src(paths.output + jsName), 67 | gulpFileFromString(paths.output + 'index.js', "export * from './" + paths.packageName + "';") 68 | ); 69 | } 70 | 71 | function srcForTypeScript() { 72 | return gulp 73 | .src(paths.output + paths.packageName + '.js') 74 | .pipe(rename(function (path) { 75 | if (path.extname == '.js') { 76 | path.extname = '.ts'; 77 | } 78 | })); 79 | } 80 | 81 | compileToModules.forEach(function(moduleType){ 82 | gulp.task('build-babel-' + moduleType, function () { 83 | return srcForBabel() 84 | .pipe(to5(assign({}, compilerOptions[moduleType]()))) 85 | .pipe(cleanGeneratedCode()) 86 | .pipe(gulp.dest(paths.output + moduleType)); 87 | }); 88 | 89 | if (moduleType === 'native-modules') return; // typescript doesn't support the combination of: es5 + native modules 90 | 91 | gulp.task('build-ts-' + moduleType, function () { 92 | var tsProject = ts.createProject( 93 | compilerTsOptions({ module: moduleType, target: moduleType == 'es2015' ? 'es2015' : 'es5' }), ts.reporter.defaultReporter()); 94 | var tsResult = srcForTypeScript().pipe(ts(tsProject)); 95 | return tsResult.js 96 | .pipe(gulp.dest(paths.output + moduleType)); 97 | }); 98 | }); 99 | 100 | gulp.task('build-dts', function() { 101 | var tsProject = ts.createProject( 102 | compilerTsOptions({ removeComments: false, target: "es2015", module: "es2015" }), ts.reporter.defaultReporter()); 103 | var tsResult = srcForTypeScript().pipe(ts(tsProject)); 104 | return tsResult.dts 105 | .pipe(gulp.dest(paths.output)); 106 | }); 107 | 108 | gulp.task('build', function(callback) { 109 | return runSequence( 110 | 'clean', 111 | 'build-index', 112 | compileToModules 113 | .map(function(moduleType) { return 'build-babel-' + moduleType }) 114 | .concat(paths.useTypeScriptForDTS ? ['build-dts'] : []), 115 | callback 116 | ); 117 | }); 118 | 119 | gulp.task('build-ts', function(callback) { 120 | return runSequence( 121 | 'clean', 122 | 'build-index', 123 | 'build-babel-native-modules', 124 | compileToModules 125 | .filter(function(moduleType) { return moduleType !== 'native-modules' }) 126 | .map(function(moduleType) { return 'build-ts-' + moduleType }) 127 | .concat(paths.useTypeScriptForDTS ? ['build-dts'] : []), 128 | callback 129 | ); 130 | }); 131 | -------------------------------------------------------------------------------- /build/tasks/clean.js: -------------------------------------------------------------------------------- 1 | var gulp = require('gulp'); 2 | var paths = require('../paths'); 3 | var del = require('del'); 4 | var vinylPaths = require('vinyl-paths'); 5 | 6 | gulp.task('clean', function() { 7 | return gulp.src([paths.output]) 8 | .pipe(vinylPaths(del)); 9 | }); 10 | -------------------------------------------------------------------------------- /build/tasks/dev.js: -------------------------------------------------------------------------------- 1 | var gulp = require('gulp'); 2 | var tools = require('aurelia-tools'); 3 | 4 | gulp.task('update-own-deps', function(){ 5 | tools.updateOwnDependenciesFromLocalRepositories(); 6 | }); 7 | 8 | gulp.task('build-dev-env', function () { 9 | tools.buildDevEnv(); 10 | }); 11 | -------------------------------------------------------------------------------- /build/tasks/doc.js: -------------------------------------------------------------------------------- 1 | var gulp = require('gulp'); 2 | var paths = require('../paths'); 3 | var typedoc = require('gulp-typedoc'); 4 | var runSequence = require('run-sequence'); 5 | var through2 = require('through2'); 6 | 7 | gulp.task('doc-generate', function(){ 8 | return gulp.src([paths.output + paths.packageName + '.d.ts']) 9 | .pipe(typedoc({ 10 | target: 'es6', 11 | includeDeclarations: true, 12 | json: paths.doc + '/api.json', 13 | name: paths.packageName + '-docs',  14 | mode: 'modules', 15 | excludeExternals: true, 16 | ignoreCompilerErrors: false, 17 | version: true 18 | })); 19 | }); 20 | 21 | gulp.task('doc-shape', function(){ 22 | return gulp.src([paths.doc + '/api.json']) 23 | .pipe(through2.obj(function(file, enc, callback) { 24 | var json = JSON.parse(file.contents.toString('utf8')).children[0]; 25 | 26 | json = { 27 | name: paths.packageName, 28 | children: json.children, 29 | groups: json.groups 30 | }; 31 | 32 | file.contents = new Buffer(JSON.stringify(json)); 33 | this.push(file); 34 | return callback(); 35 | })) 36 | .pipe(gulp.dest(paths.doc)); 37 | }); 38 | 39 | gulp.task('doc', function(callback){ 40 | return runSequence( 41 | 'doc-generate', 42 | 'doc-shape', 43 | callback 44 | ); 45 | }); 46 | -------------------------------------------------------------------------------- /build/tasks/lint.js: -------------------------------------------------------------------------------- 1 | var gulp = require('gulp'); 2 | var paths = require('../paths'); 3 | var eslint = require('gulp-eslint'); 4 | 5 | gulp.task('lint', function() { 6 | return gulp.src(paths.source) 7 | .pipe(eslint()) 8 | .pipe(eslint.format()) 9 | .pipe(eslint.failOnError()); 10 | }); 11 | -------------------------------------------------------------------------------- /build/tasks/prepare-release.js: -------------------------------------------------------------------------------- 1 | var gulp = require('gulp'); 2 | var runSequence = require('run-sequence'); 3 | var paths = require('../paths'); 4 | var fs = require('fs'); 5 | var bump = require('gulp-bump'); 6 | var args = require('../args'); 7 | var conventionalChangelog = require('gulp-conventional-changelog'); 8 | 9 | gulp.task('changelog', function () { 10 | return gulp.src(paths.doc + '/CHANGELOG.md', { 11 | buffer: false 12 | }).pipe(conventionalChangelog({ 13 | preset: 'angular' 14 | })) 15 | .pipe(gulp.dest(paths.doc)); 16 | }); 17 | 18 | gulp.task('bump-version', function(){ 19 | return gulp.src(['./package.json', './bower.json']) 20 | .pipe(bump({type:args.bump })) //major|minor|patch|prerelease 21 | .pipe(gulp.dest('./')); 22 | }); 23 | 24 | gulp.task('prepare-release', function(callback){ 25 | return runSequence( 26 | 'build', 27 | 'lint', 28 | 'bump-version', 29 | 'doc', 30 | 'changelog', 31 | callback 32 | ); 33 | }); 34 | -------------------------------------------------------------------------------- /build/tasks/test.js: -------------------------------------------------------------------------------- 1 | var gulp = require('gulp'); 2 | var Karma = require('karma').Server; 3 | 4 | /** 5 | * Run test once and exit 6 | */ 7 | gulp.task('test', function (done) { 8 | new Karma({ 9 | configFile: __dirname + '/../../karma.conf.js', 10 | singleRun: true 11 | }, done).start(); 12 | }); 13 | 14 | /** 15 | * Watch for file changes and re-run tests on each change 16 | */ 17 | gulp.task('tdd', function (done) { 18 | new Karma({ 19 | configFile: __dirname + '/../../karma.conf.js' 20 | }, done).start(); 21 | }); 22 | 23 | /** 24 | * Run test once with code coverage and exit 25 | */ 26 | gulp.task('cover', function (done) { 27 | new Karma({ 28 | configFile: __dirname + '/../../karma.conf.js', 29 | singleRun: true, 30 | reporters: ['coverage'], 31 | preprocessors: { 32 | 'test/**/*.js': ['babel'], 33 | 'src/**/*.js': ['babel', 'coverage'] 34 | }, 35 | coverageReporter: { 36 | type: 'html', 37 | dir: 'build/reports/coverage' 38 | } 39 | }, done).start(); 40 | }); 41 | -------------------------------------------------------------------------------- /build/typescript-options.js: -------------------------------------------------------------------------------- 1 | var tsconfig = require('../tsconfig.json'); 2 | var assign = Object.assign || require('object.assign'); 3 | 4 | module.exports = function(override) { 5 | return assign(tsconfig.compilerOptions, { 6 | "target": override && override.target || "es5", 7 | "typescript": require('typescript') 8 | }, override || {}); 9 | } 10 | -------------------------------------------------------------------------------- /config.js: -------------------------------------------------------------------------------- 1 | System.config({ 2 | defaultJSExtensions: true, 3 | transpiler: "babel", 4 | babelOptions: { 5 | "optional": [ 6 | "runtime", 7 | "optimisation.modules.system" 8 | ] 9 | }, 10 | paths: { 11 | "github:*": "jspm_packages/github/*", 12 | "npm:*": "jspm_packages/npm/*" 13 | }, 14 | 15 | map: { 16 | "babel": "npm:babel-core@5.8.38", 17 | "babel-runtime": "npm:babel-runtime@5.8.38", 18 | "core-js": "npm:core-js@2.4.0", 19 | "github:jspm/nodelibs-assert@0.1.0": { 20 | "assert": "npm:assert@1.4.1" 21 | }, 22 | "github:jspm/nodelibs-buffer@0.1.0": { 23 | "buffer": "npm:buffer@3.6.0" 24 | }, 25 | "github:jspm/nodelibs-path@0.1.0": { 26 | "path-browserify": "npm:path-browserify@0.0.0" 27 | }, 28 | "github:jspm/nodelibs-process@0.1.2": { 29 | "process": "npm:process@0.11.5" 30 | }, 31 | "github:jspm/nodelibs-util@0.1.0": { 32 | "util": "npm:util@0.10.3" 33 | }, 34 | "github:jspm/nodelibs-vm@0.1.0": { 35 | "vm-browserify": "npm:vm-browserify@0.0.4" 36 | }, 37 | "npm:assert@1.4.1": { 38 | "assert": "github:jspm/nodelibs-assert@0.1.0", 39 | "buffer": "github:jspm/nodelibs-buffer@0.1.0", 40 | "process": "github:jspm/nodelibs-process@0.1.2", 41 | "util": "npm:util@0.10.3" 42 | }, 43 | "npm:babel-runtime@5.8.38": { 44 | "process": "github:jspm/nodelibs-process@0.1.2" 45 | }, 46 | "npm:buffer@3.6.0": { 47 | "base64-js": "npm:base64-js@0.0.8", 48 | "child_process": "github:jspm/nodelibs-child_process@0.1.0", 49 | "fs": "github:jspm/nodelibs-fs@0.1.2", 50 | "ieee754": "npm:ieee754@1.1.6", 51 | "isarray": "npm:isarray@1.0.0", 52 | "process": "github:jspm/nodelibs-process@0.1.2" 53 | }, 54 | "npm:core-js@2.4.0": { 55 | "fs": "github:jspm/nodelibs-fs@0.1.2", 56 | "path": "github:jspm/nodelibs-path@0.1.0", 57 | "process": "github:jspm/nodelibs-process@0.1.2", 58 | "systemjs-json": "github:systemjs/plugin-json@0.1.2" 59 | }, 60 | "npm:inherits@2.0.1": { 61 | "util": "github:jspm/nodelibs-util@0.1.0" 62 | }, 63 | "npm:path-browserify@0.0.0": { 64 | "process": "github:jspm/nodelibs-process@0.1.2" 65 | }, 66 | "npm:process@0.11.5": { 67 | "assert": "github:jspm/nodelibs-assert@0.1.0", 68 | "fs": "github:jspm/nodelibs-fs@0.1.2", 69 | "vm": "github:jspm/nodelibs-vm@0.1.0" 70 | }, 71 | "npm:util@0.10.3": { 72 | "inherits": "npm:inherits@2.0.1", 73 | "process": "github:jspm/nodelibs-process@0.1.2" 74 | }, 75 | "npm:vm-browserify@0.0.4": { 76 | "indexof": "npm:indexof@0.0.1" 77 | } 78 | } 79 | }); 80 | -------------------------------------------------------------------------------- /dist/amd/aurelia-pal.js: -------------------------------------------------------------------------------- 1 | define(['exports'], function (exports) { 2 | 'use strict'; 3 | 4 | Object.defineProperty(exports, "__esModule", { 5 | value: true 6 | }); 7 | exports.AggregateError = AggregateError; 8 | exports.initializePAL = initializePAL; 9 | exports.reset = reset; 10 | function AggregateError(message, innerError, skipIfAlreadyAggregate) { 11 | if (innerError) { 12 | if (innerError.innerError && skipIfAlreadyAggregate) { 13 | return innerError; 14 | } 15 | 16 | var separator = '\n------------------------------------------------\n'; 17 | 18 | message += separator + 'Inner Error:\n'; 19 | 20 | if (typeof innerError === 'string') { 21 | message += 'Message: ' + innerError; 22 | } else { 23 | if (innerError.message) { 24 | message += 'Message: ' + innerError.message; 25 | } else { 26 | message += 'Unknown Inner Error Type. Displaying Inner Error as JSON:\n ' + JSON.stringify(innerError, null, ' '); 27 | } 28 | 29 | if (innerError.stack) { 30 | message += '\nInner Error Stack:\n' + innerError.stack; 31 | message += '\nEnd Inner Error Stack'; 32 | } 33 | } 34 | 35 | message += separator; 36 | } 37 | 38 | var e = new Error(message); 39 | if (innerError) { 40 | e.innerError = innerError; 41 | } 42 | 43 | return e; 44 | } 45 | 46 | var FEATURE = exports.FEATURE = {}; 47 | 48 | var PLATFORM = exports.PLATFORM = { 49 | noop: function noop() {}, 50 | eachModule: function eachModule() {}, 51 | moduleName: function (_moduleName) { 52 | function moduleName(_x) { 53 | return _moduleName.apply(this, arguments); 54 | } 55 | 56 | moduleName.toString = function () { 57 | return _moduleName.toString(); 58 | }; 59 | 60 | return moduleName; 61 | }(function (moduleName) { 62 | return moduleName; 63 | }) 64 | }; 65 | 66 | PLATFORM.global = function () { 67 | if (typeof self !== 'undefined') { 68 | return self; 69 | } 70 | 71 | if (typeof global !== 'undefined') { 72 | return global; 73 | } 74 | 75 | return new Function('return this')(); 76 | }(); 77 | 78 | var DOM = exports.DOM = {}; 79 | var isInitialized = exports.isInitialized = false; 80 | function initializePAL(callback) { 81 | if (isInitialized) { 82 | return; 83 | } 84 | exports.isInitialized = isInitialized = true; 85 | if (typeof Object.getPropertyDescriptor !== 'function') { 86 | Object.getPropertyDescriptor = function (subject, name) { 87 | var pd = Object.getOwnPropertyDescriptor(subject, name); 88 | var proto = Object.getPrototypeOf(subject); 89 | while (typeof pd === 'undefined' && proto !== null) { 90 | pd = Object.getOwnPropertyDescriptor(proto, name); 91 | proto = Object.getPrototypeOf(proto); 92 | } 93 | return pd; 94 | }; 95 | } 96 | 97 | callback(PLATFORM, FEATURE, DOM); 98 | } 99 | function reset() { 100 | exports.isInitialized = isInitialized = false; 101 | } 102 | }); -------------------------------------------------------------------------------- /dist/amd/index.js: -------------------------------------------------------------------------------- 1 | define(['exports', './aurelia-pal'], function (exports, _aureliaPal) { 2 | 'use strict'; 3 | 4 | Object.defineProperty(exports, "__esModule", { 5 | value: true 6 | }); 7 | Object.keys(_aureliaPal).forEach(function (key) { 8 | if (key === "default" || key === "__esModule") return; 9 | Object.defineProperty(exports, key, { 10 | enumerable: true, 11 | get: function () { 12 | return _aureliaPal[key]; 13 | } 14 | }); 15 | }); 16 | }); -------------------------------------------------------------------------------- /dist/aurelia-pal.d.ts: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * Enables discovery of what features the runtime environment supports. 4 | */ 5 | export declare interface Feature { 6 | 7 | /** 8 | * Does the runtime environment support ShadowDOM? 9 | */ 10 | shadowDOM: boolean; 11 | 12 | /** 13 | * Does the runtime environment support the css scoped attribute? 14 | */ 15 | scopedCSS: boolean; 16 | 17 | /** 18 | * Does the runtime environment support native HTMLTemplateElement? 19 | */ 20 | htmlTemplateElement: boolean; 21 | 22 | /** 23 | * Does the runtime environment support native DOM mutation observers? 24 | */ 25 | mutationObserver: boolean; 26 | } 27 | 28 | /** 29 | * The runtime's performance API. 30 | */ 31 | export declare interface Performance { 32 | 33 | /** 34 | * Gets a DOMHighResTimeStamp. 35 | * @return The timestamp, measured in milliseconds, accurate to one thousandth of a millisecond. 36 | */ 37 | now(): number; 38 | 39 | /** 40 | * Removes the given mark from the browser's performance entry buffer. 41 | * 42 | * @param {string} [markName] A DOMString representing the name of the timestamp. If this argument is omitted, all performance entries with an entry type of "mark" will be removed. 43 | * @memberof IPerformance 44 | */ 45 | clearMarks(markName?: string): void; 46 | 47 | /** 48 | * Removes the given measure from the browser's performance entry buffer. 49 | * 50 | * @param {string} [measureName] A DOMString representing the name of the timestamp. If this argument is omitted, all performance entries with an entry type of "measure" will be removed. 51 | * @memberof IPerformance 52 | */ 53 | clearMeasures(measureName?: string): void; 54 | 55 | /** 56 | * Returns a list of PerformanceEntry objects based on the given name and entry type. 57 | * 58 | * @param {string} name The name of the entry to retrieve 59 | * @param {string} [entryType] The type of entry to retrieve such as "mark". The valid entry types are listed in PerformanceEntry.entryType. 60 | * @returns {*} 61 | * @memberof IPerformance 62 | */ 63 | getEntriesByName(name: string, entryType?: string): any; 64 | 65 | /** 66 | * Returns a list of PerformanceEntry objects of the given entry type. 67 | * 68 | * @param {string} entryType The type of entry to retrieve such as "mark". The valid entry types are listed in PerformanceEntry.entryType. 69 | * @returns {*} 70 | * @memberof IPerformance 71 | */ 72 | getEntriesByType(entryType: string): any; 73 | 74 | /** 75 | * Creates a timestamp in the browser's performance entry buffer with the given name. 76 | * 77 | * @param {string} markName a DOMString representing the name of the mark 78 | * @memberof IPerformance 79 | */ 80 | mark(markName: string): void; 81 | 82 | /** 83 | * Creates a named timestamp in the browser's performance entry buffer between two specified marks (known as the start mark and end mark, respectively). 84 | * 85 | * @param {string} measureName a DOMString representing the name of the measure. 86 | * @param {string} [startMarkName] A DOMString representing the name of the measure's starting mark. May also be the name of a PerformanceTiming property. 87 | * @param {string} [endMarkName] A DOMString representing the name of the measure's ending mark. May also be the name of a PerformanceTiming property. 88 | * @memberof IPerformance 89 | */ 90 | measure(measureName: string, startMarkName?: string, endMarkName?: string): void; 91 | } 92 | 93 | /** 94 | * Represents the core APIs of the runtime environment. 95 | */ 96 | /** 97 | * Represents the core APIs of the runtime environment. 98 | */ 99 | export declare interface Platform { 100 | 101 | /** 102 | * The runtime environment's global. 103 | */ 104 | global: any; 105 | 106 | /** 107 | * A function wich does nothing. 108 | */ 109 | noop: Function; 110 | 111 | /** 112 | * The runtime's location API. 113 | */ 114 | location: typeof window.location; 115 | 116 | /** 117 | * The runtime's history API. 118 | */ 119 | history: typeof window.history; 120 | 121 | /** 122 | * The runtime's performance API 123 | */ 124 | performance: Performance; 125 | 126 | /** 127 | * Registers a function to call when the system is ready to update (repaint) the display. 128 | * @param callback The function to call. 129 | * @return A long integer value, the request id, that uniquely identifies the entry in the callback list. 130 | */ 131 | requestAnimationFrame(callback: ((animationFrameStart: number) => void)): number; 132 | 133 | /** 134 | * The runtime's XMLHttpRequest API. 135 | */ 136 | XMLHttpRequest: typeof XMLHttpRequest; 137 | 138 | /** 139 | * Iterate all modules loaded by the script loader. 140 | * @param callback A callback that will receive each module id along with the module object. Return true to end enumeration. 141 | */ 142 | eachModule(callback: ((key: string, value: Object) => boolean)): void; 143 | 144 | /** 145 | * Add a global event listener. 146 | * @param eventName A string representing the event type to listen for. 147 | * @param callback The function that receives a notification when an event of the specified type occurs. 148 | * @param capture If true, useCapture indicates that the user wishes to initiate capture. 149 | */ 150 | addEventListener(eventName: string, callback: EventListenerOrEventListenerObject, capture?: boolean): void; 151 | 152 | /** 153 | * Remove a global event listener. 154 | * @param eventName A string representing the event type to listen for. 155 | * @param callback The function to remove from the event. 156 | * @param capture Specifies whether the listener to be removed was registered as a capturing listener or not. 157 | */ 158 | removeEventListener(eventName: string, callback: EventListenerOrEventListenerObject, capture?: boolean): void; 159 | 160 | /** 161 | * Reference to the Loader Class (set after the loader has been first imported) 162 | */ 163 | Loader: any; 164 | 165 | /** 166 | * Resolves a module name to a path resolvable by the loader. By default returns the first parameter. 167 | * It is recommended to use this for all dynamic imports as it enables static analysis 168 | * and optionally allows adding custom metadata used by the build step. 169 | * 170 | * References to this method should always literally call `PLATFORM.moduleName(...)`. 171 | * This enables the build step to statically optimize the code by replacing the reference with a string. 172 | * 173 | * @param moduleName Absolute or relative path to the module. 174 | * @param options Optional options used during the static analysis that inform how to process the module. 175 | */ 176 | moduleName(moduleName: string, options?: ModuleNameOptions): string; 177 | moduleName(moduleName: string, chunk?: string): string; 178 | } 179 | 180 | /** 181 | * Options used during the static analysis that inform how to process a given module. 182 | */ 183 | /** 184 | * Options used during the static analysis that inform how to process a given module. 185 | */ 186 | export declare interface ModuleNameOptions { 187 | 188 | /** 189 | * Add the module to a chunk by name 190 | */ 191 | chunk?: string; 192 | 193 | /** 194 | * Optionally declare which exports are used. This enables tree-shaking when only few out of many exports are used. 195 | */ 196 | exports?: string[]; 197 | } 198 | 199 | /** 200 | * Represents the core APIs of the DOM. 201 | */ 202 | export declare interface Dom { 203 | 204 | /** 205 | * The global DOM Element type. 206 | */ 207 | Element: typeof Element; 208 | 209 | /** 210 | * The global DOM NodeList type. 211 | */ 212 | NodeList: typeof NodeList; 213 | 214 | /** 215 | * The global DOM SVGElement type. 216 | */ 217 | SVGElement: typeof SVGElement; 218 | 219 | /** 220 | * A key representing a DOM boundary. 221 | */ 222 | boundary: string; 223 | 224 | /** 225 | * The document title. 226 | */ 227 | title: string; 228 | 229 | /** 230 | * The document's active/focused element. 231 | */ 232 | activeElement: Element; 233 | 234 | /** 235 | * Add an event listener to the document. 236 | * @param eventName A string representing the event type to listen for. 237 | * @param callback The function or listener object that receives a notification when an event of the specified type occurs. 238 | * @param capture If true, useCapture indicates that the user wishes to initiate capture. 239 | */ 240 | addEventListener(eventName: string, callback: EventListenerOrEventListenerObject, capture: boolean): void; 241 | 242 | /** 243 | * Remove an event listener from the document. 244 | * @param eventName A string representing the event type to listen for. 245 | * @param callback The function or listener object to remove from the event. 246 | * @param capture Specifies whether the listener to be removed was registered as a capturing listener or not. 247 | */ 248 | removeEventListener(eventName: string, callback: EventListenerOrEventListenerObject, capture: boolean): void; 249 | 250 | /** 251 | * Adopts a node from an external document. 252 | * @param node The node to be adopted. 253 | * @return The adopted node able to be used in the document. 254 | */ 255 | adoptNode(node: Node): Node; 256 | 257 | /** 258 | * Creates the specified HTML element or an HTMLUnknownElement if the given element name isn't a known one. 259 | * @param tagName A string that specifies the type of element to be created. 260 | * @return The created element. 261 | */ 262 | // createElement(tagName: T): HTMLElementTagNameMap; 263 | createElement(tagName: string): HTMLElement; 264 | 265 | /** 266 | * Creates the specified HTML attribute 267 | * @param name A string that specifies the name of attribute to be created. 268 | * @return The created attribute. 269 | */ 270 | createAttribute(name: string): Attr; 271 | 272 | /** 273 | * Creates a new Text node. 274 | * @param text A string to populate the new Text node. 275 | * @return A Text node. 276 | */ 277 | createTextNode(text: string): Text; 278 | 279 | /** 280 | * Creates a new Comment node. 281 | * @param text A string to populate the new Comment node. 282 | * @return A Comment node. 283 | */ 284 | createComment(text: string): Comment; 285 | 286 | /** 287 | * Creates a new DocumentFragment. 288 | * @return A DocumentFragment. 289 | */ 290 | createDocumentFragment(): DocumentFragment; 291 | 292 | /** 293 | * Creates a new HTMLTemplateElement. 294 | * @return An HTMLTemplateElement. 295 | */ 296 | createTemplateElement(): HTMLTemplateElement; 297 | 298 | /** 299 | * Creates a new MutationObserver. 300 | * @param callback A callback that will recieve the change records with the mutations. 301 | * @return A MutationObservere. 302 | */ 303 | createMutationObserver(callback: Function): MutationObserver; 304 | 305 | /** 306 | * Creates a new CustomEvent. 307 | * @param eventType A string representing the event type. 308 | * @param options An options object specifying bubbles:boolean, cancelable:boolean and/or detail:Object information. 309 | * @return A CustomEvent. 310 | */ 311 | createCustomEvent(eventType: string, options?: CustomEventInit): CustomEvent; 312 | 313 | /** 314 | * Dispatches an event on the document. 315 | * @param evt The event to dispatch. 316 | */ 317 | dispatchEvent(evt: Event): void; 318 | 319 | /** 320 | * Gives the values of all the CSS properties of an element after applying the active stylesheets and resolving any basic computation those values may contain. 321 | * @param element The Element for which to get the computed style. 322 | * @return The computed styles. 323 | */ 324 | getComputedStyle(element: Element): CSSStyleDeclaration; 325 | 326 | /** 327 | * Locates an element in the document according to its id. 328 | * @param id The id to search the document for. 329 | * @return The found element. 330 | */ 331 | getElementById(id: string): Element; 332 | 333 | /** 334 | * Performs a query selector on the document and returns first matched element, depth first. 335 | * @param query The query to use in searching the document. 336 | * @return A list of all matched elements in the document. 337 | */ 338 | // enable the following two lines if we switch to TypeScript 339 | // querySelector(selectors: K): HTMLElementTagNameMap[K] | null; 340 | // querySelector(selectors: K): SVGElementTagNameMap[K] | null; 341 | querySelector(selectors: string): Element; 342 | 343 | /** 344 | * Performs a query selector on the document and returns all located matches. 345 | * @param query The query to use in searching the document. 346 | * @return A list of all matched elements in the document. 347 | */ 348 | // enable the following two lines if we switch to TypeScript 349 | // querySelectorAll(selectors: K): NodeListOf; 350 | // querySelectorAll(selectors: K): NodeListOf; 351 | querySelectorAll(selectors: string): NodeList; 352 | 353 | /** 354 | * Gets the element that is the next sibling of the provided element. 355 | * @param element The element whose next sibling is being located. 356 | * @return The next sibling Element of the provided Element. 357 | */ 358 | nextElementSibling(element: Node): Element; 359 | 360 | /** 361 | * Creates an HTMLTemplateElement using the markup provided. 362 | * @param markup A string containing the markup to turn into a template. Note: This string must contain the template element as well. 363 | * @return The instance of HTMLTemplateElement that was created from the provided markup. 364 | */ 365 | createTemplateFromMarkup(markup: string): HTMLTemplateElement; 366 | 367 | /** 368 | * Appends a node to the parent, if provided, or the document.body otherwise. 369 | * @param newNode The node to append. 370 | * @param parentNode The node to append to, otherwise the document.body. 371 | */ 372 | appendNode(newNode: Node, parentNode?: Node): void; 373 | 374 | /** 375 | * Replaces a node in the parent with a new node. 376 | * @param newNode The node to replace the old node with. 377 | * @param node The node that is being replaced. 378 | * @param parentNode The node that the current node is parented to. 379 | */ 380 | replaceNode(newNode: Node, node: Node, parentNode?: Node): void; 381 | 382 | /** 383 | * Removes the specified node from the parent node. 384 | * @param node The node to remove. 385 | * @param parentNode The parent node from which the node will be removed. 386 | */ 387 | removeNode(node: Node, parentNode?: Node): void; 388 | 389 | /** 390 | * Injects styles into the destination element, or the document.head if no destination is provided. 391 | * @param styles The css text to injext. 392 | * @param destination The destination element to inject the css text into. If not specified it will default to the document.head. 393 | * @param prepend Indicates whether or not the styles should be prepended to the destination. By default they are appended. 394 | * @param id The existing style element's id to replace the contents for 395 | * @return The Style node that was created. 396 | */ 397 | injectStyles(styles: string, destination?: Element, prepend?: boolean, id?: string): Node; 398 | } 399 | 400 | /** 401 | * Creates an instance of Error that aggregates and preserves an innerError. 402 | * @param message The error message. 403 | * @param innerError The inner error message to aggregate. 404 | * @param skipIfAlreadyAggregate Indicates to not wrap the inner error if it itself already has an innerError. 405 | * @return The Error instance. 406 | */ 407 | export declare function AggregateError(message: string, innerError?: Error, skipIfAlreadyAggregate?: boolean): Error; 408 | 409 | /** 410 | * The singleton instance of the Feature discovery API. 411 | */ 412 | /** 413 | * The singleton instance of the Feature discovery API. 414 | */ 415 | export declare const FEATURE: Feature; 416 | 417 | /** 418 | * The singleton instance of the Platform API. 419 | */ 420 | /** 421 | * The singleton instance of the Platform API. 422 | */ 423 | export declare const PLATFORM: Platform; 424 | 425 | /** 426 | * The singleton instance of the Dom API. 427 | */ 428 | /** 429 | * The singleton instance of the Dom API. 430 | */ 431 | export declare const DOM: Dom; 432 | export declare let isInitialized: any; 433 | 434 | /** 435 | * Enables initializing a specific implementation of the Platform Abstraction Layer (PAL). 436 | * @param callback Allows providing a callback which configures the three PAL singletons with their platform-specific implementations. 437 | */ 438 | export declare function initializePAL(callback: ((platform: Platform, feature: Feature, dom: Dom) => void)): void; 439 | export declare function reset(): any; -------------------------------------------------------------------------------- /dist/aurelia-pal.js: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * Creates an instance of Error that aggregates and preserves an innerError. 4 | * @param message The error message. 5 | * @param innerError The inner error message to aggregate. 6 | * @param skipIfAlreadyAggregate Indicates to not wrap the inner error if it itself already has an innerError. 7 | * @return The Error instance. 8 | */ 9 | export function AggregateError(message: string, innerError?: Error, skipIfAlreadyAggregate?: boolean): Error { 10 | if (innerError) { 11 | if (innerError.innerError && skipIfAlreadyAggregate) { 12 | return innerError; 13 | } 14 | 15 | const separator = '\n------------------------------------------------\n'; 16 | 17 | message += `${separator}Inner Error:\n`; 18 | 19 | if (typeof (innerError) === 'string') { 20 | message += `Message: ${innerError}`; 21 | } else { 22 | if (innerError.message) { 23 | message += `Message: ${innerError.message}`; 24 | } else { 25 | message += `Unknown Inner Error Type. Displaying Inner Error as JSON:\n ${JSON.stringify(innerError, null, ' ')}`; 26 | } 27 | 28 | if (innerError.stack) { 29 | message += `\nInner Error Stack:\n${innerError.stack}`; 30 | message += '\nEnd Inner Error Stack'; 31 | } 32 | } 33 | 34 | message += separator; 35 | } 36 | 37 | let e = new Error(message); 38 | if (innerError) { 39 | e.innerError = innerError; 40 | } 41 | 42 | return e; 43 | } 44 | 45 | /** 46 | * Enables discovery of what features the runtime environment supports. 47 | */ 48 | interface Feature { 49 | /** 50 | * Does the runtime environment support ShadowDOM? 51 | */ 52 | shadowDOM: boolean; 53 | /** 54 | * Does the runtime environment support the css scoped attribute? 55 | */ 56 | scopedCSS: boolean; 57 | /** 58 | * Does the runtime environment support native HTMLTemplateElement? 59 | */ 60 | htmlTemplateElement: boolean; 61 | 62 | /** 63 | * Does the runtime environment support native DOM mutation observers? 64 | */ 65 | mutationObserver: boolean; 66 | } 67 | 68 | /** 69 | * The singleton instance of the Feature discovery API. 70 | */ 71 | export const FEATURE: Feature = {}; 72 | 73 | /** 74 | * The runtime's performance API. 75 | */ 76 | interface Performance { 77 | /** 78 | * Gets a DOMHighResTimeStamp. 79 | * @return The timestamp, measured in milliseconds, accurate to one thousandth of a millisecond. 80 | */ 81 | now(): number; 82 | 83 | /** 84 | * Removes the given mark from the browser's performance entry buffer. 85 | * 86 | * @param {string} [markName] A DOMString representing the name of the timestamp. If this argument is omitted, all performance entries with an entry type of "mark" will be removed. 87 | * @memberof IPerformance 88 | */ 89 | clearMarks(markName?: string): void; 90 | 91 | /** 92 | * Removes the given measure from the browser's performance entry buffer. 93 | * 94 | * @param {string} [measureName] A DOMString representing the name of the timestamp. If this argument is omitted, all performance entries with an entry type of "measure" will be removed. 95 | * @memberof IPerformance 96 | */ 97 | clearMeasures(measureName?: string): void; 98 | 99 | /** 100 | * Returns a list of PerformanceEntry objects based on the given name and entry type. 101 | * 102 | * @param {string} name The name of the entry to retrieve 103 | * @param {string} [entryType] The type of entry to retrieve such as "mark". The valid entry types are listed in PerformanceEntry.entryType. 104 | * @returns {*} 105 | * @memberof IPerformance 106 | */ 107 | getEntriesByName(name: string, entryType?: string): any; 108 | 109 | /** 110 | * Returns a list of PerformanceEntry objects of the given entry type. 111 | * 112 | * @param {string} entryType The type of entry to retrieve such as "mark". The valid entry types are listed in PerformanceEntry.entryType. 113 | * @returns {*} 114 | * @memberof IPerformance 115 | */ 116 | getEntriesByType(entryType: string): any; 117 | 118 | /** 119 | * Creates a timestamp in the browser's performance entry buffer with the given name. 120 | * 121 | * @param {string} markName a DOMString representing the name of the mark 122 | * @memberof IPerformance 123 | */ 124 | mark(markName: string): void; 125 | 126 | /** 127 | * Creates a named timestamp in the browser's performance entry buffer between two specified marks (known as the start mark and end mark, respectively). 128 | * 129 | * @param {string} measureName a DOMString representing the name of the measure. 130 | * @param {string} [startMarkName] A DOMString representing the name of the measure's starting mark. May also be the name of a PerformanceTiming property. 131 | * @param {string} [endMarkName] A DOMString representing the name of the measure's ending mark. May also be the name of a PerformanceTiming property. 132 | * @memberof IPerformance 133 | */ 134 | measure(measureName: string, startMarkName?: string, endMarkName?: string): void; 135 | } 136 | 137 | /** 138 | * Represents the core APIs of the runtime environment. 139 | */ 140 | interface Platform { 141 | /** 142 | * The runtime environment's global. 143 | */ 144 | global: any; 145 | /** 146 | * A function wich does nothing. 147 | */ 148 | noop: Function; 149 | /** 150 | * The runtime's location API. 151 | */ 152 | location: typeof window.location; 153 | /** 154 | * The runtime's history API. 155 | */ 156 | history: typeof window.history; 157 | /** 158 | * The runtime's performance API 159 | */ 160 | performance: Performance; 161 | /** 162 | * Registers a function to call when the system is ready to update (repaint) the display. 163 | * @param callback The function to call. 164 | * @return A long integer value, the request id, that uniquely identifies the entry in the callback list. 165 | */ 166 | requestAnimationFrame(callback: (animationFrameStart: number) => void): number; 167 | /** 168 | * The runtime's XMLHttpRequest API. 169 | */ 170 | XMLHttpRequest: typeof XMLHttpRequest; 171 | /** 172 | * Iterate all modules loaded by the script loader. 173 | * @param callback A callback that will receive each module id along with the module object. Return true to end enumeration. 174 | */ 175 | eachModule(callback: (key: string, value: Object) => boolean): void; 176 | /** 177 | * Add a global event listener. 178 | * @param eventName A string representing the event type to listen for. 179 | * @param callback The function that receives a notification when an event of the specified type occurs. 180 | * @param capture If true, useCapture indicates that the user wishes to initiate capture. 181 | */ 182 | addEventListener(eventName: string, callback: EventListenerOrEventListenerObject, capture?: boolean): void; 183 | /** 184 | * Remove a global event listener. 185 | * @param eventName A string representing the event type to listen for. 186 | * @param callback The function to remove from the event. 187 | * @param capture Specifies whether the listener to be removed was registered as a capturing listener or not. 188 | */ 189 | removeEventListener(eventName: string, callback: EventListenerOrEventListenerObject, capture?: boolean): void; 190 | /** 191 | * Reference to the Loader Class (set after the loader has been first imported) 192 | */ 193 | Loader: any; 194 | /** 195 | * Resolves a module name to a path resolvable by the loader. By default returns the first parameter. 196 | * It is recommended to use this for all dynamic imports as it enables static analysis 197 | * and optionally allows adding custom metadata used by the build step. 198 | * 199 | * References to this method should always literally call `PLATFORM.moduleName(...)`. 200 | * This enables the build step to statically optimize the code by replacing the reference with a string. 201 | * 202 | * @param moduleName Absolute or relative path to the module. 203 | * @param options Optional options used during the static analysis that inform how to process the module. 204 | */ 205 | moduleName(moduleName: string, options?: ModuleNameOptions): string; 206 | moduleName(moduleName: string, chunk?: string): string; 207 | } 208 | 209 | /** 210 | * Options used during the static analysis that inform how to process a given module. 211 | */ 212 | interface ModuleNameOptions { 213 | /** 214 | * Add the module to a chunk by name 215 | */ 216 | chunk?: string; 217 | /** 218 | * Optionally declare which exports are used. This enables tree-shaking when only few out of many exports are used. 219 | */ 220 | exports?: string[]; 221 | } 222 | 223 | /** 224 | * The singleton instance of the Platform API. 225 | */ 226 | export const PLATFORM: Platform = { 227 | noop() { }, 228 | eachModule() { }, 229 | moduleName(moduleName) { 230 | return moduleName; 231 | } 232 | }; 233 | 234 | PLATFORM.global = (function() { 235 | // Workers don’t have `window`, only `self` 236 | if (typeof self !== 'undefined') { 237 | return self; 238 | } 239 | 240 | if (typeof global !== 'undefined') { 241 | return global; 242 | } 243 | 244 | // Not all environments allow eval and Function 245 | // Use only as a last resort: 246 | return new Function('return this')(); 247 | })(); 248 | 249 | /** 250 | * Represents the core APIs of the DOM. 251 | */ 252 | interface Dom { 253 | /** 254 | * The global DOM Element type. 255 | */ 256 | Element: typeof Element; 257 | /** 258 | * The global DOM NodeList type. 259 | */ 260 | NodeList: typeof NodeList; 261 | /** 262 | * The global DOM SVGElement type. 263 | */ 264 | SVGElement: typeof SVGElement; 265 | /** 266 | * A key representing a DOM boundary. 267 | */ 268 | boundary: string; 269 | /** 270 | * The document title. 271 | */ 272 | title: string; 273 | /** 274 | * The document's active/focused element. 275 | */ 276 | activeElement: Element; 277 | /** 278 | * Add an event listener to the document. 279 | * @param eventName A string representing the event type to listen for. 280 | * @param callback The function or listener object that receives a notification when an event of the specified type occurs. 281 | * @param capture If true, useCapture indicates that the user wishes to initiate capture. 282 | */ 283 | addEventListener(eventName: string, callback: EventListenerOrEventListenerObject, capture: boolean): void; 284 | /** 285 | * Remove an event listener from the document. 286 | * @param eventName A string representing the event type to listen for. 287 | * @param callback The function or listener object to remove from the event. 288 | * @param capture Specifies whether the listener to be removed was registered as a capturing listener or not. 289 | */ 290 | removeEventListener(eventName: string, callback: EventListenerOrEventListenerObject, capture: boolean): void; 291 | /** 292 | * Adopts a node from an external document. 293 | * @param node The node to be adopted. 294 | * @return The adopted node able to be used in the document. 295 | */ 296 | adoptNode(node: Node): Node; 297 | /** 298 | * Creates the specified HTML element or an HTMLUnknownElement if the given element name isn't a known one. 299 | * @param tagName A string that specifies the type of element to be created. 300 | * @return The created element. 301 | */ 302 | // createElement(tagName: T): HTMLElementTagNameMap; 303 | createElement(tagName: string): HTMLElement; 304 | /** 305 | * Creates the specified HTML attribute 306 | * @param name A string that specifies the name of attribute to be created. 307 | * @return The created attribute. 308 | */ 309 | createAttribute(name: string): Attr; 310 | /** 311 | * Creates a new Text node. 312 | * @param text A string to populate the new Text node. 313 | * @return A Text node. 314 | */ 315 | createTextNode(text: string): Text; 316 | /** 317 | * Creates a new Comment node. 318 | * @param text A string to populate the new Comment node. 319 | * @return A Comment node. 320 | */ 321 | createComment(text: string): Comment; 322 | /** 323 | * Creates a new DocumentFragment. 324 | * @return A DocumentFragment. 325 | */ 326 | createDocumentFragment(): DocumentFragment; 327 | /** 328 | * Creates a new HTMLTemplateElement. 329 | * @return An HTMLTemplateElement. 330 | */ 331 | createTemplateElement(): HTMLTemplateElement; 332 | /** 333 | * Creates a new MutationObserver. 334 | * @param callback A callback that will recieve the change records with the mutations. 335 | * @return A MutationObservere. 336 | */ 337 | createMutationObserver(callback: Function): MutationObserver; 338 | /** 339 | * Creates a new CustomEvent. 340 | * @param eventType A string representing the event type. 341 | * @param options An options object specifying bubbles:boolean, cancelable:boolean and/or detail:Object information. 342 | * @return A CustomEvent. 343 | */ 344 | createCustomEvent(eventType: string, options?: CustomEventInit): CustomEvent; 345 | /** 346 | * Dispatches an event on the document. 347 | * @param evt The event to dispatch. 348 | */ 349 | dispatchEvent(evt: Event): void; 350 | /** 351 | * Gives the values of all the CSS properties of an element after applying the active stylesheets and resolving any basic computation those values may contain. 352 | * @param element The Element for which to get the computed style. 353 | * @return The computed styles. 354 | */ 355 | getComputedStyle(element: Element): CSSStyleDeclaration; 356 | /** 357 | * Locates an element in the document according to its id. 358 | * @param id The id to search the document for. 359 | * @return The found element. 360 | */ 361 | getElementById(id: string): Element; 362 | /** 363 | * Performs a query selector on the document and returns first matched element, depth first. 364 | * @param query The query to use in searching the document. 365 | * @return A list of all matched elements in the document. 366 | */ 367 | // enable the following two lines if we switch to TypeScript 368 | // querySelector(selectors: K): HTMLElementTagNameMap[K] | null; 369 | // querySelector(selectors: K): SVGElementTagNameMap[K] | null; 370 | querySelector(selectors: string): Element; 371 | /** 372 | * Performs a query selector on the document and returns all located matches. 373 | * @param query The query to use in searching the document. 374 | * @return A list of all matched elements in the document. 375 | */ 376 | // enable the following two lines if we switch to TypeScript 377 | // querySelectorAll(selectors: K): NodeListOf; 378 | // querySelectorAll(selectors: K): NodeListOf; 379 | querySelectorAll(selectors: string): NodeList; 380 | /** 381 | * Gets the element that is the next sibling of the provided element. 382 | * @param element The element whose next sibling is being located. 383 | * @return The next sibling Element of the provided Element. 384 | */ 385 | nextElementSibling(element: Node): Element; 386 | /** 387 | * Creates an HTMLTemplateElement using the markup provided. 388 | * @param markup A string containing the markup to turn into a template. Note: This string must contain the template element as well. 389 | * @return The instance of HTMLTemplateElement that was created from the provided markup. 390 | */ 391 | createTemplateFromMarkup(markup: string): HTMLTemplateElement; 392 | /** 393 | * Appends a node to the parent, if provided, or the document.body otherwise. 394 | * @param newNode The node to append. 395 | * @param parentNode The node to append to, otherwise the document.body. 396 | */ 397 | appendNode(newNode: Node, parentNode?: Node): void; 398 | /** 399 | * Replaces a node in the parent with a new node. 400 | * @param newNode The node to replace the old node with. 401 | * @param node The node that is being replaced. 402 | * @param parentNode The node that the current node is parented to. 403 | */ 404 | replaceNode(newNode: Node, node: Node, parentNode?: Node): void; 405 | /** 406 | * Removes the specified node from the parent node. 407 | * @param node The node to remove. 408 | * @param parentNode The parent node from which the node will be removed. 409 | */ 410 | removeNode(node: Node, parentNode?: Node): void; 411 | /** 412 | * Injects styles into the destination element, or the document.head if no destination is provided. 413 | * @param styles The css text to injext. 414 | * @param destination The destination element to inject the css text into. If not specified it will default to the document.head. 415 | * @param prepend Indicates whether or not the styles should be prepended to the destination. By default they are appended. 416 | * @param id The existing style element's id to replace the contents for 417 | * @return The Style node that was created. 418 | */ 419 | injectStyles(styles: string, destination?: Element, prepend?: boolean, id?: string): Node; 420 | } 421 | 422 | /** 423 | * The singleton instance of the Dom API. 424 | */ 425 | export const DOM: Dom = {}; 426 | export let isInitialized = false; 427 | /** 428 | * Enables initializing a specific implementation of the Platform Abstraction Layer (PAL). 429 | * @param callback Allows providing a callback which configures the three PAL singletons with their platform-specific implementations. 430 | */ 431 | export function initializePAL(callback: (platform: Platform, feature: Feature, dom: Dom) => void): void { 432 | if (isInitialized) { 433 | return; 434 | } 435 | isInitialized = true; 436 | if (typeof Object.getPropertyDescriptor !== 'function') { 437 | Object.getPropertyDescriptor = function(subject, name) { 438 | let pd = Object.getOwnPropertyDescriptor(subject, name); 439 | let proto = Object.getPrototypeOf(subject); 440 | while (typeof pd === 'undefined' && proto !== null) { 441 | pd = Object.getOwnPropertyDescriptor(proto, name); 442 | proto = Object.getPrototypeOf(proto); 443 | } 444 | return pd; 445 | }; 446 | } 447 | 448 | callback(PLATFORM, FEATURE, DOM); 449 | } 450 | export function reset() { 451 | isInitialized = false; 452 | } 453 | -------------------------------------------------------------------------------- /dist/commonjs/aurelia-pal.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | exports.AggregateError = AggregateError; 7 | exports.initializePAL = initializePAL; 8 | exports.reset = reset; 9 | function AggregateError(message, innerError, skipIfAlreadyAggregate) { 10 | if (innerError) { 11 | if (innerError.innerError && skipIfAlreadyAggregate) { 12 | return innerError; 13 | } 14 | 15 | var separator = '\n------------------------------------------------\n'; 16 | 17 | message += separator + 'Inner Error:\n'; 18 | 19 | if (typeof innerError === 'string') { 20 | message += 'Message: ' + innerError; 21 | } else { 22 | if (innerError.message) { 23 | message += 'Message: ' + innerError.message; 24 | } else { 25 | message += 'Unknown Inner Error Type. Displaying Inner Error as JSON:\n ' + JSON.stringify(innerError, null, ' '); 26 | } 27 | 28 | if (innerError.stack) { 29 | message += '\nInner Error Stack:\n' + innerError.stack; 30 | message += '\nEnd Inner Error Stack'; 31 | } 32 | } 33 | 34 | message += separator; 35 | } 36 | 37 | var e = new Error(message); 38 | if (innerError) { 39 | e.innerError = innerError; 40 | } 41 | 42 | return e; 43 | } 44 | 45 | var FEATURE = exports.FEATURE = {}; 46 | 47 | var PLATFORM = exports.PLATFORM = { 48 | noop: function noop() {}, 49 | eachModule: function eachModule() {}, 50 | moduleName: function (_moduleName) { 51 | function moduleName(_x) { 52 | return _moduleName.apply(this, arguments); 53 | } 54 | 55 | moduleName.toString = function () { 56 | return _moduleName.toString(); 57 | }; 58 | 59 | return moduleName; 60 | }(function (moduleName) { 61 | return moduleName; 62 | }) 63 | }; 64 | 65 | PLATFORM.global = function () { 66 | if (typeof self !== 'undefined') { 67 | return self; 68 | } 69 | 70 | if (typeof global !== 'undefined') { 71 | return global; 72 | } 73 | 74 | return new Function('return this')(); 75 | }(); 76 | 77 | var DOM = exports.DOM = {}; 78 | var isInitialized = exports.isInitialized = false; 79 | function initializePAL(callback) { 80 | if (isInitialized) { 81 | return; 82 | } 83 | exports.isInitialized = isInitialized = true; 84 | if (typeof Object.getPropertyDescriptor !== 'function') { 85 | Object.getPropertyDescriptor = function (subject, name) { 86 | var pd = Object.getOwnPropertyDescriptor(subject, name); 87 | var proto = Object.getPrototypeOf(subject); 88 | while (typeof pd === 'undefined' && proto !== null) { 89 | pd = Object.getOwnPropertyDescriptor(proto, name); 90 | proto = Object.getPrototypeOf(proto); 91 | } 92 | return pd; 93 | }; 94 | } 95 | 96 | callback(PLATFORM, FEATURE, DOM); 97 | } 98 | function reset() { 99 | exports.isInitialized = isInitialized = false; 100 | } -------------------------------------------------------------------------------- /dist/commonjs/index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | 7 | var _aureliaPal = require('./aurelia-pal'); 8 | 9 | Object.keys(_aureliaPal).forEach(function (key) { 10 | if (key === "default" || key === "__esModule") return; 11 | Object.defineProperty(exports, key, { 12 | enumerable: true, 13 | get: function get() { 14 | return _aureliaPal[key]; 15 | } 16 | }); 17 | }); -------------------------------------------------------------------------------- /dist/es2015/aurelia-pal.js: -------------------------------------------------------------------------------- 1 | 2 | export function AggregateError(message, innerError, skipIfAlreadyAggregate) { 3 | if (innerError) { 4 | if (innerError.innerError && skipIfAlreadyAggregate) { 5 | return innerError; 6 | } 7 | 8 | const separator = '\n------------------------------------------------\n'; 9 | 10 | message += `${separator}Inner Error:\n`; 11 | 12 | if (typeof innerError === 'string') { 13 | message += `Message: ${innerError}`; 14 | } else { 15 | if (innerError.message) { 16 | message += `Message: ${innerError.message}`; 17 | } else { 18 | message += `Unknown Inner Error Type. Displaying Inner Error as JSON:\n ${JSON.stringify(innerError, null, ' ')}`; 19 | } 20 | 21 | if (innerError.stack) { 22 | message += `\nInner Error Stack:\n${innerError.stack}`; 23 | message += '\nEnd Inner Error Stack'; 24 | } 25 | } 26 | 27 | message += separator; 28 | } 29 | 30 | let e = new Error(message); 31 | if (innerError) { 32 | e.innerError = innerError; 33 | } 34 | 35 | return e; 36 | } 37 | 38 | export const FEATURE = {}; 39 | 40 | export const PLATFORM = { 41 | noop() {}, 42 | eachModule() {}, 43 | moduleName(moduleName) { 44 | return moduleName; 45 | } 46 | }; 47 | 48 | PLATFORM.global = function () { 49 | if (typeof self !== 'undefined') { 50 | return self; 51 | } 52 | 53 | if (typeof global !== 'undefined') { 54 | return global; 55 | } 56 | 57 | return new Function('return this')(); 58 | }(); 59 | 60 | export const DOM = {}; 61 | export let isInitialized = false; 62 | 63 | export function initializePAL(callback) { 64 | if (isInitialized) { 65 | return; 66 | } 67 | isInitialized = true; 68 | if (typeof Object.getPropertyDescriptor !== 'function') { 69 | Object.getPropertyDescriptor = function (subject, name) { 70 | let pd = Object.getOwnPropertyDescriptor(subject, name); 71 | let proto = Object.getPrototypeOf(subject); 72 | while (typeof pd === 'undefined' && proto !== null) { 73 | pd = Object.getOwnPropertyDescriptor(proto, name); 74 | proto = Object.getPrototypeOf(proto); 75 | } 76 | return pd; 77 | }; 78 | } 79 | 80 | callback(PLATFORM, FEATURE, DOM); 81 | } 82 | export function reset() { 83 | isInitialized = false; 84 | } -------------------------------------------------------------------------------- /dist/es2015/index.js: -------------------------------------------------------------------------------- 1 | export * from './aurelia-pal'; -------------------------------------------------------------------------------- /dist/index.d.ts: -------------------------------------------------------------------------------- 1 | export * from 'aurelia-pal/aurelia-pal'; -------------------------------------------------------------------------------- /dist/native-modules/aurelia-pal.js: -------------------------------------------------------------------------------- 1 | 2 | export function AggregateError(message, innerError, skipIfAlreadyAggregate) { 3 | if (innerError) { 4 | if (innerError.innerError && skipIfAlreadyAggregate) { 5 | return innerError; 6 | } 7 | 8 | var separator = '\n------------------------------------------------\n'; 9 | 10 | message += separator + 'Inner Error:\n'; 11 | 12 | if (typeof innerError === 'string') { 13 | message += 'Message: ' + innerError; 14 | } else { 15 | if (innerError.message) { 16 | message += 'Message: ' + innerError.message; 17 | } else { 18 | message += 'Unknown Inner Error Type. Displaying Inner Error as JSON:\n ' + JSON.stringify(innerError, null, ' '); 19 | } 20 | 21 | if (innerError.stack) { 22 | message += '\nInner Error Stack:\n' + innerError.stack; 23 | message += '\nEnd Inner Error Stack'; 24 | } 25 | } 26 | 27 | message += separator; 28 | } 29 | 30 | var e = new Error(message); 31 | if (innerError) { 32 | e.innerError = innerError; 33 | } 34 | 35 | return e; 36 | } 37 | 38 | export var FEATURE = {}; 39 | 40 | export var PLATFORM = { 41 | noop: function noop() {}, 42 | eachModule: function eachModule() {}, 43 | moduleName: function (_moduleName) { 44 | function moduleName(_x) { 45 | return _moduleName.apply(this, arguments); 46 | } 47 | 48 | moduleName.toString = function () { 49 | return _moduleName.toString(); 50 | }; 51 | 52 | return moduleName; 53 | }(function (moduleName) { 54 | return moduleName; 55 | }) 56 | }; 57 | 58 | PLATFORM.global = function () { 59 | if (typeof self !== 'undefined') { 60 | return self; 61 | } 62 | 63 | if (typeof global !== 'undefined') { 64 | return global; 65 | } 66 | 67 | return new Function('return this')(); 68 | }(); 69 | 70 | export var DOM = {}; 71 | export var isInitialized = false; 72 | 73 | export function initializePAL(callback) { 74 | if (isInitialized) { 75 | return; 76 | } 77 | isInitialized = true; 78 | if (typeof Object.getPropertyDescriptor !== 'function') { 79 | Object.getPropertyDescriptor = function (subject, name) { 80 | var pd = Object.getOwnPropertyDescriptor(subject, name); 81 | var proto = Object.getPrototypeOf(subject); 82 | while (typeof pd === 'undefined' && proto !== null) { 83 | pd = Object.getOwnPropertyDescriptor(proto, name); 84 | proto = Object.getPrototypeOf(proto); 85 | } 86 | return pd; 87 | }; 88 | } 89 | 90 | callback(PLATFORM, FEATURE, DOM); 91 | } 92 | export function reset() { 93 | isInitialized = false; 94 | } -------------------------------------------------------------------------------- /dist/native-modules/index.js: -------------------------------------------------------------------------------- 1 | export * from './aurelia-pal'; -------------------------------------------------------------------------------- /dist/system/aurelia-pal.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | System.register([], function (_export, _context) { 4 | "use strict"; 5 | 6 | var FEATURE, PLATFORM, DOM, isInitialized; 7 | function AggregateError(message, innerError, skipIfAlreadyAggregate) { 8 | if (innerError) { 9 | if (innerError.innerError && skipIfAlreadyAggregate) { 10 | return innerError; 11 | } 12 | 13 | var separator = '\n------------------------------------------------\n'; 14 | 15 | message += separator + 'Inner Error:\n'; 16 | 17 | if (typeof innerError === 'string') { 18 | message += 'Message: ' + innerError; 19 | } else { 20 | if (innerError.message) { 21 | message += 'Message: ' + innerError.message; 22 | } else { 23 | message += 'Unknown Inner Error Type. Displaying Inner Error as JSON:\n ' + JSON.stringify(innerError, null, ' '); 24 | } 25 | 26 | if (innerError.stack) { 27 | message += '\nInner Error Stack:\n' + innerError.stack; 28 | message += '\nEnd Inner Error Stack'; 29 | } 30 | } 31 | 32 | message += separator; 33 | } 34 | 35 | var e = new Error(message); 36 | if (innerError) { 37 | e.innerError = innerError; 38 | } 39 | 40 | return e; 41 | } 42 | 43 | _export('AggregateError', AggregateError); 44 | 45 | function initializePAL(callback) { 46 | if (isInitialized) { 47 | return; 48 | } 49 | _export('isInitialized', isInitialized = true); 50 | if (typeof Object.getPropertyDescriptor !== 'function') { 51 | Object.getPropertyDescriptor = function (subject, name) { 52 | var pd = Object.getOwnPropertyDescriptor(subject, name); 53 | var proto = Object.getPrototypeOf(subject); 54 | while (typeof pd === 'undefined' && proto !== null) { 55 | pd = Object.getOwnPropertyDescriptor(proto, name); 56 | proto = Object.getPrototypeOf(proto); 57 | } 58 | return pd; 59 | }; 60 | } 61 | 62 | callback(PLATFORM, FEATURE, DOM); 63 | } 64 | 65 | _export('initializePAL', initializePAL); 66 | 67 | function reset() { 68 | _export('isInitialized', isInitialized = false); 69 | } 70 | 71 | _export('reset', reset); 72 | 73 | return { 74 | setters: [], 75 | execute: function () { 76 | _export('FEATURE', FEATURE = {}); 77 | 78 | _export('FEATURE', FEATURE); 79 | 80 | _export('PLATFORM', PLATFORM = { 81 | noop: function noop() {}, 82 | eachModule: function eachModule() {}, 83 | moduleName: function (_moduleName) { 84 | function moduleName(_x) { 85 | return _moduleName.apply(this, arguments); 86 | } 87 | 88 | moduleName.toString = function () { 89 | return _moduleName.toString(); 90 | }; 91 | 92 | return moduleName; 93 | }(function (moduleName) { 94 | return moduleName; 95 | }) 96 | }); 97 | 98 | _export('PLATFORM', PLATFORM); 99 | 100 | PLATFORM.global = function () { 101 | if (typeof self !== 'undefined') { 102 | return self; 103 | } 104 | 105 | if (typeof global !== 'undefined') { 106 | return global; 107 | } 108 | 109 | return new Function('return this')(); 110 | }(); 111 | 112 | _export('DOM', DOM = {}); 113 | 114 | _export('DOM', DOM); 115 | 116 | _export('isInitialized', isInitialized = false); 117 | 118 | _export('isInitialized', isInitialized); 119 | } 120 | }; 121 | }); -------------------------------------------------------------------------------- /dist/system/index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | System.register(['./aurelia-pal'], function (_export, _context) { 4 | "use strict"; 5 | 6 | return { 7 | setters: [function (_aureliaPal) { 8 | var _exportObj = {}; 9 | 10 | for (var _key in _aureliaPal) { 11 | if (_key !== "default" && _key !== "__esModule") _exportObj[_key] = _aureliaPal[_key]; 12 | } 13 | 14 | _export(_exportObj); 15 | }], 16 | execute: function () {} 17 | }; 18 | }); -------------------------------------------------------------------------------- /doc/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | 2 | ## [1.8.3](https://github.com/aurelia/pal/compare/1.8.1...1.8.3) (2019-03-26) 3 | 4 | 5 | ### Bug Fixes 6 | 7 | * **all:** change es2015 back to native-modules ([753316a](https://github.com/aurelia/pal/commit/753316a)) 8 | 9 | 10 | 11 | 12 | ## [1.8.2](https://github.com/aurelia/pal/compare/1.8.1...1.8.2) (2019-02-04) 13 | 14 | 15 | ### Bug Fixes 16 | 17 | * **all:** change es2015 back to native-modules ([753316a](https://github.com/aurelia/pal/commit/753316a)) 18 | 19 | 20 | 21 | 22 | ## [1.8.1](https://github.com/aurelia/pal/compare/1.8.0...1.8.1) (2019-01-17) 23 | 24 | * Update module configuration in package.json 25 | 26 | 27 | # [1.8.0](https://github.com/aurelia/pal/compare/1.7.0...1.8.0) (2018-04-17) 28 | 29 | 30 | ### Bug Fixes 31 | 32 | * **lint:** fix lint issues ([fc1c26b](https://github.com/aurelia/pal/commit/fc1c26b)) 33 | * **typings:** remove generic custom event ([4d0cfb0](https://github.com/aurelia/pal/commit/4d0cfb0)) 34 | * **typings:** remove too new typings ([e0beab8](https://github.com/aurelia/pal/commit/e0beab8)) 35 | 36 | 37 | 38 | 39 | # [1.7.0](https://github.com/aurelia/pal/compare/1.6.0...v1.7.0) (2018-03-06) 40 | 41 | 42 | ### Features 43 | 44 | * **performance:** update to the performance API ([c5adba7](https://github.com/aurelia/pal/commit/c5adba7)) 45 | 46 | 47 | 48 | 49 | # [1.6.0](https://github.com/aurelia/pal/compare/1.5.0...v1.6.0) (2018-03-03) 50 | 51 | ### Features 52 | 53 | * **dom:** add NodeList to global ([701dc34](https://github.com/aurelia/pal/commit/701dc34)) 54 | 55 | ### Bug Fixes 56 | 57 | * **index:** Fixed missing injectStyles param description ([8b0204d](https://github.com/aurelia/pal/commit/8b0204d)) 58 | 59 | 60 | 61 | # [1.5.0](https://github.com/aurelia/pal/compare/1.4.0...v1.5.0) (2018-01-27) 62 | 63 | ### Features 64 | 65 | * **dom**: Enable injectStyles to replace the contents of an existing style element by id. 66 | 67 | 68 | # [1.4.0](https://github.com/aurelia/pal/compare/1.3.0...v1.4.0) (2017-08-22) 69 | 70 | 71 | ### Bug Fixes 72 | 73 | * **index:** add missing semicolon ([f5336ab](https://github.com/aurelia/pal/commit/f5336ab)) 74 | 75 | 76 | ### Features 77 | 78 | * **dom:** add createAttribute function ([a785008](https://github.com/aurelia/pal/commit/a785008)) 79 | * **dom:** add createTemplateElement ([03ae1cc](https://github.com/aurelia/pal/commit/03ae1cc)) 80 | 81 | 82 | 83 | 84 | # [1.3.0](https://github.com/aurelia/pal/compare/1.2.0...v1.3.0) (2017-02-21) 85 | 86 | 87 | ### Bug Fixes 88 | 89 | * **build:** declare ModuleNameOptions as it's understood by the new Webpack plugin ([2cf136b](https://github.com/aurelia/pal/commit/2cf136b)) 90 | 91 | 92 | ### Features 93 | 94 | * **typings:** add shorthand for moduleName's second parameter ([41f0926](https://github.com/aurelia/pal/commit/41f0926)) 95 | 96 | 97 | 98 | 99 | # [1.2.0](https://github.com/aurelia/pal/compare/1.1.1...v1.2.0) (2016-12-13) 100 | 101 | 102 | ### Features 103 | 104 | * **index:** add PLATFORM.moduleName ([da92298](https://github.com/aurelia/pal/commit/da92298)) 105 | 106 | 107 | 108 | 109 | ## [1.1.1](https://github.com/aurelia/pal/compare/1.1.0...v1.1.1) (2016-12-08) 110 | 111 | 112 | ### Bug Fixes 113 | 114 | * **typings:** reference to the loader interface ([0b50caa](https://github.com/aurelia/pal/commit/0b50caa)) 115 | 116 | 117 | 118 | 119 | # [1.1.0](https://github.com/aurelia/pal/compare/1.0.0...v1.1.0) (2016-12-07) 120 | 121 | 122 | ### Bug Fixes 123 | 124 | * **index:** proper typings ([15a8692](https://github.com/aurelia/pal/commit/15a8692)) 125 | 126 | 127 | ### Features 128 | 129 | * **index:** move isInitialized to aurelia-pal ([7b75f00](https://github.com/aurelia/pal/commit/7b75f00)) 130 | 131 | 132 | 133 | 134 | # [1.0.0](https://github.com/aurelia/pal/compare/1.0.0-rc.1.0.0...v1.0.0) (2016-07-27) 135 | 136 | 137 | 138 | 139 | # [1.0.0-rc.1.0.0](https://github.com/aurelia/pal/compare/1.0.0-beta.2.0.0...v1.0.0-rc.1.0.0) (2016-06-22) 140 | 141 | 142 | 143 | ### 1.0.0-beta.1.2.2 (2016-05-10) 144 | 145 | 146 | ### 1.0.0-beta.1.2.1 (2016-05-03) 147 | 148 | 149 | #### Bug Fixes 150 | 151 | * **AggregateError:** better surface inner error information ([d2e0ee70](http://github.com/aurelia/pal/commit/d2e0ee70ad790999e61f4d4e31341062146cbcbf)) 152 | 153 | 154 | ### 1.0.0-beta.1.2.0 (2016-03-22) 155 | 156 | 157 | #### Bug Fixes 158 | 159 | * **dom:** mark optional parameters ([3485be0f](http://github.com/aurelia/pal/commit/3485be0f7c31451f1126828e2320c14272ef5ea1)) 160 | * **platform:** fix type of global ([6eb6937c](http://github.com/aurelia/pal/commit/6eb6937c594dfcb150e20f82c2536e0c3d0b15d6)) 161 | 162 | 163 | 164 | ## 1.0.0-beta.1.1.1 (2016-01-28) 165 | 166 | * fix package metadata 167 | 168 | ## 1.0.0-beta.1.1.0 (2016-01-28) 169 | 170 | 171 | #### Features 172 | 173 | * **all:** update for jspm and update core-js ([1b636c3b](http://github.com/aurelia/pal/commit/1b636c3ba07470c34008474c6a286c5f21a75d7c)) 174 | * **index:** add mutationObserver feature detection ([c61582f5](http://github.com/aurelia/pal/commit/c61582f5b1e37a3013c9718016042f5c23a073e3)) 175 | 176 | 177 | ### 1.0.0-beta.1.0.2 (2016-01-08) 178 | 179 | 180 | #### Bug Fixes 181 | 182 | * **index:** remove interface methods for Object/Array observe ([d9099c9b](http://github.com/aurelia/pal/commit/d9099c9bfd1e37032e17d7ad7ed60e3fcad4aedd)) 183 | 184 | 185 | ### 1.0.0-beta.1.0.1 (2015-12-16) 186 | 187 | 188 | #### Features 189 | 190 | * **PAL:** requestAnimationFrame and performance APIs ([09177bff](http://github.com/aurelia/pal/commit/09177bffc52f02f9138972c44f4c0082adcad1e9)) 191 | 192 | 193 | ### 1.0.0-beta.1 (2015-11-15) 194 | 195 | 196 | ## 0.3.0 (2015-11-09) 197 | 198 | 199 | ## 0.2.0 (2015-10-13) 200 | 201 | 202 | #### Bug Fixes 203 | 204 | * **package:** correct main ([bb65d20e](http://github.com/aurelia/pal/commit/bb65d20ee1432eb43fe7a1b07b47229cbee3a903)) 205 | * **platform:** correct eachModule signature ([ccc1c5e4](http://github.com/aurelia/pal/commit/ccc1c5e43b786acce56371a434f945659e5a36fe)) 206 | 207 | 208 | #### Features 209 | 210 | * **DOM:** 211 | * add dispatchEvent ([55c07b55](http://github.com/aurelia/pal/commit/55c07b55e794904cdaae1b1fc86cfe4b377c7192)) 212 | * add getTitle and setTitle methods ([ae630995](http://github.com/aurelia/pal/commit/ae630995f993c6b43718438d9f53578ee11c968c)) 213 | * **all:** 214 | * add scopedCSS and activeElement ([66d4fbbe](http://github.com/aurelia/pal/commit/66d4fbbed5b0f30b0ef582106f170a030bf2fcf1)) 215 | * new initialization mechanism; make DOM.title a property ([8d11bd1e](http://github.com/aurelia/pal/commit/8d11bd1e46e45df89832e4d22baef0f3458593b2)) 216 | * add event listener apis to dom and platform ([b23c1f1c](http://github.com/aurelia/pal/commit/b23c1f1c3712300c7b6975c87919988bd8a2abe5)) 217 | * add interface definitions ([f3c9c995](http://github.com/aurelia/pal/commit/f3c9c995003eff0eafd0d3885426d620b77d0086)) 218 | * initial implementation ([435fc905](http://github.com/aurelia/pal/commit/435fc905198de3ad1b2fd87b59751c7ecd8abae9)) 219 | * **dom:** 220 | * add SVGElement ([b848bb9b](http://github.com/aurelia/pal/commit/b848bb9b7fb1064f4c8c7e153d42118ddffe67cf)) 221 | * add appendNode ([9b0ebabe](http://github.com/aurelia/pal/commit/9b0ebabe3cbfdc1b19dfb307eae763d0f0df83ab)) 222 | * **index:** add getPropertyDescriptor polyfill ([cc2297ad](http://github.com/aurelia/pal/commit/cc2297ad4e761c8eef9061144362725d87d415b4)) 223 | * **platform:** add noop ([3193afb5](http://github.com/aurelia/pal/commit/3193afb555241add6d57e2943d527f414fdc4546)) 224 | 225 | 226 | ### 0.1.10 (2015-10-09) 227 | 228 | 229 | #### Features 230 | 231 | * **all:** add scopedCSS and activeElement ([66d4fbbe](http://github.com/aurelia/pal/commit/66d4fbbed5b0f30b0ef582106f170a030bf2fcf1)) 232 | 233 | 234 | ### 0.1.9 (2015-10-04) 235 | 236 | 237 | #### Features 238 | 239 | * **dom:** add SVGElement ([b848bb9b](http://github.com/aurelia/pal/commit/b848bb9b7fb1064f4c8c7e153d42118ddffe67cf)) 240 | 241 | 242 | ### 0.1.8 (2015-10-04) 243 | 244 | 245 | #### Features 246 | 247 | * **index:** add getPropertyDescriptor polyfill ([cc2297ad](http://github.com/aurelia/pal/commit/cc2297ad4e761c8eef9061144362725d87d415b4)) 248 | 249 | 250 | ### 0.1.7 (2015-10-02) 251 | 252 | 253 | #### Features 254 | 255 | * **dom:** add appendNode ([9b0ebabe](http://github.com/aurelia/pal/commit/9b0ebabe3cbfdc1b19dfb307eae763d0f0df83ab)) 256 | 257 | 258 | ### 0.1.6 (2015-10-02) 259 | 260 | 261 | #### Features 262 | 263 | * **DOM:** add dispatchEvent ([55c07b55](http://github.com/aurelia/pal/commit/55c07b55e794904cdaae1b1fc86cfe4b377c7192)) 264 | 265 | 266 | ### 0.1.5 (2015-10-02) 267 | 268 | 269 | #### Features 270 | 271 | * **DOM:** add getTitle and setTitle methods ([ae630995](http://github.com/aurelia/pal/commit/ae630995f993c6b43718438d9f53578ee11c968c)) 272 | * **all:** new initialization mechanism; make DOM.title a property ([8d11bd1e](http://github.com/aurelia/pal/commit/8d11bd1e46e45df89832e4d22baef0f3458593b2)) 273 | 274 | 275 | ### 0.1.4 (2015-10-02) 276 | 277 | 278 | #### Features 279 | 280 | * **all:** add event listener apis to dom and platform ([b23c1f1c](http://github.com/aurelia/pal/commit/b23c1f1c3712300c7b6975c87919988bd8a2abe5)) 281 | 282 | 283 | ### 0.1.3 (2015-09-27) 284 | 285 | 286 | #### Bug Fixes 287 | 288 | * **platform:** correct eachModule signature ([ccc1c5e4](http://github.com/aurelia/pal/commit/ccc1c5e43b786acce56371a434f945659e5a36fe)) 289 | 290 | 291 | ### 0.1.2 (2015-09-27) 292 | 293 | 294 | #### Features 295 | 296 | * **platform:** add noop ([3193afb5](http://github.com/aurelia/pal/commit/3193afb555241add6d57e2943d527f414fdc4546)) 297 | -------------------------------------------------------------------------------- /doc/api.json: -------------------------------------------------------------------------------- 1 | {"name":"aurelia-pal","children":[{"id":83,"name":"Dom","kind":256,"kindString":"Interface","flags":{"isExported":true},"comment":{"shortText":"Represents the core APIs of the DOM."},"children":[{"id":84,"name":"Element","kind":1024,"kindString":"Property","flags":{"isExported":true},"comment":{"shortText":"The global DOM Element type."},"sources":[{"fileName":"aurelia-pal.d.ts","line":207,"character":9}],"type":{"type":"reflection","declaration":{"id":85,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"children":[{"id":87,"name":"constructor","kind":512,"kindString":"Constructor","flags":{},"signatures":[{"id":88,"name":"new __type","kind":16384,"kindString":"Constructor signature","flags":{},"type":{"type":"reference","name":"__type","id":85}}],"sources":[{"fileName":"/home/circleci/repo/node_modules/typedoc/node_modules/typescript/lib/lib.es6.d.ts","line":8398,"character":23}]},{"id":86,"name":"prototype","kind":32,"kindString":"Variable","flags":{},"sources":[{"fileName":"/home/circleci/repo/node_modules/typedoc/node_modules/typescript/lib/lib.es6.d.ts","line":8398,"character":13}],"type":{"type":"reference","name":"Element"}}],"groups":[{"title":"Constructors","kind":512,"children":[87]},{"title":"Variables","kind":32,"children":[86]}],"sources":[{"fileName":"aurelia-pal.d.ts","line":207,"character":10}]}}},{"id":89,"name":"NodeList","kind":1024,"kindString":"Property","flags":{"isExported":true},"comment":{"shortText":"The global DOM NodeList type."},"sources":[{"fileName":"aurelia-pal.d.ts","line":212,"character":10}],"type":{"type":"reflection","declaration":{"id":90,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"children":[{"id":92,"name":"constructor","kind":512,"kindString":"Constructor","flags":{},"signatures":[{"id":93,"name":"new __type","kind":16384,"kindString":"Constructor signature","flags":{},"type":{"type":"reference","name":"__type","id":90}}],"sources":[{"fileName":"/home/circleci/repo/node_modules/typedoc/node_modules/typescript/lib/lib.es6.d.ts","line":13382,"character":24}]},{"id":91,"name":"prototype","kind":32,"kindString":"Variable","flags":{},"sources":[{"fileName":"/home/circleci/repo/node_modules/typedoc/node_modules/typescript/lib/lib.es6.d.ts","line":13382,"character":13}],"type":{"type":"reference","name":"NodeList"}}],"groups":[{"title":"Constructors","kind":512,"children":[92]},{"title":"Variables","kind":32,"children":[91]}],"sources":[{"fileName":"aurelia-pal.d.ts","line":212,"character":11}]}}},{"id":94,"name":"SVGElement","kind":1024,"kindString":"Property","flags":{"isExported":true},"comment":{"shortText":"The global DOM SVGElement type."},"sources":[{"fileName":"aurelia-pal.d.ts","line":217,"character":12}],"type":{"type":"reflection","declaration":{"id":95,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"children":[{"id":97,"name":"constructor","kind":512,"kindString":"Constructor","flags":{},"signatures":[{"id":98,"name":"new __type","kind":16384,"kindString":"Constructor signature","flags":{},"type":{"type":"reference","name":"__type","id":95}}],"sources":[{"fileName":"/home/circleci/repo/node_modules/typedoc/node_modules/typescript/lib/lib.es6.d.ts","line":14132,"character":26}]},{"id":96,"name":"prototype","kind":32,"kindString":"Variable","flags":{},"sources":[{"fileName":"/home/circleci/repo/node_modules/typedoc/node_modules/typescript/lib/lib.es6.d.ts","line":14132,"character":13}],"type":{"type":"reference","name":"SVGElement"}}],"groups":[{"title":"Constructors","kind":512,"children":[97]},{"title":"Variables","kind":32,"children":[96]}],"sources":[{"fileName":"aurelia-pal.d.ts","line":217,"character":13}]}}},{"id":101,"name":"activeElement","kind":1024,"kindString":"Property","flags":{"isExported":true},"comment":{"shortText":"The document's active/focused element."},"sources":[{"fileName":"aurelia-pal.d.ts","line":232,"character":15}],"type":{"type":"reference","name":"Element"}},{"id":99,"name":"boundary","kind":1024,"kindString":"Property","flags":{"isExported":true},"comment":{"shortText":"A key representing a DOM boundary."},"sources":[{"fileName":"aurelia-pal.d.ts","line":222,"character":10}],"type":{"type":"instrinct","name":"string"}},{"id":100,"name":"title","kind":1024,"kindString":"Property","flags":{"isExported":true},"comment":{"shortText":"The document title."},"sources":[{"fileName":"aurelia-pal.d.ts","line":227,"character":7}],"type":{"type":"instrinct","name":"string"}},{"id":102,"name":"addEventListener","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":103,"name":"addEventListener","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Add an event listener to the document."},"parameters":[{"id":104,"name":"eventName","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"A string representing the event type to listen for."},"type":{"type":"instrinct","name":"string"}},{"id":105,"name":"callback","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The function or listener object that receives a notification when an event of the specified type occurs."},"type":{"type":"reference","name":"EventListenerOrEventListenerObject"}},{"id":106,"name":"capture","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"If true, useCapture indicates that the user wishes to initiate capture.\n"},"type":{"type":"instrinct","name":"boolean"}}],"type":{"type":"instrinct","name":"void"}}],"sources":[{"fileName":"aurelia-pal.d.ts","line":240,"character":18}]},{"id":112,"name":"adoptNode","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":113,"name":"adoptNode","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Adopts a node from an external document.","returns":"The adopted node able to be used in the document.\n"},"parameters":[{"id":114,"name":"node","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The node to be adopted."},"type":{"type":"reference","name":"Node"}}],"type":{"type":"reference","name":"Node"}}],"sources":[{"fileName":"aurelia-pal.d.ts","line":255,"character":11}]},{"id":159,"name":"appendNode","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":160,"name":"appendNode","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Appends a node to the parent, if provided, or the document.body otherwise."},"parameters":[{"id":161,"name":"newNode","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The node to append."},"type":{"type":"reference","name":"Node"}},{"id":162,"name":"parentNode","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"comment":{"text":"The node to append to, otherwise the document.body.\n"},"type":{"type":"reference","name":"Node"}}],"type":{"type":"instrinct","name":"void"}}],"sources":[{"fileName":"aurelia-pal.d.ts","line":372,"character":12}]},{"id":118,"name":"createAttribute","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":119,"name":"createAttribute","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Creates the specified HTML attribute","returns":"The created attribute.\n"},"parameters":[{"id":120,"name":"name","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"A string that specifies the name of attribute to be created."},"type":{"type":"instrinct","name":"string"}}],"type":{"type":"reference","name":"Attr"}}],"sources":[{"fileName":"aurelia-pal.d.ts","line":270,"character":17}]},{"id":124,"name":"createComment","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":125,"name":"createComment","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Creates a new Comment node.","returns":"A Comment node.\n"},"parameters":[{"id":126,"name":"text","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"A string to populate the new Comment node."},"type":{"type":"instrinct","name":"string"}}],"type":{"type":"reference","name":"Comment"}}],"sources":[{"fileName":"aurelia-pal.d.ts","line":284,"character":15}]},{"id":134,"name":"createCustomEvent","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":135,"name":"createCustomEvent","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Creates a new CustomEvent.","returns":"A CustomEvent.\n"},"parameters":[{"id":136,"name":"eventType","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"A string representing the event type."},"type":{"type":"instrinct","name":"string"}},{"id":137,"name":"options","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"comment":{"text":"An options object specifying bubbles:boolean, cancelable:boolean and/or detail:Object information."},"type":{"type":"reference","name":"CustomEventInit"}}],"type":{"type":"reference","name":"CustomEvent"}}],"sources":[{"fileName":"aurelia-pal.d.ts","line":311,"character":19}]},{"id":127,"name":"createDocumentFragment","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":128,"name":"createDocumentFragment","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Creates a new DocumentFragment.","returns":"A DocumentFragment.\n"},"type":{"type":"reference","name":"DocumentFragment"}}],"sources":[{"fileName":"aurelia-pal.d.ts","line":290,"character":24}]},{"id":115,"name":"createElement","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":116,"name":"createElement","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Creates the specified HTML element or an HTMLUnknownElement if the given element name isn't a known one.","returns":"The created element.\n"},"parameters":[{"id":117,"name":"tagName","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"A string that specifies the type of element to be created."},"type":{"type":"instrinct","name":"string"}}],"type":{"type":"reference","name":"HTMLElement"}}],"sources":[{"fileName":"aurelia-pal.d.ts","line":263,"character":15}]},{"id":131,"name":"createMutationObserver","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":132,"name":"createMutationObserver","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Creates a new MutationObserver.","returns":"A MutationObservere.\n"},"parameters":[{"id":133,"name":"callback","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"A callback that will recieve the change records with the mutations."},"type":{"type":"reference","name":"Function"}}],"type":{"type":"reference","name":"MutationObserver"}}],"sources":[{"fileName":"aurelia-pal.d.ts","line":303,"character":24}]},{"id":129,"name":"createTemplateElement","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":130,"name":"createTemplateElement","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Creates a new HTMLTemplateElement.","returns":"An HTMLTemplateElement.\n"},"type":{"type":"reference","name":"HTMLTemplateElement"}}],"sources":[{"fileName":"aurelia-pal.d.ts","line":296,"character":23}]},{"id":156,"name":"createTemplateFromMarkup","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":157,"name":"createTemplateFromMarkup","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Creates an HTMLTemplateElement using the markup provided.","returns":"The instance of HTMLTemplateElement that was created from the provided markup.\n"},"parameters":[{"id":158,"name":"markup","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"A string containing the markup to turn into a template. Note: This string must contain the template element as well."},"type":{"type":"instrinct","name":"string"}}],"type":{"type":"reference","name":"HTMLTemplateElement"}}],"sources":[{"fileName":"aurelia-pal.d.ts","line":365,"character":26}]},{"id":121,"name":"createTextNode","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":122,"name":"createTextNode","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Creates a new Text node.","returns":"A Text node.\n"},"parameters":[{"id":123,"name":"text","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"A string to populate the new Text node."},"type":{"type":"instrinct","name":"string"}}],"type":{"type":"reference","name":"Text"}}],"sources":[{"fileName":"aurelia-pal.d.ts","line":277,"character":16}]},{"id":138,"name":"dispatchEvent","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":139,"name":"dispatchEvent","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Dispatches an event on the document."},"parameters":[{"id":140,"name":"evt","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The event to dispatch.\n"},"type":{"type":"reference","name":"Event"}}],"type":{"type":"instrinct","name":"void"}}],"sources":[{"fileName":"aurelia-pal.d.ts","line":317,"character":15}]},{"id":141,"name":"getComputedStyle","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":142,"name":"getComputedStyle","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Gives the values of all the CSS properties of an element after applying the active stylesheets and resolving any basic computation those values may contain.","returns":"The computed styles.\n"},"parameters":[{"id":143,"name":"element","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The Element for which to get the computed style."},"type":{"type":"reference","name":"Element"}}],"type":{"type":"reference","name":"CSSStyleDeclaration"}}],"sources":[{"fileName":"aurelia-pal.d.ts","line":324,"character":18}]},{"id":144,"name":"getElementById","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":145,"name":"getElementById","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Locates an element in the document according to its id.","returns":"The found element.\n"},"parameters":[{"id":146,"name":"id","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The id to search the document for."},"type":{"type":"instrinct","name":"string"}}],"type":{"type":"reference","name":"Element"}}],"sources":[{"fileName":"aurelia-pal.d.ts","line":331,"character":16}]},{"id":172,"name":"injectStyles","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":173,"name":"injectStyles","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Injects styles into the destination element, or the document.head if no destination is provided.","returns":"The Style node that was created.\n"},"parameters":[{"id":174,"name":"styles","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The css text to injext."},"type":{"type":"instrinct","name":"string"}},{"id":175,"name":"destination","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"comment":{"text":"The destination element to inject the css text into. If not specified it will default to the document.head."},"type":{"type":"reference","name":"Element"}},{"id":176,"name":"prepend","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"comment":{"text":"Indicates whether or not the styles should be prepended to the destination. By default they are appended."},"type":{"type":"instrinct","name":"boolean"}},{"id":177,"name":"id","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"comment":{"text":"The existing style element's id to replace the contents for"},"type":{"type":"instrinct","name":"string"}}],"type":{"type":"reference","name":"Node"}}],"sources":[{"fileName":"aurelia-pal.d.ts","line":397,"character":14}]},{"id":153,"name":"nextElementSibling","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":154,"name":"nextElementSibling","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Gets the element that is the next sibling of the provided element.","returns":"The next sibling Element of the provided Element.\n"},"parameters":[{"id":155,"name":"element","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The element whose next sibling is being located."},"type":{"type":"reference","name":"Node"}}],"type":{"type":"reference","name":"Element"}}],"sources":[{"fileName":"aurelia-pal.d.ts","line":358,"character":20}]},{"id":147,"name":"querySelector","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":148,"name":"querySelector","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Performs a query selector on the document and returns first matched element, depth first.","returns":"A list of all matched elements in the document.\n"},"parameters":[{"id":149,"name":"selectors","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"string"}}],"type":{"type":"reference","name":"Element"}}],"sources":[{"fileName":"aurelia-pal.d.ts","line":341,"character":15}]},{"id":150,"name":"querySelectorAll","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":151,"name":"querySelectorAll","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Performs a query selector on the document and returns all located matches.","returns":"A list of all matched elements in the document.\n"},"parameters":[{"id":152,"name":"selectors","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"string"}}],"type":{"type":"reference","name":"NodeList"}}],"sources":[{"fileName":"aurelia-pal.d.ts","line":351,"character":18}]},{"id":107,"name":"removeEventListener","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":108,"name":"removeEventListener","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Remove an event listener from the document."},"parameters":[{"id":109,"name":"eventName","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"A string representing the event type to listen for."},"type":{"type":"instrinct","name":"string"}},{"id":110,"name":"callback","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The function or listener object to remove from the event."},"type":{"type":"reference","name":"EventListenerOrEventListenerObject"}},{"id":111,"name":"capture","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"Specifies whether the listener to be removed was registered as a capturing listener or not.\n"},"type":{"type":"instrinct","name":"boolean"}}],"type":{"type":"instrinct","name":"void"}}],"sources":[{"fileName":"aurelia-pal.d.ts","line":248,"character":21}]},{"id":168,"name":"removeNode","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":169,"name":"removeNode","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Removes the specified node from the parent node."},"parameters":[{"id":170,"name":"node","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The node to remove."},"type":{"type":"reference","name":"Node"}},{"id":171,"name":"parentNode","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"comment":{"text":"The parent node from which the node will be removed.\n"},"type":{"type":"reference","name":"Node"}}],"type":{"type":"instrinct","name":"void"}}],"sources":[{"fileName":"aurelia-pal.d.ts","line":387,"character":12}]},{"id":163,"name":"replaceNode","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":164,"name":"replaceNode","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Replaces a node in the parent with a new node."},"parameters":[{"id":165,"name":"newNode","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The node to replace the old node with."},"type":{"type":"reference","name":"Node"}},{"id":166,"name":"node","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The node that is being replaced."},"type":{"type":"reference","name":"Node"}},{"id":167,"name":"parentNode","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"comment":{"text":"The node that the current node is parented to.\n"},"type":{"type":"reference","name":"Node"}}],"type":{"type":"instrinct","name":"void"}}],"sources":[{"fileName":"aurelia-pal.d.ts","line":380,"character":13}]}],"groups":[{"title":"Properties","kind":1024,"children":[84,89,94,101,99,100]},{"title":"Methods","kind":2048,"children":[102,112,159,118,124,134,127,115,131,129,156,121,138,141,144,172,153,147,150,107,168,163]}],"sources":[{"fileName":"aurelia-pal.d.ts","line":202,"character":28}]},{"id":2,"name":"Feature","kind":256,"kindString":"Interface","flags":{"isExported":true},"comment":{"shortText":"Enables discovery of what features the runtime environment supports."},"children":[{"id":5,"name":"htmlTemplateElement","kind":1024,"kindString":"Property","flags":{"isExported":true},"comment":{"shortText":"Does the runtime environment support native HTMLTemplateElement?"},"sources":[{"fileName":"aurelia-pal.d.ts","line":20,"character":21}],"type":{"type":"instrinct","name":"boolean"}},{"id":6,"name":"mutationObserver","kind":1024,"kindString":"Property","flags":{"isExported":true},"comment":{"shortText":"Does the runtime environment support native DOM mutation observers?"},"sources":[{"fileName":"aurelia-pal.d.ts","line":25,"character":18}],"type":{"type":"instrinct","name":"boolean"}},{"id":4,"name":"scopedCSS","kind":1024,"kindString":"Property","flags":{"isExported":true},"comment":{"shortText":"Does the runtime environment support the css scoped attribute?"},"sources":[{"fileName":"aurelia-pal.d.ts","line":15,"character":11}],"type":{"type":"instrinct","name":"boolean"}},{"id":3,"name":"shadowDOM","kind":1024,"kindString":"Property","flags":{"isExported":true},"comment":{"shortText":"Does the runtime environment support ShadowDOM?"},"sources":[{"fileName":"aurelia-pal.d.ts","line":10,"character":11}],"type":{"type":"instrinct","name":"boolean"}}],"groups":[{"title":"Properties","kind":1024,"children":[5,6,4,3]}],"sources":[{"fileName":"aurelia-pal.d.ts","line":5,"character":32}]},{"id":80,"name":"ModuleNameOptions","kind":256,"kindString":"Interface","flags":{"isExported":true},"comment":{"shortText":"Options used during the static analysis that inform how to process a given module."},"children":[{"id":81,"name":"chunk","kind":1024,"kindString":"Property","flags":{"isExported":true,"isOptional":true},"comment":{"shortText":"Add the module to a chunk by name"},"sources":[{"fileName":"aurelia-pal.d.ts","line":191,"character":7}],"type":{"type":"instrinct","name":"string"}},{"id":82,"name":"exports","kind":1024,"kindString":"Property","flags":{"isExported":true,"isOptional":true},"comment":{"shortText":"Optionally declare which exports are used. This enables tree-shaking when only few out of many exports are used."},"sources":[{"fileName":"aurelia-pal.d.ts","line":196,"character":9}],"type":{"type":"instrinct","isArray":true,"name":"string"}}],"groups":[{"title":"Properties","kind":1024,"children":[81,82]}],"sources":[{"fileName":"aurelia-pal.d.ts","line":186,"character":42}]},{"id":7,"name":"Performance","kind":256,"kindString":"Interface","flags":{"isExported":true},"comment":{"shortText":"The runtime's performance API."},"children":[{"id":10,"name":"clearMarks","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":11,"name":"clearMarks","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Removes the given mark from the browser's performance entry buffer.","tags":[{"tag":"memberof","text":"IPerformance\n"}]},"parameters":[{"id":12,"name":"markName","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"type":{"type":"instrinct","name":"string"}}],"type":{"type":"instrinct","name":"void"}}],"sources":[{"fileName":"aurelia-pal.d.ts","line":45,"character":12}]},{"id":13,"name":"clearMeasures","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":14,"name":"clearMeasures","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Removes the given measure from the browser's performance entry buffer.","tags":[{"tag":"memberof","text":"IPerformance\n"}]},"parameters":[{"id":15,"name":"measureName","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"type":{"type":"instrinct","name":"string"}}],"type":{"type":"instrinct","name":"void"}}],"sources":[{"fileName":"aurelia-pal.d.ts","line":53,"character":15}]},{"id":16,"name":"getEntriesByName","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":17,"name":"getEntriesByName","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Returns a list of PerformanceEntry objects based on the given name and entry type.","tags":[{"tag":"memberof","text":"IPerformance\n"}]},"parameters":[{"id":18,"name":"name","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The name of the entry to retrieve"},"type":{"type":"instrinct","name":"string"}},{"id":19,"name":"entryType","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"type":{"type":"instrinct","name":"string"}}],"type":{"type":"instrinct","name":"any"}}],"sources":[{"fileName":"aurelia-pal.d.ts","line":63,"character":18}]},{"id":20,"name":"getEntriesByType","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":21,"name":"getEntriesByType","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Returns a list of PerformanceEntry objects of the given entry type.","tags":[{"tag":"memberof","text":"IPerformance\n"}]},"parameters":[{"id":22,"name":"entryType","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The type of entry to retrieve such as \"mark\". The valid entry types are listed in PerformanceEntry.entryType."},"type":{"type":"instrinct","name":"string"}}],"type":{"type":"instrinct","name":"any"}}],"sources":[{"fileName":"aurelia-pal.d.ts","line":72,"character":18}]},{"id":23,"name":"mark","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":24,"name":"mark","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Creates a timestamp in the browser's performance entry buffer with the given name.","tags":[{"tag":"memberof","text":"IPerformance\n"}]},"parameters":[{"id":25,"name":"markName","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"a DOMString representing the name of the mark"},"type":{"type":"instrinct","name":"string"}}],"type":{"type":"instrinct","name":"void"}}],"sources":[{"fileName":"aurelia-pal.d.ts","line":80,"character":6}]},{"id":26,"name":"measure","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":27,"name":"measure","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Creates a named timestamp in the browser's performance entry buffer between two specified marks (known as the start mark and end mark, respectively).","tags":[{"tag":"memberof","text":"IPerformance\n"}]},"parameters":[{"id":28,"name":"measureName","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"a DOMString representing the name of the measure."},"type":{"type":"instrinct","name":"string"}},{"id":29,"name":"startMarkName","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"type":{"type":"instrinct","name":"string"}},{"id":30,"name":"endMarkName","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"type":{"type":"instrinct","name":"string"}}],"type":{"type":"instrinct","name":"void"}}],"sources":[{"fileName":"aurelia-pal.d.ts","line":90,"character":9}]},{"id":8,"name":"now","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":9,"name":"now","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Gets a DOMHighResTimeStamp.","returns":"The timestamp, measured in milliseconds, accurate to one thousandth of a millisecond.\n"},"type":{"type":"instrinct","name":"number"}}],"sources":[{"fileName":"aurelia-pal.d.ts","line":37,"character":5}]}],"groups":[{"title":"Methods","kind":2048,"children":[10,13,16,20,23,26,8]}],"sources":[{"fileName":"aurelia-pal.d.ts","line":31,"character":36}]},{"id":31,"name":"Platform","kind":256,"kindString":"Interface","flags":{"isExported":true},"comment":{"shortText":"Represents the core APIs of the runtime environment."},"children":[{"id":72,"name":"Loader","kind":1024,"kindString":"Property","flags":{"isExported":true},"comment":{"shortText":"Reference to the Loader Class (set after the loader has been first imported)"},"sources":[{"fileName":"aurelia-pal.d.ts","line":163,"character":8}],"type":{"type":"instrinct","name":"any"}},{"id":43,"name":"XMLHttpRequest","kind":1024,"kindString":"Property","flags":{"isExported":true},"comment":{"shortText":"The runtime's XMLHttpRequest API."},"sources":[{"fileName":"aurelia-pal.d.ts","line":136,"character":16}],"type":{"type":"reflection","declaration":{"id":44,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"children":[{"id":46,"name":"constructor","kind":512,"kindString":"Constructor","flags":{},"signatures":[{"id":47,"name":"new __type","kind":16384,"kindString":"Constructor signature","flags":{},"type":{"type":"reference","name":"__type","id":44}}],"sources":[{"fileName":"/home/circleci/repo/node_modules/typedoc/node_modules/typescript/lib/lib.es6.d.ts","line":17532,"character":30}]},{"id":48,"name":"DONE","kind":32,"kindString":"Variable","flags":{},"sources":[{"fileName":"/home/circleci/repo/node_modules/typedoc/node_modules/typescript/lib/lib.es6.d.ts","line":17534,"character":8}],"type":{"type":"instrinct","name":"number"}},{"id":49,"name":"HEADERS_RECEIVED","kind":32,"kindString":"Variable","flags":{},"sources":[{"fileName":"/home/circleci/repo/node_modules/typedoc/node_modules/typescript/lib/lib.es6.d.ts","line":17535,"character":20}],"type":{"type":"instrinct","name":"number"}},{"id":50,"name":"LOADING","kind":32,"kindString":"Variable","flags":{},"sources":[{"fileName":"/home/circleci/repo/node_modules/typedoc/node_modules/typescript/lib/lib.es6.d.ts","line":17536,"character":11}],"type":{"type":"instrinct","name":"number"}},{"id":51,"name":"OPENED","kind":32,"kindString":"Variable","flags":{},"sources":[{"fileName":"/home/circleci/repo/node_modules/typedoc/node_modules/typescript/lib/lib.es6.d.ts","line":17537,"character":10}],"type":{"type":"instrinct","name":"number"}},{"id":52,"name":"UNSENT","kind":32,"kindString":"Variable","flags":{},"sources":[{"fileName":"/home/circleci/repo/node_modules/typedoc/node_modules/typescript/lib/lib.es6.d.ts","line":17538,"character":10}],"type":{"type":"instrinct","name":"number"}},{"id":45,"name":"prototype","kind":32,"kindString":"Variable","flags":{},"sources":[{"fileName":"/home/circleci/repo/node_modules/typedoc/node_modules/typescript/lib/lib.es6.d.ts","line":17532,"character":13}],"type":{"type":"reference","name":"XMLHttpRequest"}},{"id":53,"name":"create","kind":64,"kindString":"Function","flags":{},"signatures":[{"id":54,"name":"create","kind":4096,"kindString":"Call signature","flags":{},"type":{"type":"reference","name":"XMLHttpRequest"}}],"sources":[{"fileName":"/home/circleci/repo/node_modules/typedoc/node_modules/typescript/lib/lib.es6.d.ts","line":17539,"character":10}]}],"groups":[{"title":"Constructors","kind":512,"children":[46]},{"title":"Variables","kind":32,"children":[48,49,50,51,52,45]},{"title":"Functions","kind":64,"children":[53]}],"sources":[{"fileName":"aurelia-pal.d.ts","line":136,"character":17}]}}},{"id":32,"name":"global","kind":1024,"kindString":"Property","flags":{"isExported":true},"comment":{"shortText":"The runtime environment's global."},"sources":[{"fileName":"aurelia-pal.d.ts","line":104,"character":8}],"type":{"type":"instrinct","name":"any"}},{"id":35,"name":"history","kind":1024,"kindString":"Property","flags":{"isExported":true},"comment":{"shortText":"The runtime's history API."},"sources":[{"fileName":"aurelia-pal.d.ts","line":119,"character":9}],"type":{"type":"reference","name":"History"}},{"id":34,"name":"location","kind":1024,"kindString":"Property","flags":{"isExported":true},"comment":{"shortText":"The runtime's location API."},"sources":[{"fileName":"aurelia-pal.d.ts","line":114,"character":10}],"type":{"type":"reference","name":"Location"}},{"id":33,"name":"noop","kind":1024,"kindString":"Property","flags":{"isExported":true},"comment":{"shortText":"A function wich does nothing."},"sources":[{"fileName":"aurelia-pal.d.ts","line":109,"character":6}],"type":{"type":"reference","name":"Function"}},{"id":36,"name":"performance","kind":1024,"kindString":"Property","flags":{"isExported":true},"comment":{"shortText":"The runtime's performance API"},"sources":[{"fileName":"aurelia-pal.d.ts","line":124,"character":13}],"type":{"type":"reference","name":"Performance","id":7}},{"id":62,"name":"addEventListener","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":63,"name":"addEventListener","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Add a global event listener."},"parameters":[{"id":64,"name":"eventName","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"A string representing the event type to listen for."},"type":{"type":"instrinct","name":"string"}},{"id":65,"name":"callback","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The function that receives a notification when an event of the specified type occurs."},"type":{"type":"reference","name":"EventListenerOrEventListenerObject"}},{"id":66,"name":"capture","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"comment":{"text":"If true, useCapture indicates that the user wishes to initiate capture.\n"},"type":{"type":"instrinct","name":"boolean"}}],"type":{"type":"instrinct","name":"void"}}],"sources":[{"fileName":"aurelia-pal.d.ts","line":150,"character":18}]},{"id":55,"name":"eachModule","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":56,"name":"eachModule","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Iterate all modules loaded by the script loader."},"parameters":[{"id":57,"name":"callback","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"A callback that will receive each module id along with the module object. Return true to end enumeration.\n"},"type":{"type":"reflection","declaration":{"id":58,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"signatures":[{"id":59,"name":"__call","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":60,"name":"key","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"string"}},{"id":61,"name":"value","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"Object"}}],"type":{"type":"instrinct","name":"boolean"}}],"sources":[{"fileName":"aurelia-pal.d.ts","line":142,"character":22}]}}}],"type":{"type":"instrinct","name":"void"}}],"sources":[{"fileName":"aurelia-pal.d.ts","line":142,"character":12}]},{"id":73,"name":"moduleName","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":74,"name":"moduleName","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Resolves a module name to a path resolvable by the loader. By default returns the first parameter.\nIt is recommended to use this for all dynamic imports as it enables static analysis\nand optionally allows adding custom metadata used by the build step.","text":"References to this method should always literally call `PLATFORM.moduleName(...)`.\nThis enables the build step to statically optimize the code by replacing the reference with a string.\n"},"parameters":[{"id":75,"name":"moduleName","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"Absolute or relative path to the module."},"type":{"type":"instrinct","name":"string"}},{"id":76,"name":"options","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"comment":{"text":"Optional options used during the static analysis that inform how to process the module.\n"},"type":{"type":"reference","name":"ModuleNameOptions","id":80}}],"type":{"type":"instrinct","name":"string"}},{"id":77,"name":"moduleName","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":78,"name":"moduleName","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"string"}},{"id":79,"name":"chunk","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"type":{"type":"instrinct","name":"string"}}],"type":{"type":"instrinct","name":"string"}}],"sources":[{"fileName":"aurelia-pal.d.ts","line":176,"character":12},{"fileName":"aurelia-pal.d.ts","line":177,"character":12}]},{"id":67,"name":"removeEventListener","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":68,"name":"removeEventListener","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Remove a global event listener."},"parameters":[{"id":69,"name":"eventName","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"A string representing the event type to listen for."},"type":{"type":"instrinct","name":"string"}},{"id":70,"name":"callback","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The function to remove from the event."},"type":{"type":"reference","name":"EventListenerOrEventListenerObject"}},{"id":71,"name":"capture","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"comment":{"text":"Specifies whether the listener to be removed was registered as a capturing listener or not.\n"},"type":{"type":"instrinct","name":"boolean"}}],"type":{"type":"instrinct","name":"void"}}],"sources":[{"fileName":"aurelia-pal.d.ts","line":158,"character":21}]},{"id":37,"name":"requestAnimationFrame","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":38,"name":"requestAnimationFrame","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Registers a function to call when the system is ready to update (repaint) the display.","returns":"A long integer value, the request id, that uniquely identifies the entry in the callback list.\n"},"parameters":[{"id":39,"name":"callback","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The function to call."},"type":{"type":"reflection","declaration":{"id":40,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"signatures":[{"id":41,"name":"__call","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":42,"name":"animationFrameStart","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"number"}}],"type":{"type":"instrinct","name":"void"}}],"sources":[{"fileName":"aurelia-pal.d.ts","line":131,"character":33}]}}}],"type":{"type":"instrinct","name":"number"}}],"sources":[{"fileName":"aurelia-pal.d.ts","line":131,"character":23}]}],"groups":[{"title":"Properties","kind":1024,"children":[72,43,32,35,34,33,36]},{"title":"Methods","kind":2048,"children":[62,55,73,67,37]}],"sources":[{"fileName":"aurelia-pal.d.ts","line":99,"character":33}]},{"id":185,"name":"DOM","kind":32,"kindString":"Variable","flags":{"isExported":true},"comment":{"shortText":"The singleton instance of the Dom API."},"sources":[{"fileName":"aurelia-pal.d.ts","line":431,"character":24}],"type":{"type":"reference","name":"Dom","id":83}},{"id":183,"name":"FEATURE","kind":32,"kindString":"Variable","flags":{"isExported":true},"comment":{"shortText":"The singleton instance of the Feature discovery API."},"sources":[{"fileName":"aurelia-pal.d.ts","line":415,"character":28}],"type":{"type":"reference","name":"Feature","id":2}},{"id":184,"name":"PLATFORM","kind":32,"kindString":"Variable","flags":{"isExported":true},"comment":{"shortText":"The singleton instance of the Platform API."},"sources":[{"fileName":"aurelia-pal.d.ts","line":423,"character":29}],"type":{"type":"reference","name":"Platform","id":31}},{"id":186,"name":"isInitialized","kind":32,"kindString":"Variable","flags":{"isExported":true},"sources":[{"fileName":"aurelia-pal.d.ts","line":432,"character":32}],"type":{"type":"instrinct","name":"any"}},{"id":178,"name":"AggregateError","kind":64,"kindString":"Function","flags":{"isExported":true},"signatures":[{"id":179,"name":"AggregateError","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Creates an instance of Error that aggregates and preserves an innerError.","returns":"The Error instance.\n"},"parameters":[{"id":180,"name":"message","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The error message."},"type":{"type":"instrinct","name":"string"}},{"id":181,"name":"innerError","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"comment":{"text":"The inner error message to aggregate."},"type":{"type":"reference","name":"Error"}},{"id":182,"name":"skipIfAlreadyAggregate","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"comment":{"text":"Indicates to not wrap the inner error if it itself already has an innerError."},"type":{"type":"instrinct","name":"boolean"}}],"type":{"type":"reference","name":"Error"}}],"sources":[{"fileName":"aurelia-pal.d.ts","line":407,"character":38}]},{"id":187,"name":"initializePAL","kind":64,"kindString":"Function","flags":{"isExported":true},"signatures":[{"id":188,"name":"initializePAL","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Enables initializing a specific implementation of the Platform Abstraction Layer (PAL)."},"parameters":[{"id":189,"name":"callback","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"Allows providing a callback which configures the three PAL singletons with their platform-specific implementations.\n"},"type":{"type":"reflection","declaration":{"id":190,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"signatures":[{"id":191,"name":"__call","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":192,"name":"platform","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"Platform","id":31}},{"id":193,"name":"feature","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"Feature","id":2}},{"id":194,"name":"dom","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"Dom","id":83}}],"type":{"type":"instrinct","name":"void"}}],"sources":[{"fileName":"aurelia-pal.d.ts","line":438,"character":47}]}}}],"type":{"type":"instrinct","name":"void"}}],"sources":[{"fileName":"aurelia-pal.d.ts","line":438,"character":37}]},{"id":195,"name":"reset","kind":64,"kindString":"Function","flags":{"isExported":true},"signatures":[{"id":196,"name":"reset","kind":4096,"kindString":"Call signature","flags":{},"type":{"type":"instrinct","name":"any"}}],"sources":[{"fileName":"aurelia-pal.d.ts","line":439,"character":29}]}],"groups":[{"title":"Interfaces","kind":256,"children":[83,2,80,7,31]},{"title":"Variables","kind":32,"children":[185,183,184,186]},{"title":"Functions","kind":64,"children":[178,187,195]}]} -------------------------------------------------------------------------------- /gulpfile.js: -------------------------------------------------------------------------------- 1 | require('require-dir')('build/tasks'); 2 | -------------------------------------------------------------------------------- /karma.conf.js: -------------------------------------------------------------------------------- 1 | // Karma configuration 2 | // Generated on Fri Dec 05 2014 16:49:29 GMT-0500 (EST) 3 | 4 | module.exports = function(config) { 5 | config.set({ 6 | 7 | // base path that will be used to resolve all patterns (eg. files, exclude) 8 | basePath: '', 9 | 10 | 11 | // frameworks to use 12 | // available frameworks: https://npmjs.org/browse/keyword/karma-adapter 13 | frameworks: ['jspm', 'jasmine'], 14 | 15 | jspm: { 16 | // Edit this to your needs 17 | loadFiles: ['src/**/*.js', 'test/**/*.js'] 18 | }, 19 | 20 | 21 | // list of files / patterns to load in the browser 22 | files: [], 23 | 24 | 25 | // list of files to exclude 26 | exclude: [ 27 | ], 28 | 29 | 30 | // preprocess matching files before serving them to the browser 31 | // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor 32 | preprocessors: { 33 | 'test/**/*.js': ['babel'], 34 | 'src/**/*.js': ['babel'] 35 | }, 36 | 'babelPreprocessor': { 37 | options: { 38 | sourceMap: 'inline', 39 | presets: [ 'es2015-loose', 'stage-1'], 40 | plugins: [ 41 | 'syntax-flow', 42 | 'transform-decorators-legacy', 43 | 'transform-flow-strip-types' 44 | ] 45 | } 46 | }, 47 | 48 | 49 | // test results reporter to use 50 | // possible values: 'dots', 'progress' 51 | // available reporters: https://npmjs.org/browse/keyword/karma-reporter 52 | reporters: ['progress'], 53 | 54 | 55 | // web server port 56 | port: 9876, 57 | 58 | 59 | // enable / disable colors in the output (reporters and logs) 60 | colors: true, 61 | 62 | 63 | // level of logging 64 | // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG 65 | logLevel: config.LOG_INFO, 66 | 67 | 68 | // enable / disable watching file and executing tests whenever any file changes 69 | autoWatch: true, 70 | 71 | 72 | // start these browsers 73 | // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher 74 | browsers: ['Chrome'], 75 | 76 | 77 | // Continuous Integration mode 78 | // if true, Karma captures browsers, runs the tests and exits 79 | singleRun: false 80 | }); 81 | }; 82 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "aurelia-pal", 3 | "version": "1.8.3", 4 | "description": "Aurelia's platform abstraction layer (PAL).", 5 | "keywords": [ 6 | "aurelia", 7 | "pal" 8 | ], 9 | "homepage": "http://aurelia.io", 10 | "bugs": { 11 | "url": "https://github.com/aurelia/pal/issues" 12 | }, 13 | "license": "MIT", 14 | "author": "Rob Eisenberg (http://robeisenberg.com/)", 15 | "main": "dist/commonjs/aurelia-pal.js", 16 | "module": "dist/native-modules/aurelia-pal.js", 17 | "typings": "dist/aurelia-pal.d.ts", 18 | "repository": { 19 | "type": "git", 20 | "url": "http://github.com/aurelia/pal" 21 | }, 22 | "scripts": { 23 | "test": "karma start --single-run", 24 | "build": "gulp build", 25 | "cut-release": "gulp prepare-release" 26 | }, 27 | "files": [ 28 | "dist", 29 | "doc", 30 | "src", 31 | "typings.json", 32 | "README.md", 33 | "LICENSE" 34 | ], 35 | "jspm": { 36 | "registry": "npm", 37 | "main": "aurelia-pal", 38 | "format": "amd", 39 | "directories": { 40 | "dist": "dist/amd" 41 | }, 42 | "devDependencies": { 43 | "babel": "babel-core@^5.8.22", 44 | "babel-runtime": "^5.8.20", 45 | "core-js": "^2.0.3" 46 | } 47 | }, 48 | "devDependencies": { 49 | "aurelia-tools": "^0.2.4", 50 | "babel-dts-generator": "^0.6.1", 51 | "babel-eslint": "^6.1.2", 52 | "babel-plugin-syntax-flow": "^6.8.0", 53 | "babel-plugin-transform-decorators-legacy": "^1.3.4", 54 | "babel-plugin-transform-es2015-modules-amd": "^6.8.0", 55 | "babel-plugin-transform-es2015-modules-commonjs": "^6.11.5", 56 | "babel-plugin-transform-es2015-modules-systemjs": "^6.11.6", 57 | "babel-plugin-transform-flow-strip-types": "^6.8.0", 58 | "babel-preset-es2015": "^6.9.0", 59 | "babel-preset-es2015-loose": "^7.0.0", 60 | "babel-preset-es2015-loose-native-modules": "^1.0.0", 61 | "babel-preset-stage-1": "^6.5.0", 62 | "del": "^2.2.1", 63 | "eslint": "^3.1.1", 64 | "gulp": "^3.9.1", 65 | "gulp-babel": "^6.1.2", 66 | "gulp-bump": "^2.2.0", 67 | "gulp-concat": "^2.6.0", 68 | "gulp-conventional-changelog": "^1.1.0", 69 | "gulp-eslint": "^3.0.1", 70 | "gulp-ignore": "^2.0.1", 71 | "gulp-insert": "^0.5.0", 72 | "gulp-rename": "^1.2.2", 73 | "gulp-typedoc": "^2.0.0", 74 | "gulp-typescript": "^2.13.6", 75 | "gulp-util": "^3.0.7", 76 | "jasmine-core": "^2.4.1", 77 | "jspm": "^0.16.53", 78 | "karma": "^1.1.2", 79 | "karma-babel-preprocessor": "^6.0.1", 80 | "karma-chrome-launcher": "^1.0.1", 81 | "karma-coverage": "^1.1.1", 82 | "karma-jasmine": "^1.0.2", 83 | "karma-jspm": "^2.2.0", 84 | "merge2": "^1.0.2", 85 | "object.assign": "^4.0.4", 86 | "require-dir": "^0.3.0", 87 | "run-sequence": "^1.2.2", 88 | "through2": "^2.0.1", 89 | "typedoc": "^0.4.4", 90 | "typescript": "^1.9.0-dev.20160622-1.0", 91 | "vinyl": "^1.1.1", 92 | "vinyl-paths": "^2.1.0", 93 | "yargs": "^4.8.1" 94 | }, 95 | "aurelia": { 96 | "documentation": { 97 | "articles": [] 98 | } 99 | } 100 | } 101 | -------------------------------------------------------------------------------- /src/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Creates an instance of Error that aggregates and preserves an innerError. 3 | * @param message The error message. 4 | * @param innerError The inner error message to aggregate. 5 | * @param skipIfAlreadyAggregate Indicates to not wrap the inner error if it itself already has an innerError. 6 | * @return The Error instance. 7 | */ 8 | export function AggregateError(message: string, innerError?: Error, skipIfAlreadyAggregate?: boolean): Error { 9 | if (innerError) { 10 | if (innerError.innerError && skipIfAlreadyAggregate) { 11 | return innerError; 12 | } 13 | 14 | const separator = '\n------------------------------------------------\n'; 15 | 16 | message += `${separator}Inner Error:\n`; 17 | 18 | if (typeof (innerError) === 'string') { 19 | message += `Message: ${innerError}`; 20 | } else { 21 | if (innerError.message) { 22 | message += `Message: ${innerError.message}`; 23 | } else { 24 | message += `Unknown Inner Error Type. Displaying Inner Error as JSON:\n ${JSON.stringify(innerError, null, ' ')}`; 25 | } 26 | 27 | if (innerError.stack) { 28 | message += `\nInner Error Stack:\n${innerError.stack}`; 29 | message += '\nEnd Inner Error Stack'; 30 | } 31 | } 32 | 33 | message += separator; 34 | } 35 | 36 | let e = new Error(message); 37 | if (innerError) { 38 | e.innerError = innerError; 39 | } 40 | 41 | return e; 42 | } 43 | 44 | /** 45 | * Enables discovery of what features the runtime environment supports. 46 | */ 47 | interface Feature { 48 | /** 49 | * Does the runtime environment support ShadowDOM? 50 | */ 51 | shadowDOM: boolean; 52 | /** 53 | * Does the runtime environment support the css scoped attribute? 54 | */ 55 | scopedCSS: boolean; 56 | /** 57 | * Does the runtime environment support native HTMLTemplateElement? 58 | */ 59 | htmlTemplateElement: boolean; 60 | 61 | /** 62 | * Does the runtime environment support native DOM mutation observers? 63 | */ 64 | mutationObserver: boolean; 65 | } 66 | 67 | /** 68 | * The singleton instance of the Feature discovery API. 69 | */ 70 | export const FEATURE: Feature = {}; 71 | 72 | /** 73 | * The runtime's performance API. 74 | */ 75 | interface Performance { 76 | /** 77 | * Gets a DOMHighResTimeStamp. 78 | * @return The timestamp, measured in milliseconds, accurate to one thousandth of a millisecond. 79 | */ 80 | now(): number; 81 | 82 | /** 83 | * Removes the given mark from the browser's performance entry buffer. 84 | * 85 | * @param {string} [markName] A DOMString representing the name of the timestamp. If this argument is omitted, all performance entries with an entry type of "mark" will be removed. 86 | * @memberof IPerformance 87 | */ 88 | clearMarks(markName?: string): void; 89 | 90 | /** 91 | * Removes the given measure from the browser's performance entry buffer. 92 | * 93 | * @param {string} [measureName] A DOMString representing the name of the timestamp. If this argument is omitted, all performance entries with an entry type of "measure" will be removed. 94 | * @memberof IPerformance 95 | */ 96 | clearMeasures(measureName?: string): void; 97 | 98 | /** 99 | * Returns a list of PerformanceEntry objects based on the given name and entry type. 100 | * 101 | * @param {string} name The name of the entry to retrieve 102 | * @param {string} [entryType] The type of entry to retrieve such as "mark". The valid entry types are listed in PerformanceEntry.entryType. 103 | * @returns {*} 104 | * @memberof IPerformance 105 | */ 106 | getEntriesByName(name: string, entryType?: string): any; 107 | 108 | /** 109 | * Returns a list of PerformanceEntry objects of the given entry type. 110 | * 111 | * @param {string} entryType The type of entry to retrieve such as "mark". The valid entry types are listed in PerformanceEntry.entryType. 112 | * @returns {*} 113 | * @memberof IPerformance 114 | */ 115 | getEntriesByType(entryType: string): any; 116 | 117 | /** 118 | * Creates a timestamp in the browser's performance entry buffer with the given name. 119 | * 120 | * @param {string} markName a DOMString representing the name of the mark 121 | * @memberof IPerformance 122 | */ 123 | mark(markName: string): void; 124 | 125 | /** 126 | * Creates a named timestamp in the browser's performance entry buffer between two specified marks (known as the start mark and end mark, respectively). 127 | * 128 | * @param {string} measureName a DOMString representing the name of the measure. 129 | * @param {string} [startMarkName] A DOMString representing the name of the measure's starting mark. May also be the name of a PerformanceTiming property. 130 | * @param {string} [endMarkName] A DOMString representing the name of the measure's ending mark. May also be the name of a PerformanceTiming property. 131 | * @memberof IPerformance 132 | */ 133 | measure(measureName: string, startMarkName?: string, endMarkName?: string): void; 134 | } 135 | 136 | /** 137 | * Represents the core APIs of the runtime environment. 138 | */ 139 | interface Platform { 140 | /** 141 | * The runtime environment's global. 142 | */ 143 | global: any; 144 | /** 145 | * A function wich does nothing. 146 | */ 147 | noop: Function; 148 | /** 149 | * The runtime's location API. 150 | */ 151 | location: typeof window.location; 152 | /** 153 | * The runtime's history API. 154 | */ 155 | history: typeof window.history; 156 | /** 157 | * The runtime's performance API 158 | */ 159 | performance: Performance; 160 | /** 161 | * Registers a function to call when the system is ready to update (repaint) the display. 162 | * @param callback The function to call. 163 | * @return A long integer value, the request id, that uniquely identifies the entry in the callback list. 164 | */ 165 | requestAnimationFrame(callback: (animationFrameStart: number) => void): number; 166 | /** 167 | * The runtime's XMLHttpRequest API. 168 | */ 169 | XMLHttpRequest: typeof XMLHttpRequest; 170 | /** 171 | * Iterate all modules loaded by the script loader. 172 | * @param callback A callback that will receive each module id along with the module object. Return true to end enumeration. 173 | */ 174 | eachModule(callback: (key: string, value: Object) => boolean): void; 175 | /** 176 | * Add a global event listener. 177 | * @param eventName A string representing the event type to listen for. 178 | * @param callback The function that receives a notification when an event of the specified type occurs. 179 | * @param capture If true, useCapture indicates that the user wishes to initiate capture. 180 | */ 181 | addEventListener(eventName: string, callback: EventListenerOrEventListenerObject, capture?: boolean): void; 182 | /** 183 | * Remove a global event listener. 184 | * @param eventName A string representing the event type to listen for. 185 | * @param callback The function to remove from the event. 186 | * @param capture Specifies whether the listener to be removed was registered as a capturing listener or not. 187 | */ 188 | removeEventListener(eventName: string, callback: EventListenerOrEventListenerObject, capture?: boolean): void; 189 | /** 190 | * Reference to the Loader Class (set after the loader has been first imported) 191 | */ 192 | Loader: any; 193 | /** 194 | * Resolves a module name to a path resolvable by the loader. By default returns the first parameter. 195 | * It is recommended to use this for all dynamic imports as it enables static analysis 196 | * and optionally allows adding custom metadata used by the build step. 197 | * 198 | * References to this method should always literally call `PLATFORM.moduleName(...)`. 199 | * This enables the build step to statically optimize the code by replacing the reference with a string. 200 | * 201 | * @param moduleName Absolute or relative path to the module. 202 | * @param options Optional options used during the static analysis that inform how to process the module. 203 | */ 204 | moduleName(moduleName: string, options?: ModuleNameOptions): string; 205 | moduleName(moduleName: string, chunk?: string): string; 206 | } 207 | 208 | /** 209 | * Options used during the static analysis that inform how to process a given module. 210 | */ 211 | interface ModuleNameOptions { 212 | /** 213 | * Add the module to a chunk by name 214 | */ 215 | chunk?: string; 216 | /** 217 | * Optionally declare which exports are used. This enables tree-shaking when only few out of many exports are used. 218 | */ 219 | exports?: string[]; 220 | } 221 | 222 | /** 223 | * The singleton instance of the Platform API. 224 | */ 225 | export const PLATFORM: Platform = { 226 | noop() { }, 227 | eachModule() { }, 228 | moduleName(moduleName) { 229 | return moduleName; 230 | } 231 | }; 232 | 233 | PLATFORM.global = (function() { 234 | // Workers don’t have `window`, only `self` 235 | if (typeof self !== 'undefined') { 236 | return self; 237 | } 238 | 239 | if (typeof global !== 'undefined') { 240 | return global; 241 | } 242 | 243 | // Not all environments allow eval and Function 244 | // Use only as a last resort: 245 | return new Function('return this')(); 246 | })(); 247 | 248 | /** 249 | * Represents the core APIs of the DOM. 250 | */ 251 | interface Dom { 252 | /** 253 | * The global DOM Element type. 254 | */ 255 | Element: typeof Element; 256 | /** 257 | * The global DOM NodeList type. 258 | */ 259 | NodeList: typeof NodeList; 260 | /** 261 | * The global DOM SVGElement type. 262 | */ 263 | SVGElement: typeof SVGElement; 264 | /** 265 | * A key representing a DOM boundary. 266 | */ 267 | boundary: string; 268 | /** 269 | * The document title. 270 | */ 271 | title: string; 272 | /** 273 | * The document's active/focused element. 274 | */ 275 | activeElement: Element; 276 | /** 277 | * Add an event listener to the document. 278 | * @param eventName A string representing the event type to listen for. 279 | * @param callback The function or listener object that receives a notification when an event of the specified type occurs. 280 | * @param capture If true, useCapture indicates that the user wishes to initiate capture. 281 | */ 282 | addEventListener(eventName: string, callback: EventListenerOrEventListenerObject, capture: boolean): void; 283 | /** 284 | * Remove an event listener from the document. 285 | * @param eventName A string representing the event type to listen for. 286 | * @param callback The function or listener object to remove from the event. 287 | * @param capture Specifies whether the listener to be removed was registered as a capturing listener or not. 288 | */ 289 | removeEventListener(eventName: string, callback: EventListenerOrEventListenerObject, capture: boolean): void; 290 | /** 291 | * Adopts a node from an external document. 292 | * @param node The node to be adopted. 293 | * @return The adopted node able to be used in the document. 294 | */ 295 | adoptNode(node: Node): Node; 296 | /** 297 | * Creates the specified HTML element or an HTMLUnknownElement if the given element name isn't a known one. 298 | * @param tagName A string that specifies the type of element to be created. 299 | * @return The created element. 300 | */ 301 | // createElement(tagName: T): HTMLElementTagNameMap; 302 | createElement(tagName: string): HTMLElement; 303 | /** 304 | * Creates the specified HTML attribute 305 | * @param name A string that specifies the name of attribute to be created. 306 | * @return The created attribute. 307 | */ 308 | createAttribute(name: string): Attr; 309 | /** 310 | * Creates a new Text node. 311 | * @param text A string to populate the new Text node. 312 | * @return A Text node. 313 | */ 314 | createTextNode(text: string): Text; 315 | /** 316 | * Creates a new Comment node. 317 | * @param text A string to populate the new Comment node. 318 | * @return A Comment node. 319 | */ 320 | createComment(text: string): Comment; 321 | /** 322 | * Creates a new DocumentFragment. 323 | * @return A DocumentFragment. 324 | */ 325 | createDocumentFragment(): DocumentFragment; 326 | /** 327 | * Creates a new HTMLTemplateElement. 328 | * @return An HTMLTemplateElement. 329 | */ 330 | createTemplateElement(): HTMLTemplateElement; 331 | /** 332 | * Creates a new MutationObserver. 333 | * @param callback A callback that will recieve the change records with the mutations. 334 | * @return A MutationObservere. 335 | */ 336 | createMutationObserver(callback: Function): MutationObserver; 337 | /** 338 | * Creates a new CustomEvent. 339 | * @param eventType A string representing the event type. 340 | * @param options An options object specifying bubbles:boolean, cancelable:boolean and/or detail:Object information. 341 | * @return A CustomEvent. 342 | */ 343 | createCustomEvent(eventType: string, options?: CustomEventInit): CustomEvent; 344 | /** 345 | * Dispatches an event on the document. 346 | * @param evt The event to dispatch. 347 | */ 348 | dispatchEvent(evt: Event): void; 349 | /** 350 | * Gives the values of all the CSS properties of an element after applying the active stylesheets and resolving any basic computation those values may contain. 351 | * @param element The Element for which to get the computed style. 352 | * @return The computed styles. 353 | */ 354 | getComputedStyle(element: Element): CSSStyleDeclaration; 355 | /** 356 | * Locates an element in the document according to its id. 357 | * @param id The id to search the document for. 358 | * @return The found element. 359 | */ 360 | getElementById(id: string): Element; 361 | /** 362 | * Performs a query selector on the document and returns first matched element, depth first. 363 | * @param query The query to use in searching the document. 364 | * @return A list of all matched elements in the document. 365 | */ 366 | // enable the following two lines if we switch to TypeScript 367 | // querySelector(selectors: K): HTMLElementTagNameMap[K] | null; 368 | // querySelector(selectors: K): SVGElementTagNameMap[K] | null; 369 | querySelector(selectors: string): Element; 370 | /** 371 | * Performs a query selector on the document and returns all located matches. 372 | * @param query The query to use in searching the document. 373 | * @return A list of all matched elements in the document. 374 | */ 375 | // enable the following two lines if we switch to TypeScript 376 | // querySelectorAll(selectors: K): NodeListOf; 377 | // querySelectorAll(selectors: K): NodeListOf; 378 | querySelectorAll(selectors: string): NodeList; 379 | /** 380 | * Gets the element that is the next sibling of the provided element. 381 | * @param element The element whose next sibling is being located. 382 | * @return The next sibling Element of the provided Element. 383 | */ 384 | nextElementSibling(element: Node): Element; 385 | /** 386 | * Creates an HTMLTemplateElement using the markup provided. 387 | * @param markup A string containing the markup to turn into a template. Note: This string must contain the template element as well. 388 | * @return The instance of HTMLTemplateElement that was created from the provided markup. 389 | */ 390 | createTemplateFromMarkup(markup: string): HTMLTemplateElement; 391 | /** 392 | * Appends a node to the parent, if provided, or the document.body otherwise. 393 | * @param newNode The node to append. 394 | * @param parentNode The node to append to, otherwise the document.body. 395 | */ 396 | appendNode(newNode: Node, parentNode?: Node): void; 397 | /** 398 | * Replaces a node in the parent with a new node. 399 | * @param newNode The node to replace the old node with. 400 | * @param node The node that is being replaced. 401 | * @param parentNode The node that the current node is parented to. 402 | */ 403 | replaceNode(newNode: Node, node: Node, parentNode?: Node): void; 404 | /** 405 | * Removes the specified node from the parent node. 406 | * @param node The node to remove. 407 | * @param parentNode The parent node from which the node will be removed. 408 | */ 409 | removeNode(node: Node, parentNode?: Node): void; 410 | /** 411 | * Injects styles into the destination element, or the document.head if no destination is provided. 412 | * @param styles The css text to injext. 413 | * @param destination The destination element to inject the css text into. If not specified it will default to the document.head. 414 | * @param prepend Indicates whether or not the styles should be prepended to the destination. By default they are appended. 415 | * @param id The existing style element's id to replace the contents for 416 | * @return The Style node that was created. 417 | */ 418 | injectStyles(styles: string, destination?: Element, prepend?: boolean, id?: string): Node; 419 | } 420 | 421 | /** 422 | * The singleton instance of the Dom API. 423 | */ 424 | export const DOM: Dom = {}; 425 | export let isInitialized = false; 426 | /** 427 | * Enables initializing a specific implementation of the Platform Abstraction Layer (PAL). 428 | * @param callback Allows providing a callback which configures the three PAL singletons with their platform-specific implementations. 429 | */ 430 | export function initializePAL(callback: (platform: Platform, feature: Feature, dom: Dom) => void): void { 431 | if (isInitialized) { 432 | return; 433 | } 434 | isInitialized = true; 435 | if (typeof Object.getPropertyDescriptor !== 'function') { 436 | Object.getPropertyDescriptor = function(subject, name) { 437 | let pd = Object.getOwnPropertyDescriptor(subject, name); 438 | let proto = Object.getPrototypeOf(subject); 439 | while (typeof pd === 'undefined' && proto !== null) { 440 | pd = Object.getOwnPropertyDescriptor(proto, name); 441 | proto = Object.getPrototypeOf(proto); 442 | } 443 | return pd; 444 | }; 445 | } 446 | 447 | callback(PLATFORM, FEATURE, DOM); 448 | } 449 | export function reset() { 450 | isInitialized = false; 451 | } 452 | -------------------------------------------------------------------------------- /test/dom.spec.js: -------------------------------------------------------------------------------- 1 | describe('pal', () => { 2 | it('should exist', () => { 3 | expect(true).toBe(true); 4 | }); 5 | }); 6 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es2015", 4 | "module": "es2015", 5 | "experimentalDecorators": true, 6 | "emitDecoratorMetadata": false, 7 | "moduleResolution": "node", 8 | "stripInternal": true, 9 | "preserveConstEnums": true, 10 | "listFiles": true, 11 | "declaration": true, 12 | "removeComments": true, 13 | "lib": ["es2015", "dom"] 14 | }, 15 | "exclude": [ 16 | "node_modules", 17 | "dist", 18 | "build", 19 | "doc", 20 | "test", 21 | "config.js", 22 | "gulpfile.js", 23 | "karma.conf.js" 24 | ] 25 | } 26 | -------------------------------------------------------------------------------- /typings.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "aurelia-pal", 3 | "main": "dist/aurelia-pal.d.ts" 4 | } 5 | --------------------------------------------------------------------------------