diff --git a/docs/.gitignore b/docs/.gitignore new file mode 100755 index 0000000..0c3e5ab --- /dev/null +++ b/docs/.gitignore @@ -0,0 +1,2 @@ +_site/ +.sass-cache/ diff --git a/docs/Gemfile b/docs/Gemfile new file mode 100755 index 0000000..724febd --- /dev/null +++ b/docs/Gemfile @@ -0,0 +1,8 @@ +source 'https://rubygems.org' + +gem 'jekyll', '3.7.2' + +group :jekyll_plugins do + gem 'jekyll-seo-tag', '2.4.0' + gem 'jekyll-sitemap', '1.2.0' +end diff --git a/docs/Gemfile.lock b/docs/Gemfile.lock new file mode 100755 index 0000000..0498c70 --- /dev/null +++ b/docs/Gemfile.lock @@ -0,0 +1,69 @@ +GEM + remote: https://rubygems.org/ + specs: + addressable (2.5.2) + public_suffix (>= 2.0.2, < 4.0) + colorator (1.1.0) + concurrent-ruby (1.0.5) + em-websocket (0.5.1) + eventmachine (>= 0.12.9) + http_parser.rb (~> 0.6.0) + eventmachine (1.2.5) + ffi (1.9.18) + forwardable-extended (2.6.0) + http_parser.rb (0.6.0) + i18n (0.9.3) + concurrent-ruby (~> 1.0) + jekyll (3.7.2) + addressable (~> 2.4) + colorator (~> 1.0) + em-websocket (~> 0.5) + i18n (~> 0.7) + jekyll-sass-converter (~> 1.0) + jekyll-watch (~> 2.0) + kramdown (~> 1.14) + liquid (~> 4.0) + mercenary (~> 0.3.3) + pathutil (~> 0.9) + rouge (>= 1.7, < 4) + safe_yaml (~> 1.0) + jekyll-sass-converter (1.5.2) + sass (~> 3.4) + jekyll-seo-tag (2.4.0) + jekyll (~> 3.3) + jekyll-sitemap (1.2.0) + jekyll (~> 3.3) + jekyll-watch (2.0.0) + listen (~> 3.0) + kramdown (1.16.2) + liquid (4.0.0) + listen (3.1.5) + rb-fsevent (~> 0.9, >= 0.9.4) + rb-inotify (~> 0.9, >= 0.9.7) + ruby_dep (~> 1.2) + mercenary (0.3.6) + pathutil (0.16.1) + forwardable-extended (~> 2.6) + public_suffix (3.0.1) + rb-fsevent (0.10.2) + rb-inotify (0.9.10) + ffi (>= 0.5.0, < 2) + rouge (3.1.1) + ruby_dep (1.5.0) + safe_yaml (1.0.4) + sass (3.5.5) + sass-listen (~> 4.0.0) + sass-listen (4.0.0) + rb-fsevent (~> 0.9, >= 0.9.4) + rb-inotify (~> 0.9, >= 0.9.7) + +PLATFORMS + ruby + +DEPENDENCIES + jekyll (= 3.7.2) + jekyll-seo-tag (= 2.4.0) + jekyll-sitemap (= 1.2.0) + +BUNDLED WITH + 1.16.0 diff --git a/docs/LICENSE b/docs/LICENSE new file mode 100755 index 0000000..fd1a855 --- /dev/null +++ b/docs/LICENSE @@ -0,0 +1,22 @@ +The MIT License (MIT) + +Copyright (c) 2014 James Newell - xhr-mock library +Copyright (c) 2016 CloudCannon - Aviator Jekyll Theme + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/docs/README.md b/docs/README.md new file mode 100755 index 0000000..8b13789 --- /dev/null +++ b/docs/README.md @@ -0,0 +1 @@ + diff --git a/docs/_api/MockXMLHttpRequest.md b/docs/_api/MockXMLHttpRequest.md new file mode 100755 index 0000000..9cb26e3 --- /dev/null +++ b/docs/_api/MockXMLHttpRequest.md @@ -0,0 +1,137 @@ +--- +title: MockXMLHttpRequest +position: 1.2 +type: +description: +parameters: + - name: + content: +content_markdown: |- + MockXMLHttpRequest replaces XMLHttpRequest object. + + For `xhr-mock.setup()` and `xhr-mock.teardown()` refer to XHRMock. + + #### MockRequest + + ##### .method() : *requestMethod* + * __description:__ + * Gets the request method. + * __return:__ + * method: returns method as a string in one of the following: `DELETE`, `GET`, `HEAD`, `OPTIONS`, `POST`, or `PUT`. + + + ##### .url() : *MockURL* + + * __description:__ + * Gets the request MockURL object. + * __return:__ + * MockURL object. + + ##### .header( *name* , *value* ) + * __description:__ + * Sets the request header's name and value. + * __parameters:__ + * name : string + * value: string + + + ##### .header( *name* ) : *value* + * __description:__ + * Gets a request header and returns the value as a string, or `null` if no header has been set. + * __parameters:__ + * name: string + * __return:__ + * value: string or `null` + + ##### .headers() : *requestHeaders* + * __description:__ + * Gets the request headers and returns the value as an object. + * __return:__ + * headers: object + + ##### .headers( *requestHeaders* ) + * __description:__ + * Sets the request headers. + * __parameters:__ + * headers: object + + + ##### .body() : *requestBody* + * __description:__ + * Gets the request body. + * __return:__ + * body: string + + ##### .body( *requestBody* ) + * __description:__ + * Sets the request body. + * __parameters:__ + * body: string + + #### MockResponse + + ##### .status() : *value* + * __description:__ + * Gets the response status. + * __return:__ + * value: number + + ##### .status( *code* ) + * __description:__ + * Sets the response status. + * __parameters:__ + * code: number + + ##### .reason() : *responseReason* + * __description:__ + * Gets the response reason. + * __return:__ + * reason: string + + ##### .reason( *phrase* ) + * __description:__ + * Set the response reason. + * __parameters:__ + * phrase: string + + ##### .header( *name* , *value* ) + * __description:__ + * Sets a response header. + * __parameters:__ + * name: string + * value: string + + ##### .header( *name* ) : *value* + * __description:__ + * Gets a response header and returns the value as a string or `null` + * __parameters:__ + * name: string + * __return:__ + * value: string or `null` + + ##### .headers() : *responseHeaders* + * __description:__ + * Get the response headers. + * __return:__ + * headers: object + + ##### .headers( *responseHeaders* ) + * __description:__ + * Set the response headers. + * __parameters:__ + * headers: object + + ##### .body() : *responseBody* + * __description:__ + * Get the response body. + * __return:__ + * body: string + + ##### .body( *ResponseBody* ) + * __description:__ + * Set the response body. + * __parameters:__ + * body: string + + +--- diff --git a/docs/_api/Mock_Function.md b/docs/_api/Mock_Function.md new file mode 100644 index 0000000..3243ba0 --- /dev/null +++ b/docs/_api/Mock_Function.md @@ -0,0 +1,17 @@ +--- +title: MockFunction +position: 1.3 +parameters: + - name: + content: +content_markdown: |- + #### MockFunction + * __description:__ + * function object used by XHRMock object for processing requests. + * __parameters__: + * req: MockRequest object. + * res: MockResponse object. + * __return:__ + * MockResponse object or `undefined`. + +--- diff --git a/docs/_api/Mock_URL.md b/docs/_api/Mock_URL.md new file mode 100644 index 0000000..cfade80 --- /dev/null +++ b/docs/_api/Mock_URL.md @@ -0,0 +1,37 @@ +--- +title: MockURL +position: 1.4 +parameters: + - name: + content: +content_markdown: |- + #### MockUrl + + ##### .protocol + * property .protocol is a **string** and not required. + + ##### .username + * property .username is a **string** and not required. + + ##### .password + * property .password is a **string** and not required. + + ##### .host + * property .host is a **string** and not required. + + ##### .path + * property .path is a **string** and not required. + + ##### .port + * property .port is a **number** and is not required. + + ##### .query + * {[name: string]: string}; + + ##### .hash + * property .hash is a **string** and is not required. + + ##### .toString() + * method .toString formats and returns the url as a string + +--- diff --git a/docs/_api/_defaults.md b/docs/_api/_defaults.md new file mode 100755 index 0000000..6a3419b --- /dev/null +++ b/docs/_api/_defaults.md @@ -0,0 +1,12 @@ +--- +title: +position: +parameters: + - name: + content: +content_markdown: +left_code_blocks: + - code_block: + title: + language: +--- diff --git a/docs/_api/xhr_mock.md b/docs/_api/xhr_mock.md new file mode 100755 index 0000000..714eb20 --- /dev/null +++ b/docs/_api/xhr_mock.md @@ -0,0 +1,80 @@ +--- +title: XHRMock +position: 1.1 +type: +description: +parameters: + - name: + content: + - name: + content: +content_markdown: |- + + Methods used to mock the `XMLHttpRequest` object: + + ##### .setup() + * __description:__ + * Replaces the global XMLHttpRequest object with the MockXMLHttpRequest. + + ##### .teardown() + * __description:__ + * Restores the global `XMLHttpRequest` object to its original state. + + ##### .reset() + * __description:__ + * Forgets all the request handlers. + + ##### .get( *url* \| *regex* , *mock* ) + * __description:__ + * Registers mock as a factory function by passing it as a parameter + to the .get function. When XHRMock receives GET request, it then uses the registered mock function to process the request. If the request is as expected, the mock returns a response. For greater detail, look at the source code. + * __parameters__: + * the url is passed into the function as either a string or a `RegExp` object. + * mock is a factory function, `MockFunction`, passed into the .get function as a parameter. + + ##### .post( *url* \| *regex* , *mock* ) + * __description:__ + * Registers mock as a factory function by passing it as a parameter + to the .post function. When XHRMock receives POST request, it then uses the registered mock function to process the request. If the request is as expected, the mock returns a response. For greater detail, look at the source code. + * __parameters__: + * the url is passed into the function as either a string or a `RegExp` object. + * mock is a factory function, `MockFunction`, passed into the .post function as a parameter. + + ##### .patch( *url* \| *regex* , *mock* ) + * __description:__ + * Registers mock as a factory function by passing it as a parameter + to the .patch function. When XHRMock receives PATCH request, it then uses the registered mock function to process the request. If the request is as expected, the mock returns a response. For greater detail, look at the source code. + * __parameters__: + * the url is passed into the function as either a string or a `RegExp` object. + * mock is a factory function, `MockFunction`, passed into the .patch function as a parameter. + + ##### .delete( *url* \| *regex* , *mock* ) + * __description:__ + * Registers mock as a factory function by passing it as a parameter + to the .delete function. When XHRMock receives DELETE request, it then uses the registered mock function to process the request. If the request is as expected, the mock returns a response. For greater detail, look at the source code. + * __parameters__: + * the url is passed into the function as either a string or a `RegExp` object. + * mock is a factory function, `MockFunction`, passed into the .delete function as a parameter. + + ##### .use( *method* , *url* \| *regex* , *mock* ) + * __description:__ + * The .use function includes a method. .use registers mock as a factory function by passing it as a parameter + to the .use function. When XHRMock receives USE request, it then uses the registered mock function to process the request. If the request is as expected, the mock returns a response. For greater detail, look at the source code. + * __parameters__: + * the method is passed as a string. + * the url is passed into the function as either a string or a `RegExp` object. + * mock is a factory function, `MockFunction`, passed into the .use function as a parameter. + + ##### .use( *mock* ) + * __description:__ + * Registers mock as a factory function to create mock responses for every request that passes through it. Url or method is not distinguished. + * __parameters__: + * mock is a factory function, `MockFunction`, passed into the .use function as a parameter. + + ##### .error( *fn* ) + * __description:__ + * Logs errors thrown by handlers. + * __parameters__: + * function + +--- diff --git a/docs/_config.yml b/docs/_config.yml new file mode 100755 index 0000000..bc01e12 --- /dev/null +++ b/docs/_config.yml @@ -0,0 +1,86 @@ +# ---- +# Site + +title: XHR-Mock +description: XHR-Mock API documentation. +url: +google_analytics_key: +permalink: pretty + +# ----- +# Build + +timezone: Etc/UTC + +collections: + documentation: + title: Documentation + position: 1 + api: + title: APIs + position: 2 + howto: + title: HowTo + position: 3 +plugins: + - jekyll-sitemap + - jekyll-seo-tag + +exclude: + - readme.md + - LICENSE + +defaults: + - + scope: + path: "" + values: + layout: default + - + scope: + type: "documentation" + values: + _hide_content: true + - + scope: + type: "api" + values: + _hide_content: true + - + scope: + type: "howto" + values: + _hide_content: true + +# ----------- +# CloudCannon + +types: + - get + - put + - delete + - post + +languages: + bash: Bash + c: C + css: CSS + html: HTML + java: Java + javascript: JavaScript + json: JSON + php: PHP + python: Python + ruby: Ruby + +_options: + content_markdown: + format: p h4 h5 h6 + bold: true + italic: true + link: true + bulletedlist: true + numberedlist: true + image: true + table: true + styles: /css/editor.css diff --git a/docs/_documentation/_defaults.md b/docs/_documentation/_defaults.md new file mode 100755 index 0000000..6a3419b --- /dev/null +++ b/docs/_documentation/_defaults.md @@ -0,0 +1,12 @@ +--- +title: +position: +parameters: + - name: + content: +content_markdown: +left_code_blocks: + - code_block: + title: + language: +--- diff --git a/docs/_documentation/example.md b/docs/_documentation/example.md new file mode 100755 index 0000000..1d3e21c --- /dev/null +++ b/docs/_documentation/example.md @@ -0,0 +1,124 @@ +--- +title: Example +position: 3 +parameters: + - name: + content: +content_markdown: |- + + `./createUser.js` demonstrates a use case of [XMLHttpRequest](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest). + + Axios, jQuery, Superagent or another package can also be used instead of the native XMLHttpRequest object. + {: .info } + + + + 2. A new XMLHttpRequest is created called `xhr`. + 3. the `.onreadystatechange` function is created for when the client receives the response from the server + 4. `xhr.open` initializes the request to the url. + 5. `xhr.setRequestHeader` sets the value of of the header, 'Content-Type' to JSON. + 6. `xhr.send` sends the request body to the server. + + + `./createUser.test.js`, shows unit tests using `xhr-mock` which replaces `XMLHttpRequest` with `MockXMLHttpRequest`. + + 1. `mock.post` registers the url and `POST` method to the request handler. + 2. `createUser` method is called passing the parameter "John". + 3. `XHRMock` processes the request to the url, and: + * If the value of the request header is in JSON, + * If the request data is equal to "John", + 4. The response `"id": "abc-123"` is returned. + + +left_code_blocks: + - code_block: |- + // createUser serves as the client. + export default function createUser(reqdata) { + return new Promise((resolve, reject) => { + // we create a new XMLHttpRequest object. + const xhr = new XMLHttpRequest(); + // the onreadystatechange function is for receiving the response and checking the status. + xhr.onreadystatechange = () => { + if (xhr.readyState == XMLHttpRequest.DONE) { + if (xhr.status === 201) { + try { + resolve(JSON.parse(xhr.responseText).data); + } catch (error) { + reject(error); + } + } else if (xhr.status) { + try { + reject(JSON.parse(xhr.responseText).error); + } catch (error) { + reject(error); + } + } else { + eject(new Error('An error ocurred whilst sending the request.')); + } + } + }; + // initializes the request to the url using the POST method, sets the request header value in JSON, and sends the request. + xhr.open('post', '/api/user'); + xhr.setRequestHeader('Content-Type', 'application/json'); + xhr.send(JSON.stringify({data: reqdata})); + }); + } + title: ./createUser.js + language: javascript + - code_block: |- + // Tests the code with the mock request and response. + import mock from 'xhr-mock'; + import createUser from './createUser'; + + describe('createUser()', () => { + // replaces the real XHR object with the mock XHR object before each test. + beforeEach(() => mock.setup()); + + // puts the real XHR object back and clears the mock after each test. + afterEach(() => mock.teardown()); + + it('should send the data as JSON', async () => { + expect.assertions(2); + // mock sets up the request function and registers the request from the client (createUser) to the request handler. If the request header is in JSON, and the request body is equal to "John," the response is returned: "id":"abc-123". + mock.post('/api/user', (req, res) => { + expect(req.header('Content-Type')).toEqual('application/json'); + expect(req.body()).toEqual('{"data":{"name":"John"}}'); + return res.status(201).body('{"data":{"id":"abc-123"}}'); + }); + // makes the requests as the client. + await createUser({name: 'John'}); + }); + + it('should resolve with some data when status=201', async () => { + expect.assertions(1); + + mock.post('/api/user', { + status: 201, + reason: 'Created', + body: '{"data":{"id":"abc-123"}}' + }); + + const user = await createUser({name: 'John'}); + + expect(user).toEqual({id: 'abc-123'}); + }); + + it('should reject with an error when status=400', async () => { + expect.assertions(1); + + mock.post('/api/user', { + status: 400, + reason: 'Bad request', + body: '{"error":"A user named \\"John\\" already exists."}' + }); + + try { + const user = await createUser({name: 'John'}); + } catch (error) { + expect(error).toMatch('A user named "John" already exists.'); + } + }); + }); + title: ./createUser.test.js + language: javascript +--- diff --git a/docs/_documentation/getting_started.md b/docs/_documentation/getting_started.md new file mode 100755 index 0000000..93bf2af --- /dev/null +++ b/docs/_documentation/getting_started.md @@ -0,0 +1,27 @@ +--- +title: XHR-Mock +position: 1 +parameters: + - name: + content: +content_markdown: |- + This is a utility for mocking XMLHttpRequest. + It's useful for testing, or prototyping while your backend is still being built. + + It works in NodeJS and in the browser, and is compatible with: + + * [Axios](https://www.npmjs.com/package/axios) + * [jQuery](https://www.npmjs.com/package/jquery) + * [Superagent](https://www.npmjs.com/package/superagent) + + It may also work with other libraries built on XMLHttpRequest. + + Standard compliant ([http://xhr.spec.whatwg.org/](http://xhr.spec.whatwg.org/)). + + For more information, go to the [XHR-Mock GitHub Page](https://github.com/jameslnewell/xhr-mock/tree/master/packages/xhr-mock). + +left_code_blocks: + - code_block: + title: + language: +--- diff --git a/docs/_documentation/installation.md b/docs/_documentation/installation.md new file mode 100755 index 0000000..fc9f626 --- /dev/null +++ b/docs/_documentation/installation.md @@ -0,0 +1,38 @@ +--- +title: Installation +position: 2 +parameters: + - name: + content: +content_markdown: |- + ##### With a Bundler + + If you are using a bundler like [Webpack](https://www.npmjs.com/package/webpack) or [Browserify](https://www.npmjs.com/package/browserify) install `xhr-mock` using `yarn` or `npm`: + + ```bash + yarn add --dev xhr-mock + ``` + + Now import `xhr-mock` and start using it in your scripts: + + ```js + import mock from 'xhr-mock'; + ``` + ##### Without a Bundler + + If you aren't using a bundler like [Webpack](https://www.npmjs.com/package/webpack) or [Browserify](https://www.npmjs.com/package/browserify) then add this script to your HTML: + + + ```html + + ``` + + + You can now start using the global, `XHRMock`, in your scripts! + +left_code_blocks: + - code_block: + title: + language: + +--- diff --git a/docs/_howto/delay_requests.md b/docs/_howto/delay_requests.md new file mode 100644 index 0000000..02bb035 --- /dev/null +++ b/docs/_howto/delay_requests.md @@ -0,0 +1,20 @@ +--- +title: Delay requests +position: 5.0 +parameters: + - name: + content: +content_markdown: |- + Requests can be delayed using our handy `delay` utility. +left_code_blocks: + - code_block: |- + import mock, {delay} from 'xhr-mock'; + + mock.setup(); + + // delays the request for three seconds. + mock.post('/', delay({status: 201}, 3000)); + title: Delay Request + language: javascript + +--- diff --git a/docs/_howto/oneoff_requests.md b/docs/_howto/oneoff_requests.md new file mode 100644 index 0000000..071ca46 --- /dev/null +++ b/docs/_howto/oneoff_requests.md @@ -0,0 +1,20 @@ +--- +title: One-off requests +position: 6.0 +parameters: + - name: + content: +content_markdown: |- + Requests can be made on one off occasions using our handy `once` utility. + +left_code_blocks: + - code_block: |- + import mock, {once} from 'xhr-mock'; + + mock.setup(); + + // the response will only be returned the first time a request is made. + mock.post('/', once({status: 201})); + title: One-off Request + language: javascript +--- diff --git a/docs/_howto/proxy_requests.md b/docs/_howto/proxy_requests.md new file mode 100644 index 0000000..8b90116 --- /dev/null +++ b/docs/_howto/proxy_requests.md @@ -0,0 +1,33 @@ +--- +title: Proxy requests +position: 4.0 +parameters: + - name: + content: +content_markdown: |- + If you want to mock some requests, but not all of them, you can proxy unhandled requests to a real server. +left_code_blocks: + - code_block: |- + import mock, {proxy} from 'xhr-mock'; + + mock.setup(); + + // mock specific requests. + mock.post('/', {status: 204}); + + // proxy unhandled requests to the real servers. + mock.use(proxy); + + // this request will receive a mocked response. + const xhr1 = new XMLHttpRequest(); + xhr1.open('POST', '/'); + xhr1.send(); + + // this request will receive the real response. + const xhr2 = new XMLHttpRequest(); + xhr2.open('GET', 'https://jsonplaceholder.typicode.com/users/1'); + xhr2.send(); + title: Proxy Request + language: javascript + +--- diff --git a/docs/_howto/simulate_error.md b/docs/_howto/simulate_error.md new file mode 100644 index 0000000..3d61ce9 --- /dev/null +++ b/docs/_howto/simulate_error.md @@ -0,0 +1,28 @@ +--- +title: Simulate error +position: 3.0 +description: +parameters: + - name: + content: + - name: + content: +content_markdown: |- + Returns a `Promise` that rejects. If you want to test a particular error you use one of the pre-defined error classes. + +left_code_blocks: + - code_block: |- + import mock from 'xhr-mock'; + + mock.setup(); + + mock.get('/', () => Promise.reject(new Error())); + + const xhr = new XMLHttpRequest(); + xhr.onerror = event => console.log('error'); + xhr.open('GET', '/'); + xhr.send(); + title: Simulate Error + language: javascript + +--- diff --git a/docs/_howto/simulate_progress.md b/docs/_howto/simulate_progress.md new file mode 100644 index 0000000..d063c46 --- /dev/null +++ b/docs/_howto/simulate_progress.md @@ -0,0 +1,45 @@ +--- +title: Simulate progress +position: 1.0 +#type: get +description: +parameters: + - name: + content: + - name: + content: +content_markdown: |- + Sets the `Content-Length` header and sends a body. `xhr-mock` will emit `ProgressEvent`s. + +left_code_blocks: + - code_block: |- + import mock from 'xhr-mock'; + + mock.setup(); + + mock.post('/', {}); + + const xhr = new XMLHttpRequest(); + xhr.upload.onprogress = event => console.log(event.loaded, event.total); + xhr.open('POST', '/'); + xhr.setRequestHeader('Content-Length', '12'); + xhr.send('Hello World!'); + title: Upload progress + language: javascript + - code_block: |- + import mock from 'xhr-mock'; + + mock.setup(); + + mock.get('/', { + headers: {'Content-Length': '12'}, + body: 'Hello World!' + }); + + const xhr = new XMLHttpRequest(); + xhr.onprogress = event => console.log(event.loaded, event.total); + xhr.open('GET', '/'); + xhr.send(); + title: Download progress + language: javascript +--- diff --git a/docs/_howto/simulate_timeout.md b/docs/_howto/simulate_timeout.md new file mode 100644 index 0000000..429ce9b --- /dev/null +++ b/docs/_howto/simulate_timeout.md @@ -0,0 +1,32 @@ +--- +title: Simulate timeout +position: 2.0 +description: +parameters: + - name: + content: + - name: + content: +content_markdown: |- + Returns a `Promise` that never resolves or rejects. + + A number of major libraries don't use the `timeout` event and use `setTimeout()` instead. Therefore, in order to mock timeouts in major libraries, we have to wait for the specified amount of time. + {: .info } + +left_code_blocks: + - code_block: |- + import mock from 'xhr-mock'; + + mock.setup(); + + mock.get('/', () => new Promise(() => {})); + + const xhr = new XMLHttpRequest(); + xhr.timeout = 100; + xhr.ontimeout = event => console.log('timeout'); + xhr.open('GET', '/'); + xhr.send(); + title: Simulate Timeout + language: javascript + +--- diff --git a/docs/_includes/relative-src.html b/docs/_includes/relative-src.html new file mode 100755 index 0000000..4535448 --- /dev/null +++ b/docs/_includes/relative-src.html @@ -0,0 +1 @@ +{% assign prefix = include.src | slice: 0, 2 %}{% assign protocol = include.src | slice: 0, 4 %}{% unless protocol == 'http' or prefix == "//" %}{{ site.baseurl }}{% endunless %}{{ include.src }} \ No newline at end of file diff --git a/docs/_includes/sidebar.html b/docs/_includes/sidebar.html new file mode 100755 index 0000000..0d8ecfb --- /dev/null +++ b/docs/_includes/sidebar.html @@ -0,0 +1,21 @@ + diff --git a/docs/_includes/syntax-highlight.html b/docs/_includes/syntax-highlight.html new file mode 100755 index 0000000..cfdf54e --- /dev/null +++ b/docs/_includes/syntax-highlight.html @@ -0,0 +1,8 @@ +{% capture highlight %} +``` {{ include.block.language }} +{{ include.block.code_block }} +``` +{: title="{{ include.block.title }}" } +{% endcapture %} + +{{ highlight | markdownify }} \ No newline at end of file diff --git a/docs/_layouts/default.html b/docs/_layouts/default.html new file mode 100755 index 0000000..b63936b --- /dev/null +++ b/docs/_layouts/default.html @@ -0,0 +1,53 @@ + + + + + + + {% seo %} + + + + + {% if jekyll.environment == 'production' and site.google_analytics_key != '' %} + + + {% endif %} + + + + + +
+

+ + {{ site.title }} logo +

+ +
+ + +
+ + {% include sidebar.html %} + + +
+
+ {{ content }} +
+ + + diff --git a/docs/_licenses/license.md b/docs/_licenses/license.md new file mode 100644 index 0000000..e507de2 --- /dev/null +++ b/docs/_licenses/license.md @@ -0,0 +1,17 @@ +--- +title: License +position: 1.0 +parameters: + - name: + content: +content_markdown: |- + + Copyright (c) 2014 James Newell + + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +--- diff --git a/docs/_sass/_borland.scss b/docs/_sass/_borland.scss new file mode 100755 index 0000000..a4bc70c --- /dev/null +++ b/docs/_sass/_borland.scss @@ -0,0 +1,59 @@ +code { font-size: 1.1em;} +code .hll { background-color: #ffffcc } +code .c { color: #aaaaaa; font-style: italic } /* Comment */ +code .err { color: #aa5500; } //background-color: #F0A0A0 } /* Error */ +code .k { color: #0000aa } /* Keyword */ +code .cm { color: #aaaaaa; font-style: italic } /* Comment.Multiline */ +code .cp { color: #4c8317 } /* Comment.Preproc */ +code .c1 { color: #aaaaaa; font-style: italic } /* Comment.Single */ +code .cs { color: #0000aa; font-style: italic } /* Comment.Special */ +code .gd { color: #aa0000 } /* Generic.Deleted */ +code .ge { font-style: italic } /* Generic.Emph */ +code .gr { color: #aa0000 } /* Generic.Error */ +code .gh { color: #000080; font-weight: bold } /* Generic.Heading */ +code .gi { color: #00aa00 } /* Generic.Inserted */ +code .go { color: #888888 } /* Generic.Output */ +code .gp { color: #555555 } /* Generic.Prompt */ +code .gs { font-weight: bold } /* Generic.Strong */ +code .gu { color: #800080; font-weight: bold } /* Generic.Subheading */ +code .gt { color: #aa0000 } /* Generic.Traceback */ +code .kc { color: #0000aa } /* Keyword.Constant */ +code .kd { color: #0000aa } /* Keyword.Declaration */ +code .kn { color: #0000aa } /* Keyword.Namespace */ +code .kp { color: #0000aa } /* Keyword.Pseudo */ +code .kr { color: #0000aa } /* Keyword.Reserved */ +code .kt { color: #00aaaa } /* Keyword.Type */ +code .m { color: #009999 } /* Literal.Number */ +code .s { color: #aa5500 } /* Literal.String */ +code .na { color: #1e90ff } /* Name.Attribute */ +code .nb { color: #00aaaa } /* Name.Builtin */ +code .nc { color: #00aa00; text-decoration: underline } /* Name.Class */ +code .no { color: #aa0000 } /* Name.Constant */ +code .nd { color: #888888 } /* Name.Decorator */ +code .ni { color: #800000; font-weight: bold } /* Name.Entity */ +code .nf { color: #00aa00 } /* Name.Function */ +code .nn { color: #00aaaa; text-decoration: underline } /* Name.Namespace */ +code .nt { color: #1e90ff; font-weight: bold } /* Name.Tag */ +code .nv { color: #aa0000 } /* Name.Variable */ +code .ow { color: #0000aa } /* Operator.Word */ +code .w { color: #bbbbbb } /* Text.Whitespace */ +code .mf { color: #009999 } /* Literal.Number.Float */ +code .mh { color: #009999 } /* Literal.Number.Hex */ +code .mi { color: #009999 } /* Literal.Number.Integer */ +code .mo { color: #009999 } /* Literal.Number.Oct */ +code .sb { color: #aa5500 } /* Literal.String.Backtick */ +code .sc { color: #aa5500 } /* Literal.String.Char */ +code .sd { color: #aa5500 } /* Literal.String.Doc */ +code .s2 { color: #aa5500 } /* Literal.String.Double */ +code .se { color: #aa5500 } /* Literal.String.Escape */ +code .sh { color: #aa5500 } /* Literal.String.Heredoc */ +code .si { color: #aa5500 } /* Literal.String.Interpol */ +code .sx { color: #aa5500 } /* Literal.String.Other */ +code .sr { color: #009999 } /* Literal.String.Regex */ +code .s1 { color: #aa5500 } /* Literal.String.Single */ +code .ss { color: #0000aa } /* Literal.String.Symbol */ +code .bp { color: #00aaaa } /* Name.Builtin.Pseudo */ +code .vc { color: #aa0000 } /* Name.Variable.Class */ +code .vg { color: #aa0000 } /* Name.Variable.Global */ +code .vi { color: #aa0000 } /* Name.Variable.Instance */ +code .il { color: #009999 } /* Literal.Number.Integer.Long */ diff --git a/docs/_sass/_main.scss b/docs/_sass/_main.scss new file mode 100755 index 0000000..a76b566 --- /dev/null +++ b/docs/_sass/_main.scss @@ -0,0 +1,578 @@ +html, body { + padding: 0; + margin: 0; +} + +body, .main { + box-sizing: border-box; + min-height: 100vh; +} + +html { + font-size: 62.5%; + color: #664442; + //background: #232323; + height: 100vh; +} + +img { + max-width: 100%; +} + +@media (max-width: $mobile-break) { + .sidebar, header > form { + display: none; + } + + .sidebar h6 { + font-size: 1.4em; + } + + .sidebar a { + padding: 10px 0; + } + + body .main { + margin: 45px 0 0 0; + } +} + +body { + font-size: 1.6em; + line-height: 1.6; + font-weight: 400; + font-family: system, -apple-system, BlinkMacSystemFont, "Helvetica Neue", "Lucida Grande", sans-serif; + + background: #EAFFFF; + + &.nav-open { + overflow: hidden; + + .sidebar, + header > form { + display: block; + } + + header { + bottom: 0; + } + } +} + +table { + border: 1px solid #E1E1E1; + margin: 0 0 20px 0; + border-collapse: collapse; +} + +th, td { + border: 1px solid #ccc; + padding: 10px; + font-size: .9em; + text-align: left; +} + +th { + background: #f7f7f7; +} + +h1, h2, h3, h4, h5, h6 { + margin-top: 0; + font-weight: 300; +} + +h1 { font-size: 4.0rem; line-height: 1.2; letter-spacing: -.1rem; } +h2 { font-size: 3.6rem; line-height: 1.25; letter-spacing: -.1rem; } +h3 { font-size: 3.0rem; line-height: 1.3; letter-spacing: -.1rem; } + +h4 { + font-size: 2.4rem; + line-height: 1.35; + letter-spacing: -.08rem; + margin: 0 0 5px 0; +} + +h5 { + font-size: 1.8rem; + line-height: 1.5; + letter-spacing: -.05rem; + color: #ae0c00; + margin: 0 0 2px 0; +} + +// ul { +// margin: 8px 0 12px 0; +// } + +p { + margin-top: 0; +} + +h3 a { + text-decoration: none; + color: #474a54; +} + +h3 a:hover { + text-decoration: none; + color: #474a54; +} +a { + color: #1EAEDB; text-decoration: none; +} + +a:hover { + color: #0FA0CE; text-decoration: underline; +} + +pre { + white-space: pre-wrap; + font-size: 1em; + margin: 22px 0; + word-wrap: break-word; +} + +dl { + border-top: 1px solid #eee; + border-bottom: 1px solid #eee; + padding: 0 0 20px 0; + margin: 0 0 20px 0; +} + +dl dt { + width: 30%; + float: left; + font-weight: bold; + position: relative; + top: 20px; +} + +dl dd { + margin-left: 30%; + padding-left: 15px; + margin-top: 20px; +} + +dl dd + dd { + margin-top: 0; +} + +dl dd:after { + visibility: hidden; + display: block; + content: ""; + clear: both; + height: 0; +} + +.sidebar h6 { + line-height: 1em; + font-size: 1.5rem; + letter-spacing: 1px; + color: #888; + font-weight: bold; +} + +.sidebar { + padding: 20px 20px 0 20px; + white-space:nowrap; + overflow-y: auto; + + section { + padding: 10px 0; + } + + ul { + padding: 0 0 0 10px; + margin: 0; + list-style: none; + } + + h6 { + padding: 0; + margin: 0 0 5px 0; + } + + a { + color: #777; + text-decoration: none; + font-size: .90em; + display: block; + width: 100%; + text-overflow: ellipsis; + overflow: hidden; + padding: 2px 0; + + &.active { + color: #2196F3; + text-decoration: none; + } + } +} + +.endpoint { + font-size: 10px; + padding: 0 2px; + position: relative; +} + +h3 .endpoint { + padding: 4px 6px; + font-size: 19px; +} + +.endpoint.put { + color: #7E57C2; + &:after { + content: "PUT"; + } +} + +.endpoint.delete { + color: #FF7043; + &:after { + content: "DELETE"; + } +} + +.endpoint.get { + color: #66BB6A; + &:after { + content: "GET"; + } +} + +.endpoint.post { + color: #42A5F5; + &:after { + content: "POST"; + } +} + +.main { + margin: 0 0 0 $nav-width; + border-left: 1px solid #eee; + h6 { + font-size: 1.01em; + padding: 0 0 6px 0; + margin: 0; + } + + .description { + color: #aaa; + margin-top: -11px; + } + + @media (max-width: $mobile-break) { + margin: 0; + } +} + +hr { + border: 0; + border-top: 1px solid #ddd; + margin: 20px 0; +} + +.error, .warning, .info, .success { + border-left: 5px solid #FD0; + padding: 10px 15px; + margin-left: -20px; + margin-right: -15px; + background-color: #FAFAFA; + border-radius: 2px; +} + +.warning { + border-color: #ffc107; +} + +.info { + border-color: #56ADEC; +} + +.error { + border-color: #F20; +} + +.success { + border-color: #6c0; +} + +.doc-content { + border: 0; + border-bottom: 1px solid transparent; + border-image: linear-gradient(to right, #eee 0%,#eee 60%,#eee 60%); + -moz-border-image: -moz-linear-gradient(left, #eee 0%, #eee 60%, #eee 60%); + -webkit-border-image: -webkit-linear-gradient(left, #eee 0%,#eee 60%,#eee 60%); + border-image-slice: 1; + padding: 30px 0; + background: #ffffff; /* Old browsers */ + background: -moz-linear-gradient(left, #ffffff 0%, #ffffff 60%, #ffffff 60%); /* FF3.6+ */ + background: -webkit-gradient(linear, left top, right top, color-stop(0%,#ffffff), color-stop(60%,#ffffff), color-stop(60%,#ffffff)); /* Chrome,Safari4+ */ + background: -webkit-linear-gradient(left, #ffffff 0%,#ffffff 60%,#ffffff 60%); /* Chrome10+,Safari5.1+ */ + background: -o-linear-gradient(left, #ffffff 0%,#ffffff 60%,#ffffff 60%); /* Opera 11.10+ */ + background: -ms-linear-gradient(left, #ffffff 0%,#ffffff 60%,#ffffff 60%); /* IE10+ */ + background: linear-gradient(to right, #ffffff 0%,#ffffff 60%,#ffffff 60%); /* W3C */ + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#ffffff',GradientType=1 ); /* IE6-9 */ +} + +.doc-content:after { + visibility: hidden; + display: block; + content: ""; + clear: both; + height: 0; +} + +.doc-content:last-child { + border: 0; +} + +.left-docs { + width: 70%; + float: left; + padding: 0 50px; + -webkit-box-sizing: border-box; /* Safari/Chrome, other WebKit */ + -moz-box-sizing: border-box; /* Firefox, other Gecko */ + box-sizing: border-box; /* Opera/IE 8+ */ + + pre { + border: 0px; + box-shadow: 0 0 0 1px #eee; + border-radius: 3px; + padding: 10px; + } +} +.left-docs > ul { + margin: 8px 0 14px 0 +} + +.right-code { + width: 10%; + float: left; + padding: 0 50px; + -webkit-box-sizing: border-box; /* Safari/Chrome, other WebKit */ + -moz-box-sizing: border-box; /* Firefox, other Gecko */ + box-sizing: border-box; /* Opera/IE 8+ */ + + code { + color: #fff; + } + + pre { + background: black; + padding: 10px; + border-radius: 5px; + } + + .code-viewer .languages li a:hover { + border-color: #555; + } +} + +.code-viewer { + .languages { + padding: 0; + margin: 0 0 5px 0; + list-style: none; + font-size: .9em; + + li { + display: inline-block; + a { + display: block; + padding: 5px 10px; + z-index: 100; + border: 1px solid transparent; + + &:hover { + border-color: #eee; + border-radius: 5px; + } + + &.active:hover { + border-color: transparent; + } + } + } + } + + a { + text-decoration: none; + color: #aaa; + + &:hover { + color: #222; + } + + + } + + pre { + margin: 0 0 20px 0; + } +} + +.code-viewer a.active, .code-viewer a.active:hover, .right-code .code-viewer a.active:hover { + color: #1EAEDB; +} + + +.right-code .code-viewer a:hover { + color: #fff; +} + +@media (max-width: 1000px) { + .right-code { + float: none; + width:10%; + background: #fff; + padding-top: 20px; + padding-bottom: 20px; + } + + .left-docs { + float: none; + width: 100%; + } + + .doc-content { + background: #fff; + padding-bottom: 0; + border-image: none; + -moz-border-image: none; + -webkit-border-image: none; + border-color: #eee; + } +} + +header { + max-height: 100vh; + position: fixed; + top: 0; + left: 0; + right: 0; + overflow-x: hidden; + z-index: 1; + background-color: $nav-background-color; + + h1 { + height: $nav-header-height; + box-sizing: border-box; + background-color: $brand-colour; + color: #fff; + margin: 0; + font-size: 1.7rem; + line-height: 0.8; + letter-spacing: 0; + font-weight: 600; + text-indent: 0; + @include display-flex(); + @include flex-direction(row); + @include align-items(center); + border-bottom: 1px solid rgba(0, 0, 0, 0.075); + + img { + height: 26px; + margin: 0 18px; + } + } + + .open-nav { + width: 25px; + height: 25px; + margin: 0 0 0 18px; + background-image: url($base-url + '/images/menu.svg'); + background-color: transparent; + background-repeat: no-repeat; + background-size: 100%; + border: 0; + position: relative; + border-radius: 2px; + cursor: pointer; + + &:focus { + outline: none; + background-color: rgba(0, 0, 0, 0.05); + } + + &:hover { + background-color: rgba(0, 0, 0, 0.1); + } + } + + @media (min-width: $mobile-break) { + background-color: transparent; + width: $nav-width; + right: auto; + bottom: auto; + + .copyright { + display: block; + } + + .open-nav { + display: none; + } + + h1 { + box-shadow: inset -10px 0 10px -10px rgba(0, 0, 0, 0.1); + } + } +} + +#search-input { + -webkit-appearance: none; + + display: block; + margin: 0; + padding: 10px 20px; + width: 100%; + box-sizing: border-box; + + border: 0; + border-bottom: 1px solid rgba(0, 0, 0, 0.075); + + font-size: 1.5rem; + font-weight: 600; + line-height: 1.8; + + &:focus { + outline: none; + border-left: 5px solid $brand-colour; + padding-left: 15px; + } +} + +.search-page { + max-width: 800px; + margin: 0 0 0 50px; + padding: 50px 20px 0 20px; +} + +#search-results { + margin: 0; + padding: 0; + + li { + list-style: none; + margin: 0; + padding: 0; + + h4 { + font-size: 2rem; + } + + p { + line-height: 1.5; + } + } +} + +.copyright { + text-align: center; + font-size: .6em; + margin: 30px 0 0 0; + display: none; +} diff --git a/docs/_sass/_mixins.scss b/docs/_sass/_mixins.scss new file mode 100755 index 0000000..e60b236 --- /dev/null +++ b/docs/_sass/_mixins.scss @@ -0,0 +1,34 @@ +@mixin flex-direction($values) { + -webkit-flex-direction: $values; + flex-direction: $values; +} + +@mixin flex-flow($values) { + -webkit-flex-flow: $values; + flex-flow: $values; +} + +@mixin align-items($values) { + -webkit-align-items: $values; + align-items: $values; +} + +@mixin justify-content($values) { + -webkit-justify-content: $values; + justify-content: $values; +} + +@mixin flex($values) { + -webkit-flex: $values; + flex: $values; +} + +@mixin display-flex() { + display: -webkit-flex; + display: flex; +} + +@mixin display-inline-flex() { + display: -webkit-inline-flex; + display: inline-flex; +} diff --git a/docs/_sass/_monaki.scss b/docs/_sass/_monaki.scss new file mode 100755 index 0000000..6cae0d8 --- /dev/null +++ b/docs/_sass/_monaki.scss @@ -0,0 +1,64 @@ +.right-code code .hll { background-color: #49483e } +.right-code code .c { color: #75715e } /* Comment */ +.right-code code .err { color: #960050; background-color: #1e0010 } /* Error */ +.right-code code .k { color: #66d9ef } /* Keyword */ +.right-code code .l { color: #ae81ff } /* Literal */ +.right-code code .n { color: #f8f8f2 } /* Name */ +.right-code code .o { color: #f92672 } /* Operator */ +.right-code code .p { color: #f8f8f2 } /* Punctuation */ +.right-code code .cm { color: #75715e } /* Comment.Multiline */ +.right-code code .cp { color: #75715e } /* Comment.Preproc */ +.right-code code .c1 { color: #75715e } /* Comment.Single */ +.right-code code .cs { color: #75715e } /* Comment.Special */ +.right-code code .ge { font-style: italic } /* Generic.Emph */ +.right-code code .gs { font-weight: bold } /* Generic.Strong */ +.right-code code .kc { color: #66d9ef } /* Keyword.Constant */ +.right-code code .kd { color: #66d9ef } /* Keyword.Declaration */ +.right-code code .kn { color: #f92672 } /* Keyword.Namespace */ +.right-code code .kp { color: #66d9ef } /* Keyword.Pseudo */ +.right-code code .kr { color: #66d9ef } /* Keyword.Reserved */ +.right-code code .kt { color: #66d9ef } /* Keyword.Type */ +.right-code code .ld { color: #e6db74 } /* Literal.Date */ +.right-code code .m { color: #ae81ff } /* Literal.Number */ +.right-code code .s { color: #e6db74 } /* Literal.String */ +.right-code code .na { color: #a6e22e } /* Name.Attribute */ +.right-code code .nb { color: #f8f8f2 } /* Name.Builtin */ +.right-code code .nc { color: #a6e22e } /* Name.Class */ +.right-code code .no { color: #66d9ef } /* Name.Constant */ +.right-code code .nd { color: #a6e22e } /* Name.Decorator */ +.right-code code .ni { color: #f8f8f2 } /* Name.Entity */ +.right-code code .ne { color: #a6e22e } /* Name.Exception */ +.right-code code .nf { color: #a6e22e } /* Name.Function */ +.right-code code .nl { color: #f8f8f2 } /* Name.Label */ +.right-code code .nn { color: #f8f8f2 } /* Name.Namespace */ +.right-code code .nx { color: #a6e22e } /* Name.Other */ +.right-code code .py { color: #f8f8f2 } /* Name.Property */ +.right-code code .nt { color: #f92672 } /* Name.Tag */ +.right-code code .nv { color: #f8f8f2 } /* Name.Variable */ +.right-code code .ow { color: #f92672 } /* Operator.Word */ +.right-code code .w { color: #f8f8f2 } /* Text.Whitespace */ +.right-code code .mf { color: #ae81ff } /* Literal.Number.Float */ +.right-code code .mh { color: #ae81ff } /* Literal.Number.Hex */ +.right-code code .mi { color: #ae81ff } /* Literal.Number.Integer */ +.right-code code .mo { color: #ae81ff } /* Literal.Number.Oct */ +.right-code code .sb { color: #e6db74 } /* Literal.String.Backtick */ +.right-code code .sc { color: #e6db74 } /* Literal.String.Char */ +.right-code code .sd { color: #e6db74 } /* Literal.String.Doc */ +.right-code code .s2 { color: #e6db74 } /* Literal.String.Double */ +.right-code code .se { color: #ae81ff } /* Literal.String.Escape */ +.right-code code .sh { color: #e6db74 } /* Literal.String.Heredoc */ +.right-code code .si { color: #e6db74 } /* Literal.String.Interpol */ +.right-code code .sx { color: #e6db74 } /* Literal.String.Other */ +.right-code code .sr { color: #e6db74 } /* Literal.String.Regex */ +.right-code code .s1 { color: #e6db74 } /* Literal.String.Single */ +.right-code code .ss { color: #e6db74 } /* Literal.String.Symbol */ +.right-code code .bp { color: #f8f8f2 } /* Name.Builtin.Pseudo */ +.right-code code .vc { color: #f8f8f2 } /* Name.Variable.Class */ +.right-code code .vg { color: #f8f8f2 } /* Name.Variable.Global */ +.right-code code .vi { color: #f8f8f2 } /* Name.Variable.Instance */ +.right-code code .il { color: #ae81ff } /* Literal.Number.Integer.Long */ + +.right-code code .gh { } /* Generic Heading & Diff Header */ +.right-code code .gu { color: #75715e; } /* Generic.Subheading & Diff Unified/Comment? */ +.right-code code .gd { color: #f92672; } /* Generic.Deleted & Diff Deleted */ +.right-code code .gi { color: #a6e22e; } /* Generic.Inserted & Diff Inserted */ diff --git a/docs/_sass/cloudcannon.scss b/docs/_sass/cloudcannon.scss new file mode 100755 index 0000000..0ff8f94 --- /dev/null +++ b/docs/_sass/cloudcannon.scss @@ -0,0 +1,26 @@ +.editor-link { + display: none; + float: right; + margin-top: 0; + border: 0; + border-radius: 2px; + box-sizing: border-box; + font-size: 2rem; + text-decoration: none; + padding: 10px 15px; + margin: 0; + font-size: 18px; + cursor: pointer; + background-color: #f7e064; + color: #333; + box-shadow: 1px 1px 5px 0 rgba(0, 0, 0, 0.2); + + &:hover { + background-color: #f4d525; + color: #333; + } +} + +.cms-editor-active .editor-link { + display: inline-block; +} diff --git a/docs/apple-touch-icon.png b/docs/apple-touch-icon.png new file mode 100644 index 0000000..75880b2 Binary files /dev/null and b/docs/apple-touch-icon.png differ diff --git a/docs/css/editor.css b/docs/css/editor.css new file mode 100755 index 0000000..74feea7 --- /dev/null +++ b/docs/css/editor.css @@ -0,0 +1,24 @@ +.error, .warning, .info, .success { + border-left: 5px solid #FD0; + padding: 10px 15px; + margin-left: -20px; + margin-right: -15px; + background-color: #FAFAFA; + border-radius: 2px; +} + +p.warning { + border-color: #ffc107; +} + +p.info { + border-color: #56ADEC; +} + +p.error { + border-color: #F20; +} + +p.success { + border-color: #6c0; +} diff --git a/docs/css/style.scss b/docs/css/style.scss new file mode 100755 index 0000000..47c3835 --- /dev/null +++ b/docs/css/style.scss @@ -0,0 +1,26 @@ +--- +layout: null +sitemap: false +--- + +$brand-colour: #FF8B84; + +$nav-header-height: 70px; +$nav-background-color: #EAFFFF; +$nav-width: 250px; + +$space: 20px; + +$mobile-break: 700px; + +{% if site.baseurl %} + $base-url: {{ site.baseurl }}; +{% else %} + $base-url: ''; +{% endif %} + +@import "mixins"; +@import "main"; +@import "borland"; +@import "monaki"; +@import "cloudcannon"; diff --git a/docs/favicon.ico b/docs/favicon.ico new file mode 100644 index 0000000..6c12a0d Binary files /dev/null and b/docs/favicon.ico differ diff --git a/docs/images/emblem.svg b/docs/images/emblem.svg new file mode 100644 index 0000000..90df6ed --- /dev/null +++ b/docs/images/emblem.svg @@ -0,0 +1,29 @@ + + + + background + + + + + + + Layer 1 + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/images/logo.svg b/docs/images/logo.svg new file mode 100644 index 0000000..90f891f --- /dev/null +++ b/docs/images/logo.svg @@ -0,0 +1,23 @@ + + + + Logo + + + + + + + + + + + + + + + + + + xhr-mock + \ No newline at end of file diff --git a/docs/images/menu.svg b/docs/images/menu.svg new file mode 100755 index 0000000..f468dc4 --- /dev/null +++ b/docs/images/menu.svg @@ -0,0 +1,4 @@ + + + + diff --git a/docs/index.html b/docs/index.html new file mode 100755 index 0000000..0f96537 --- /dev/null +++ b/docs/index.html @@ -0,0 +1,50 @@ +--- +title: API Docs +--- +{% assign sorted_collections = site.collections | sort: "position" %} +{% for collection in sorted_collections %} + {% assign sorted_docs = collection.docs | sort: "position" %} + {% for doc in sorted_docs %} +
+
+

+ + {{ doc.title }} + {% if doc.type %} + + {% endif %} + + Edit +

+ {% if doc.description %} +

{{ doc.description }}

+ {% endif %} + + {% if doc.parameters and doc.parameters[0].name %} +
Parameters
+
+ {% for parameter in doc.parameters %} +
{{ parameter.name }}
+
{{ parameter.content }}
+ {% endfor %} +
+ {% endif %} + + {{ doc.content_markdown | markdownify | replace: "
", "
Parameters
" }} + + {% if doc.left_code_blocks and doc.left_code_blocks[0].code_block %} + {% for block in doc.left_code_blocks %} + {% include syntax-highlight.html block=block %} + {% endfor %} + {% endif %} +
+ {% if doc.right_code_blocks and doc.right_code_blocks[0].code_block %} +
+ {% for block in doc.right_code_blocks %} + {% include syntax-highlight.html block=block %} + {% endfor %} +
+ {% endif %} +
+ {% endfor %} +{% endfor %} diff --git a/docs/js/lunr.min.js b/docs/js/lunr.min.js new file mode 100755 index 0000000..4fd086e --- /dev/null +++ b/docs/js/lunr.min.js @@ -0,0 +1,6 @@ +/** + * lunr - http://lunrjs.com - A bit like Solr, but much smaller and not as bright - 0.7.1 + * Copyright (C) 2016 Oliver Nightingale + * @license MIT + */ +!function(){var t=function(e){var n=new t.Index;return n.pipeline.add(t.trimmer,t.stopWordFilter,t.stemmer),e&&e.call(n,n),n};t.version="0.7.1",t.utils={},t.utils.warn=function(t){return function(e){t.console&&console.warn&&console.warn(e)}}(this),t.utils.asString=function(t){return void 0===t||null===t?"":t.toString()},t.EventEmitter=function(){this.events={}},t.EventEmitter.prototype.addListener=function(){var t=Array.prototype.slice.call(arguments),e=t.pop(),n=t;if("function"!=typeof e)throw new TypeError("last argument must be a function");n.forEach(function(t){this.hasHandler(t)||(this.events[t]=[]),this.events[t].push(e)},this)},t.EventEmitter.prototype.removeListener=function(t,e){if(this.hasHandler(t)){var n=this.events[t].indexOf(e);this.events[t].splice(n,1),this.events[t].length||delete this.events[t]}},t.EventEmitter.prototype.emit=function(t){if(this.hasHandler(t)){var e=Array.prototype.slice.call(arguments,1);this.events[t].forEach(function(t){t.apply(void 0,e)})}},t.EventEmitter.prototype.hasHandler=function(t){return t in this.events},t.tokenizer=function(e){return arguments.length&&null!=e&&void 0!=e?Array.isArray(e)?e.map(function(e){return t.utils.asString(e).toLowerCase()}):e.toString().trim().toLowerCase().split(t.tokenizer.seperator):[]},t.tokenizer.seperator=/[\s\-]+/,t.tokenizer.load=function(t){var e=this.registeredFunctions[t];if(!e)throw new Error("Cannot load un-registered function: "+t);return e},t.tokenizer.label="default",t.tokenizer.registeredFunctions={"default":t.tokenizer},t.tokenizer.registerFunction=function(e,n){n in this.registeredFunctions&&t.utils.warn("Overwriting existing tokenizer: "+n),e.label=n,this.registeredFunctions[n]=e},t.Pipeline=function(){this._stack=[]},t.Pipeline.registeredFunctions={},t.Pipeline.registerFunction=function(e,n){n in this.registeredFunctions&&t.utils.warn("Overwriting existing registered function: "+n),e.label=n,t.Pipeline.registeredFunctions[e.label]=e},t.Pipeline.warnIfFunctionNotRegistered=function(e){var n=e.label&&e.label in this.registeredFunctions;n||t.utils.warn("Function is not registered with pipeline. This may cause problems when serialising the index.\n",e)},t.Pipeline.load=function(e){var n=new t.Pipeline;return e.forEach(function(e){var i=t.Pipeline.registeredFunctions[e];if(!i)throw new Error("Cannot load un-registered function: "+e);n.add(i)}),n},t.Pipeline.prototype.add=function(){var e=Array.prototype.slice.call(arguments);e.forEach(function(e){t.Pipeline.warnIfFunctionNotRegistered(e),this._stack.push(e)},this)},t.Pipeline.prototype.after=function(e,n){t.Pipeline.warnIfFunctionNotRegistered(n);var i=this._stack.indexOf(e);if(-1==i)throw new Error("Cannot find existingFn");i+=1,this._stack.splice(i,0,n)},t.Pipeline.prototype.before=function(e,n){t.Pipeline.warnIfFunctionNotRegistered(n);var i=this._stack.indexOf(e);if(-1==i)throw new Error("Cannot find existingFn");this._stack.splice(i,0,n)},t.Pipeline.prototype.remove=function(t){var e=this._stack.indexOf(t);-1!=e&&this._stack.splice(e,1)},t.Pipeline.prototype.run=function(t){for(var e=[],n=t.length,i=this._stack.length,r=0;n>r;r++){for(var o=t[r],s=0;i>s&&(o=this._stack[s](o,r,t),void 0!==o&&""!==o);s++);void 0!==o&&""!==o&&e.push(o)}return e},t.Pipeline.prototype.reset=function(){this._stack=[]},t.Pipeline.prototype.toJSON=function(){return this._stack.map(function(e){return t.Pipeline.warnIfFunctionNotRegistered(e),e.label})},t.Vector=function(){this._magnitude=null,this.list=void 0,this.length=0},t.Vector.Node=function(t,e,n){this.idx=t,this.val=e,this.next=n},t.Vector.prototype.insert=function(e,n){this._magnitude=void 0;var i=this.list;if(!i)return this.list=new t.Vector.Node(e,n,i),this.length++;if(en.idx?n=n.next:(i+=e.val*n.val,e=e.next,n=n.next);return i},t.Vector.prototype.similarity=function(t){return this.dot(t)/(this.magnitude()*t.magnitude())},t.SortedSet=function(){this.length=0,this.elements=[]},t.SortedSet.load=function(t){var e=new this;return e.elements=t,e.length=t.length,e},t.SortedSet.prototype.add=function(){var t,e;for(t=0;t1;){if(o===t)return r;t>o&&(e=r),o>t&&(n=r),i=n-e,r=e+Math.floor(i/2),o=this.elements[r]}return o===t?r:-1},t.SortedSet.prototype.locationFor=function(t){for(var e=0,n=this.elements.length,i=n-e,r=e+Math.floor(i/2),o=this.elements[r];i>1;)t>o&&(e=r),o>t&&(n=r),i=n-e,r=e+Math.floor(i/2),o=this.elements[r];return o>t?r:t>o?r+1:void 0},t.SortedSet.prototype.intersect=function(e){for(var n=new t.SortedSet,i=0,r=0,o=this.length,s=e.length,a=this.elements,h=e.elements;;){if(i>o-1||r>s-1)break;a[i]!==h[r]?a[i]h[r]&&r++:(n.add(a[i]),i++,r++)}return n},t.SortedSet.prototype.clone=function(){var e=new t.SortedSet;return e.elements=this.toArray(),e.length=e.elements.length,e},t.SortedSet.prototype.union=function(t){var e,n,i;this.length>=t.length?(e=this,n=t):(e=t,n=this),i=e.clone();for(var r=0,o=n.toArray();rp;p++)c[p]===a&&d++;h+=d/f*l.boost}}this.tokenStore.add(a,{ref:o,tf:h})}n&&this.eventEmitter.emit("add",e,this)},t.Index.prototype.remove=function(t,e){var n=t[this._ref],e=void 0===e?!0:e;if(this.documentStore.has(n)){var i=this.documentStore.get(n);this.documentStore.remove(n),i.forEach(function(t){this.tokenStore.remove(t,n)},this),e&&this.eventEmitter.emit("remove",t,this)}},t.Index.prototype.update=function(t,e){var e=void 0===e?!0:e;this.remove(t,!1),this.add(t,!1),e&&this.eventEmitter.emit("update",t,this)},t.Index.prototype.idf=function(t){var e="@"+t;if(Object.prototype.hasOwnProperty.call(this._idfCache,e))return this._idfCache[e];var n=this.tokenStore.count(t),i=1;return n>0&&(i=1+Math.log(this.documentStore.length/n)),this._idfCache[e]=i},t.Index.prototype.search=function(e){var n=this.pipeline.run(this.tokenizerFn(e)),i=new t.Vector,r=[],o=this._fields.reduce(function(t,e){return t+e.boost},0),s=n.some(function(t){return this.tokenStore.has(t)},this);if(!s)return[];n.forEach(function(e,n,s){var a=1/s.length*this._fields.length*o,h=this,u=this.tokenStore.expand(e).reduce(function(n,r){var o=h.corpusTokens.indexOf(r),s=h.idf(r),u=1,l=new t.SortedSet;if(r!==e){var c=Math.max(3,r.length-e.length);u=1/Math.log(c)}o>-1&&i.insert(o,a*s*u);for(var f=h.tokenStore.get(r),d=Object.keys(f),p=d.length,v=0;p>v;v++)l.add(f[d[v]].ref);return n.union(l)},new t.SortedSet);r.push(u)},this);var a=r.reduce(function(t,e){return t.intersect(e)});return a.map(function(t){return{ref:t,score:i.similarity(this.documentVector(t))}},this).sort(function(t,e){return e.score-t.score})},t.Index.prototype.documentVector=function(e){for(var n=this.documentStore.get(e),i=n.length,r=new t.Vector,o=0;i>o;o++){var s=n.elements[o],a=this.tokenStore.get(s)[e].tf,h=this.idf(s);r.insert(this.corpusTokens.indexOf(s),a*h)}return r},t.Index.prototype.toJSON=function(){return{version:t.version,fields:this._fields,ref:this._ref,tokenizer:this.tokenizerFn.label,documentStore:this.documentStore.toJSON(),tokenStore:this.tokenStore.toJSON(),corpusTokens:this.corpusTokens.toJSON(),pipeline:this.pipeline.toJSON()}},t.Index.prototype.use=function(t){var e=Array.prototype.slice.call(arguments,1);e.unshift(this),t.apply(this,e)},t.Store=function(){this.store={},this.length=0},t.Store.load=function(e){var n=new this;return n.length=e.length,n.store=Object.keys(e.store).reduce(function(n,i){return n[i]=t.SortedSet.load(e.store[i]),n},{}),n},t.Store.prototype.set=function(t,e){this.has(t)||this.length++,this.store[t]=e},t.Store.prototype.get=function(t){return this.store[t]},t.Store.prototype.has=function(t){return t in this.store},t.Store.prototype.remove=function(t){this.has(t)&&(delete this.store[t],this.length--)},t.Store.prototype.toJSON=function(){return{store:this.store,length:this.length}},t.stemmer=function(){var t={ational:"ate",tional:"tion",enci:"ence",anci:"ance",izer:"ize",bli:"ble",alli:"al",entli:"ent",eli:"e",ousli:"ous",ization:"ize",ation:"ate",ator:"ate",alism:"al",iveness:"ive",fulness:"ful",ousness:"ous",aliti:"al",iviti:"ive",biliti:"ble",logi:"log"},e={icate:"ic",ative:"",alize:"al",iciti:"ic",ical:"ic",ful:"",ness:""},n="[^aeiou]",i="[aeiouy]",r=n+"[^aeiouy]*",o=i+"[aeiou]*",s="^("+r+")?"+o+r,a="^("+r+")?"+o+r+"("+o+")?$",h="^("+r+")?"+o+r+o+r,u="^("+r+")?"+i,l=new RegExp(s),c=new RegExp(h),f=new RegExp(a),d=new RegExp(u),p=/^(.+?)(ss|i)es$/,v=/^(.+?)([^s])s$/,g=/^(.+?)eed$/,m=/^(.+?)(ed|ing)$/,y=/.$/,S=/(at|bl|iz)$/,w=new RegExp("([^aeiouylsz])\\1$"),k=new RegExp("^"+r+i+"[^aeiouwxy]$"),x=/^(.+?[^aeiou])y$/,b=/^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/,E=/^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/,F=/^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/,_=/^(.+?)(s|t)(ion)$/,z=/^(.+?)e$/,O=/ll$/,P=new RegExp("^"+r+i+"[^aeiouwxy]$"),T=function(n){var i,r,o,s,a,h,u;if(n.length<3)return n;if(o=n.substr(0,1),"y"==o&&(n=o.toUpperCase()+n.substr(1)),s=p,a=v,s.test(n)?n=n.replace(s,"$1$2"):a.test(n)&&(n=n.replace(a,"$1$2")),s=g,a=m,s.test(n)){var T=s.exec(n);s=l,s.test(T[1])&&(s=y,n=n.replace(s,""))}else if(a.test(n)){var T=a.exec(n);i=T[1],a=d,a.test(i)&&(n=i,a=S,h=w,u=k,a.test(n)?n+="e":h.test(n)?(s=y,n=n.replace(s,"")):u.test(n)&&(n+="e"))}if(s=x,s.test(n)){var T=s.exec(n);i=T[1],n=i+"i"}if(s=b,s.test(n)){var T=s.exec(n);i=T[1],r=T[2],s=l,s.test(i)&&(n=i+t[r])}if(s=E,s.test(n)){var T=s.exec(n);i=T[1],r=T[2],s=l,s.test(i)&&(n=i+e[r])}if(s=F,a=_,s.test(n)){var T=s.exec(n);i=T[1],s=c,s.test(i)&&(n=i)}else if(a.test(n)){var T=a.exec(n);i=T[1]+T[2],a=c,a.test(i)&&(n=i)}if(s=z,s.test(n)){var T=s.exec(n);i=T[1],s=c,a=f,h=P,(s.test(i)||a.test(i)&&!h.test(i))&&(n=i)}return s=O,a=c,s.test(n)&&a.test(n)&&(s=y,n=n.replace(s,"")),"y"==o&&(n=o.toLowerCase()+n.substr(1)),n};return T}(),t.Pipeline.registerFunction(t.stemmer,"stemmer"),t.generateStopWordFilter=function(t){var e=t.reduce(function(t,e){return t[e]=e,t},{});return function(t){return t&&e[t]!==t?t:void 0}},t.stopWordFilter=t.generateStopWordFilter(["a","able","about","across","after","all","almost","also","am","among","an","and","any","are","as","at","be","because","been","but","by","can","cannot","could","dear","did","do","does","either","else","ever","every","for","from","get","got","had","has","have","he","her","hers","him","his","how","however","i","if","in","into","is","it","its","just","least","let","like","likely","may","me","might","most","must","my","neither","no","nor","not","of","off","often","on","only","or","other","our","own","rather","said","say","says","she","should","since","so","some","than","that","the","their","them","then","there","these","they","this","tis","to","too","twas","us","wants","was","we","were","what","when","where","which","while","who","whom","why","will","with","would","yet","you","your"]),t.Pipeline.registerFunction(t.stopWordFilter,"stopWordFilter"),t.trimmer=function(t){return t.replace(/^\W+/,"").replace(/\W+$/,"")},t.Pipeline.registerFunction(t.trimmer,"trimmer"),t.TokenStore=function(){this.root={docs:{}},this.length=0},t.TokenStore.load=function(t){var e=new this;return e.root=t.root,e.length=t.length,e},t.TokenStore.prototype.add=function(t,e,n){var n=n||this.root,i=t.charAt(0),r=t.slice(1);return i in n||(n[i]={docs:{}}),0===r.length?(n[i].docs[e.ref]=e,void(this.length+=1)):this.add(r,e,n[i])},t.TokenStore.prototype.has=function(t){if(!t)return!1;for(var e=this.root,n=0;n div.highlighter-rouge:first-of-type").each(function(i) { + + var $this = $(this).before("
    "), + $languages = $this.prev(), + $notFirst = $this.nextUntil(":not(div.highlighter-rouge)"), + $all = $this.add($notFirst); + + $all.add($languages).wrapAll("
    "); + + + listLanguages($all, $languages); + + $this.css('display', 'block'); + $notFirst.css('display', 'none'); + + $languages.find('a').first().addClass('active'); + + $languages.find('a').click(function() { + $all.css('display', 'none'); + $all.eq($(this).parent().index()).css('display', 'block'); + + $languages.find('a').removeClass('active'); + $(this).addClass('active'); + return false; + }); + + if ($languages.children().length === 0) { + $languages.remove(); + } + }); + + function listLanguages($el, $insert) { + $el.each(function(i) { + var title = $(this).attr('title'); + if (title) { + $insert.append("
  • " + title + "
  • "); + } + }); + } + + var href = $('.sidebar a').first().attr("href"); + + if (href !== undefined && href.charAt(0) === "#") { + setActiveSidebarLink(); + + $(window).on("scroll", function(evt) { + setActiveSidebarLink(); + }); + } + + function setActiveSidebarLink() { + $('.sidebar a').removeClass('active'); + var $closest = getClosestHeader(); + $closest.addClass('active'); + document.title = $closest.text(); + + } +}); + +function getClosestHeader() { + var $links = $('.sidebar a'), + top = window.scrollY, + $last = $links.first(); + + if (top < 300) { + return $last; + } + + if (top + window.innerHeight >= $(".main").height()) { + return $links.last(); + } + + for (var i = 0; i < $links.length; i++) { + var $link = $links.eq(i), + href = $link.attr("href"); + + if (href !== undefined && href.charAt(0) === "#" && href.length > 1) { + var $anchor = $(href); + + if ($anchor.length > 0) { + var offset = $anchor.offset(); + + if (top < offset.top - 300) { + return $last; + } + + $last = $link; + } + } + } + return $last; +} diff --git a/docs/js/search.js b/docs/js/search.js new file mode 100755 index 0000000..2ab9bb7 --- /dev/null +++ b/docs/js/search.js @@ -0,0 +1,102 @@ +(function () { + function getQueryVariable(variable) { + var query = window.location.search.substring(1), + vars = query.split("&"); + + for (var i = 0; i < vars.length; i++) { + var pair = vars[i].split("="); + + if (pair[0] === variable) { + return decodeURIComponent(pair[1].replace(/\+/g, '%20')).trim(); + } + } + } + + function getPreview(query, content, previewLength) { + previewLength = previewLength || (content.length * 2); + + var parts = query.split(" "), + match = content.toLowerCase().indexOf(query.toLowerCase()), + matchLength = query.length, + preview; + + // Find a relevant location in content + for (var i = 0; i < parts.length; i++) { + if (match >= 0) { + break; + } + + match = content.toLowerCase().indexOf(parts[i].toLowerCase()); + matchLength = parts[i].length; + } + + // Create preview + if (match >= 0) { + var start = match - (previewLength / 2), + end = start > 0 ? match + matchLength + (previewLength / 2) : previewLength; + + preview = content.substring(start, end).trim(); + + if (start > 0) { + preview = "..." + preview; + } + + if (end < content.length) { + preview = preview + "..."; + } + + // Highlight query parts + preview = preview.replace(new RegExp("(" + parts.join("|") + ")", "gi"), "$1"); + } else { + // Use start of content if no match found + preview = content.substring(0, previewLength).trim() + (content.length > previewLength ? "..." : ""); + } + + return preview; + } + + function displaySearchResults(results, query) { + var searchResultsEl = document.getElementById("search-results"), + searchProcessEl = document.getElementById("search-process"); + + if (results.length) { + var resultsHTML = ""; + results.forEach(function (result) { + var item = window.data[result.ref], + contentPreview = getPreview(query, item.content, 170), + titlePreview = getPreview(query, item.title); + + resultsHTML += "
  • " + titlePreview + "

    " + contentPreview + "

  • "; + }); + + searchResultsEl.innerHTML = resultsHTML; + searchProcessEl.innerText = "Showing"; + } else { + searchResultsEl.style.display = "none"; + searchProcessEl.innerText = "No"; + } + } + + window.index = lunr(function () { + this.field("id"); + this.field("title", {boost: 10}); + this.field("category"); + this.field("url"); + this.field("content"); + }); + + var query = decodeURIComponent((getQueryVariable("q") || "").replace(/\+/g, "%20")), + searchQueryContainerEl = document.getElementById("search-query-container"), + searchQueryEl = document.getElementById("search-query"), + searchInputEl = document.getElementById("search-input"); + + searchInputEl.value = query; + searchQueryEl.innerText = query; + searchQueryContainerEl.style.display = "inline"; + + for (var key in window.data) { + window.index.add(window.data[key]); + } + + displaySearchResults(window.index.search(query), query); // Hand the results off to be displayed +})(); diff --git a/docs/robots.txt b/docs/robots.txt new file mode 100755 index 0000000..780b5a3 --- /dev/null +++ b/docs/robots.txt @@ -0,0 +1,6 @@ +--- +layout: null +sitemap: false +--- +User-agent: * +Sitemap: {{ site.url }}/sitemap.xml \ No newline at end of file diff --git a/docs/search.html b/docs/search.html new file mode 100755 index 0000000..59e55c8 --- /dev/null +++ b/docs/search.html @@ -0,0 +1,39 @@ +--- +title: Search +sitemap: false +permalink: /search/ +--- + +
    +

    Search Results

    + +

    Loading results

    +
      +
      + + + + diff --git a/docs/siteicon.png b/docs/siteicon.png new file mode 100644 index 0000000..7cbfcfd Binary files /dev/null and b/docs/siteicon.png differ diff --git a/docs/touch-icon.png b/docs/touch-icon.png new file mode 100644 index 0000000..bd24614 Binary files /dev/null and b/docs/touch-icon.png differ diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..a8dc337 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,507 @@ +{ + "name": "xhr-mock-monorepo", + "requires": true, + "lockfileVersion": 1, + "dependencies": { + "@types/events": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@types/events/-/events-1.2.0.tgz", + "integrity": "sha512-KEIlhXnIutzKwRbQkGWb/I4HFqBuUykAdHgDED6xqwXJfONCjF5VoE0cXEiurh3XauygxzeDzgtXUqvLkxFzzA==", + "dev": true + }, + "@types/fs-extra": { + "version": "5.0.4", + "resolved": "https://registry.npmjs.org/@types/fs-extra/-/fs-extra-5.0.4.tgz", + "integrity": "sha512-DsknoBvD8s+RFfSGjmERJ7ZOP1HI0UZRA3FSI+Zakhrc/Gy26YQsLI+m5V5DHxroHRJqCDLKJp7Hixn8zyaF7g==", + "dev": true, + "requires": { + "@types/node": "10.9.2" + } + }, + "@types/glob": { + "version": "5.0.35", + "resolved": "https://registry.npmjs.org/@types/glob/-/glob-5.0.35.tgz", + "integrity": "sha512-wc+VveszMLyMWFvXLkloixT4n0harUIVZjnpzztaZ0nKLuul7Z32iMt2fUFGAaZ4y1XWjFRMtCI5ewvyh4aIeg==", + "dev": true, + "requires": { + "@types/events": "1.2.0", + "@types/minimatch": "3.0.3", + "@types/node": "10.9.2" + } + }, + "@types/handlebars": { + "version": "4.0.39", + "resolved": "https://registry.npmjs.org/@types/handlebars/-/handlebars-4.0.39.tgz", + "integrity": "sha512-vjaS7Q0dVqFp85QhyPSZqDKnTTCemcSHNHFvDdalO1s0Ifz5KuE64jQD5xoUkfdWwF4WpqdJEl7LsWH8rzhKJA==", + "dev": true + }, + "@types/highlight.js": { + "version": "9.12.3", + "resolved": "https://registry.npmjs.org/@types/highlight.js/-/highlight.js-9.12.3.tgz", + "integrity": "sha512-pGF/zvYOACZ/gLGWdQH8zSwteQS1epp68yRcVLJMgUck/MjEn/FBYmPub9pXT8C1e4a8YZfHo1CKyV8q1vKUnQ==", + "dev": true + }, + "@types/lodash": { + "version": "4.14.116", + "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.116.tgz", + "integrity": "sha512-lRnAtKnxMXcYYXqOiotTmJd74uawNWuPnsnPrrO7HiFuE3npE2iQhfABatbYDyxTNqZNuXzcKGhw37R7RjBFLg==", + "dev": true + }, + "@types/marked": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/@types/marked/-/marked-0.4.1.tgz", + "integrity": "sha512-ZqEGxppVG1x9QK/hkHxzmf6m4xcnk9CaHjNCqwvUeN3pMdCcQkPxmvrbLZ5GbP7K25TgiT1nKIGnz0U3M+G05Q==", + "dev": true + }, + "@types/minimatch": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.3.tgz", + "integrity": "sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA==", + "dev": true + }, + "@types/node": { + "version": "10.9.2", + "resolved": "https://registry.npmjs.org/@types/node/-/node-10.9.2.tgz", + "integrity": "sha512-pwZnkVyCGJ3LsQ0/3flQK5lCFao4esIzwUVzzk5NvL9vnkEyDhNf4fhHzUMHvyr56gNZywWTS2MR0euabMSz4A==", + "dev": true + }, + "@types/shelljs": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/@types/shelljs/-/shelljs-0.8.0.tgz", + "integrity": "sha512-vs1hCC8RxLHRu2bwumNyYRNrU3o8BtZhLysH5A4I98iYmA2APl6R3uNQb5ihl+WiwH0xdC9LLO+vRrXLs/Kyxg==", + "dev": true, + "requires": { + "@types/glob": "5.0.35", + "@types/node": "10.9.2" + } + }, + "align-text": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/align-text/-/align-text-0.1.4.tgz", + "integrity": "sha1-DNkKVhCT810KmSVsIrcGlDP60Rc=", + "dev": true, + "requires": { + "kind-of": "3.2.2", + "longest": "1.0.1", + "repeat-string": "1.6.1" + } + }, + "amdefine": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/amdefine/-/amdefine-1.0.1.tgz", + "integrity": "sha1-SlKCrBZHKek2Gbz9OtFR+BfOkfU=", + "dev": true + }, + "async": { + "version": "1.5.2", + "resolved": "https://registry.npmjs.org/async/-/async-1.5.2.tgz", + "integrity": "sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo=", + "dev": true + }, + "balanced-match": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", + "dev": true + }, + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "requires": { + "balanced-match": "1.0.0", + "concat-map": "0.0.1" + } + }, + "camelcase": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-1.2.1.tgz", + "integrity": "sha1-m7UwTS4LVmmLLHWLCKPqqdqlijk=", + "dev": true, + "optional": true + }, + "center-align": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/center-align/-/center-align-0.1.3.tgz", + "integrity": "sha1-qg0yYptu6XIgBBHL1EYckHvCt60=", + "dev": true, + "optional": true, + "requires": { + "align-text": "0.1.4", + "lazy-cache": "1.0.4" + } + }, + "cliui": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-2.1.0.tgz", + "integrity": "sha1-S0dXYP+AJkx2LDoXGQMukcf+oNE=", + "dev": true, + "optional": true, + "requires": { + "center-align": "0.1.3", + "right-align": "0.1.3", + "wordwrap": "0.0.2" + }, + "dependencies": { + "wordwrap": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.2.tgz", + "integrity": "sha1-t5Zpu0LstAn4PVg8rVLKF+qhZD8=", + "dev": true, + "optional": true + } + } + }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", + "dev": true + }, + "decamelize": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", + "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", + "dev": true, + "optional": true + }, + "fs-extra": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-7.0.0.tgz", + "integrity": "sha512-EglNDLRpmaTWiD/qraZn6HREAEAHJcJOmxNEYwq6xeMKnVMAy3GUcFB+wXt2C6k4CNvB/mP1y/U3dzvKKj5OtQ==", + "dev": true, + "requires": { + "graceful-fs": "4.1.11", + "jsonfile": "4.0.0", + "universalify": "0.1.2" + } + }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", + "dev": true + }, + "glob": { + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.3.tgz", + "integrity": "sha512-vcfuiIxogLV4DlGBHIUOwI0IbrJ8HWPc4MU7HzviGeNho/UJDfi6B5p3sHeWIQ0KGIU0Jpxi5ZHxemQfLkkAwQ==", + "dev": true, + "requires": { + "fs.realpath": "1.0.0", + "inflight": "1.0.6", + "inherits": "2.0.3", + "minimatch": "3.0.4", + "once": "1.4.0", + "path-is-absolute": "1.0.1" + } + }, + "graceful-fs": { + "version": "4.1.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", + "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=", + "dev": true + }, + "handlebars": { + "version": "4.0.11", + "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.0.11.tgz", + "integrity": "sha1-Ywo13+ApS8KB7a5v/F0yn8eYLcw=", + "dev": true, + "requires": { + "async": "1.5.2", + "optimist": "0.6.1", + "source-map": "0.4.4", + "uglify-js": "2.8.29" + } + }, + "highlight.js": { + "version": "9.12.0", + "resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-9.12.0.tgz", + "integrity": "sha1-5tnb5Xy+/mB1HwKvM2GVhwyQwB4=", + "dev": true + }, + "inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "dev": true, + "requires": { + "once": "1.4.0", + "wrappy": "1.0.2" + } + }, + "inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", + "dev": true + }, + "interpret": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/interpret/-/interpret-1.1.0.tgz", + "integrity": "sha1-ftGxQQxqDg94z5XTuEQMY/eLhhQ=", + "dev": true + }, + "is-buffer": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", + "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", + "dev": true + }, + "jsonfile": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", + "integrity": "sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=", + "dev": true, + "requires": { + "graceful-fs": "4.1.11" + } + }, + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "1.1.6" + } + }, + "lazy-cache": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/lazy-cache/-/lazy-cache-1.0.4.tgz", + "integrity": "sha1-odePw6UEdMuAhF07O24dpJpEbo4=", + "dev": true, + "optional": true + }, + "lodash": { + "version": "4.17.10", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.10.tgz", + "integrity": "sha512-UejweD1pDoXu+AD825lWwp4ZGtSwgnpZxb3JDViD7StjQz+Nb/6l093lx4OQ0foGWNRoc19mWy7BzL+UAK2iVg==", + "dev": true + }, + "longest": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/longest/-/longest-1.0.1.tgz", + "integrity": "sha1-MKCy2jj3N3DoKUoNIuZiXtd9AJc=", + "dev": true + }, + "marked": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/marked/-/marked-0.4.0.tgz", + "integrity": "sha512-tMsdNBgOsrUophCAFQl0XPe6Zqk/uy9gnue+jIIKhykO51hxyu6uNx7zBPy0+y/WKYVZZMspV9YeXLNdKk+iYw==", + "dev": true + }, + "minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "dev": true, + "requires": { + "brace-expansion": "1.1.11" + } + }, + "minimist": { + "version": "0.0.10", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.10.tgz", + "integrity": "sha1-3j+YVD2/lggr5IrRoMfNqDYwHc8=", + "dev": true + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "dev": true, + "requires": { + "wrappy": "1.0.2" + } + }, + "optimist": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/optimist/-/optimist-0.6.1.tgz", + "integrity": "sha1-2j6nRob6IaGaERwybpDrFaAZZoY=", + "dev": true, + "requires": { + "minimist": "0.0.10", + "wordwrap": "0.0.3" + } + }, + "path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", + "dev": true + }, + "path-parse": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz", + "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==", + "dev": true + }, + "progress": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.0.tgz", + "integrity": "sha1-ihvjZr+Pwj2yvSPxDG/pILQ4nR8=", + "dev": true + }, + "rechoir": { + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.6.2.tgz", + "integrity": "sha1-hSBLVNuoLVdC4oyWdW70OvUOM4Q=", + "dev": true, + "requires": { + "resolve": "1.8.1" + } + }, + "repeat-string": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz", + "integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc=", + "dev": true + }, + "resolve": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.8.1.tgz", + "integrity": "sha512-AicPrAC7Qu1JxPCZ9ZgCZlY35QgFnNqc+0LtbRNxnVw4TXvjQ72wnuL9JQcEBgXkI9JM8MsT9kaQoHcpCRJOYA==", + "dev": true, + "requires": { + "path-parse": "1.0.6" + } + }, + "right-align": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/right-align/-/right-align-0.1.3.tgz", + "integrity": "sha1-YTObci/mo1FWiSENJOFMlhSGE+8=", + "dev": true, + "optional": true, + "requires": { + "align-text": "0.1.4" + } + }, + "shelljs": { + "version": "0.8.2", + "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.8.2.tgz", + "integrity": "sha512-pRXeNrCA2Wd9itwhvLp5LZQvPJ0wU6bcjaTMywHHGX5XWhVN2nzSu7WV0q+oUY7mGK3mgSkDDzP3MgjqdyIgbQ==", + "dev": true, + "requires": { + "glob": "7.1.3", + "interpret": "1.1.0", + "rechoir": "0.6.2" + } + }, + "source-map": { + "version": "0.4.4", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.4.4.tgz", + "integrity": "sha1-66T12pwNyZneaAMti092FzZSA2s=", + "dev": true, + "requires": { + "amdefine": "1.0.1" + } + }, + "typedoc": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.12.0.tgz", + "integrity": "sha512-dsdlaYZ7Je8JC+jQ3j2Iroe4uyD0GhqzADNUVyBRgLuytQDP/g0dPkAw5PdM/4drnmmJjRzSWW97FkKo+ITqQg==", + "dev": true, + "requires": { + "@types/fs-extra": "5.0.4", + "@types/handlebars": "4.0.39", + "@types/highlight.js": "9.12.3", + "@types/lodash": "4.14.116", + "@types/marked": "0.4.1", + "@types/minimatch": "3.0.3", + "@types/shelljs": "0.8.0", + "fs-extra": "7.0.0", + "handlebars": "4.0.11", + "highlight.js": "9.12.0", + "lodash": "4.17.10", + "marked": "0.4.0", + "minimatch": "3.0.4", + "progress": "2.0.0", + "shelljs": "0.8.2", + "typedoc-default-themes": "0.5.0", + "typescript": "3.0.1" + }, + "dependencies": { + "typescript": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.0.1.tgz", + "integrity": "sha512-zQIMOmC+372pC/CCVLqnQ0zSBiY7HHodU7mpQdjiZddek4GMj31I3dUJ7gAs9o65X7mnRma6OokOkc6f9jjfBg==", + "dev": true + } + } + }, + "typedoc-default-themes": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/typedoc-default-themes/-/typedoc-default-themes-0.5.0.tgz", + "integrity": "sha1-bcJDPnjti+qOiHo6zeLzF4W9Yic=", + "dev": true + }, + "uglify-js": { + "version": "2.8.29", + "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-2.8.29.tgz", + "integrity": "sha1-KcVzMUgFe7Th913zW3qcty5qWd0=", + "dev": true, + "optional": true, + "requires": { + "source-map": "0.5.7", + "uglify-to-browserify": "1.0.2", + "yargs": "3.10.0" + }, + "dependencies": { + "source-map": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", + "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", + "dev": true, + "optional": true + } + } + }, + "uglify-to-browserify": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/uglify-to-browserify/-/uglify-to-browserify-1.0.2.tgz", + "integrity": "sha1-bgkk1r2mta/jSeOabWMoUKD4grc=", + "dev": true, + "optional": true + }, + "universalify": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", + "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==", + "dev": true + }, + "window-size": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/window-size/-/window-size-0.1.0.tgz", + "integrity": "sha1-VDjNLqk7IC76Ohn+iIeu58lPnJ0=", + "dev": true, + "optional": true + }, + "wordwrap": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.3.tgz", + "integrity": "sha1-o9XabNXAvAAI03I0u68b7WMFkQc=", + "dev": true + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", + "dev": true + }, + "yargs": { + "version": "3.10.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-3.10.0.tgz", + "integrity": "sha1-9+572FfdfB0tOMDnTvvWgdFDH9E=", + "dev": true, + "optional": true, + "requires": { + "camelcase": "1.2.1", + "cliui": "2.1.0", + "decamelize": "1.2.0", + "window-size": "0.1.0" + } + } + } +} diff --git a/package.json b/package.json index a328062..d9f3422 100644 --- a/package.json +++ b/package.json @@ -17,6 +17,12 @@ "ci": "lerna run ci" }, "lint-staged": { - "*.{js,json,ts,md}": ["prettier --write", "git add"] + "*.{js,json,ts,md}": [ + "prettier --write", + "git add" + ] + }, + "devDependencies": { + "typedoc": "^0.12.0" } }