diff --git a/docMap.json b/docMap.json index d81b9d3b..d479c3c1 100644 --- a/docMap.json +++ b/docMap.json @@ -28,19 +28,17 @@ "bundleDependencies": false, "dependencies": { "can-assign": "^1.0.0", - "can-stache": "^4.0.0", + "can-stache": "^5.0.0-pre.3", "can-stache-ast": "^1.0.0", - "can-stache-bindings": "^4.0.0", - "can-view-import": "^4.2.2", + "can-stache-bindings": "^5.0.0-pre.4", + "can-view-import": "^5.0.0-pre.1", "steal-config-utils": "^1.0.0" }, "deprecated": false, "description": "Load can-stache templates with StealJS", "devDependencies": { - "bit-docs": "0.0.7", "can-test-helpers": "^1.1.0", - "can-view-callbacks": "^4.1.1", - "can-view-nodelist": "^4.0.0", + "can-view-callbacks": "^5.0.0-pre.1", "jshint": "^2.9.4", "steal": "^1.7.0", "steal-qunit": "^2.0.0", @@ -85,7 +83,7 @@ "stache": "steal-stache" } }, - "version": "4.1.5" + "version": "5.0.0" }, "signatures": [ { @@ -131,18 +129,454 @@ }, "comment": " " }, - "about": { + "can-observables": { + "name": "can-observables", + "title": "Observables", + "type": "group", + "parent": "api", + "description": "", + "order": 1 + }, + "can-views": { + "name": "can-views", + "title": "Views", + "type": "group", + "parent": "api", + "description": "", + "order": 2 + }, + "can-data-modeling": { + "name": "can-data-modeling", + "title": "Data Modeling", + "type": "group", + "parent": "api", + "description": "", + "order": 3 + }, + "can-routing": { + "name": "can-routing", + "title": "Routing", + "type": "group", + "parent": "api", + "description": "", + "order": 4 + }, + "can-js-utilities": { + "name": "can-js-utilities", + "title": "JS Utilities", + "type": "group", + "parent": "api", + "description": "", + "order": 5 + }, + "can-dom-utilities": { + "name": "can-dom-utilities", + "title": "DOM Utilities", + "type": "group", + "parent": "api", + "description": "", + "order": 6 + }, + "can-data-validation": { + "name": "can-data-validation", + "title": "Data Validation", + "type": "group", + "parent": "api", + "description": "", + "order": 7 + }, + "can-typed-data": { + "name": "can-typed-data", + "title": "Typed Data", + "type": "group", + "parent": "api", + "description": "", + "order": 8 + }, + "can-polyfills": { + "name": "can-polyfills", + "title": "Polyfills", + "type": "group", + "parent": "api", + "description": "", + "order": 9 + }, + "api": { "src": { - "path": "docs/can-canjs/about.md" + "path": "docs/can-canjs/can-api.md" }, - "body": "\nCanJS is an evolving and improving set of client-side JavaScript architectural libraries that balances innovation and stability. It targets experienced developers building complex applications with long futures ahead of them.\n\nCanJS is part of the [DoneJS](https://donejs.com/) family of open source projects. The [DoneJS Team](https://donejs.com/About.html#team) and [Bitovi](https://www.bitovi.com) are responsible for CanJS. They steer its direction, add features, fix bugs, and help you become successful. Feel free to say hello anytime on [Slack](https://www.bitovi.com/community/slack) ([#canjs channel](https://bitovi-community.slack.com/messages/CFC22NZ8A)) or the [forums](https://forums.bitovi.com/c/canjs).\n\n
\n \n \n
\n\n**CanJS’s goals are briefly summarized in its mission statement:**\n\n> To minimize the cost of building and maintaining JavaScript applications by balancing innovation and stability, helping developers transcend a changing technology landscape.\n\n## Why CanJS?\n\n* Read more about [guides/mission our mission] and how we’ve been accomplishing those goals for 10 years.\n\n* If CanJS’s heart isn’t enough to convince you it’s a good fit, read up on its [guides/technical].\n\n* CanJS is used by some of the largest companies in the world. Find out who on [guides/who-uses-canjs]\n\n* Learn about CanJS’s future plans, how we make them, and how you can influence them on the [roadmap] page.\n\n", - "description": " Learn about CanJS’s [guides/mission mission], [guides/technical technical highlights], [guides/who-uses-canjs who uses CanJS], and our [roadmap future roadmap].\n\n", - "name": "about", - "title": "About", + "body": "\n\n\n## Custom Element Basics\n\nCustom elements are defined with [can-stache-element StacheElement]. \nThe following defines a `` widget and includes it in the page:\n\n```html\n\n\n\n\n```\n
\n\n An element's:\n\n- [can-stache-element/static.props properties] are defined with the [api#Observables Observables] APIs documented below.\n- [can-stache-element/static.view view] is defined with the [api#Views Views] APIs documented below.\n- tag name is defined with [customElements.define](https://developer.mozilla.org/en-US/docs/Web/API/CustomElementRegistry/define).\n\n\n## Observables\n\nDefine custom observable key-value types with [can-observable-object ObservableObject].\n`ObservableObject` is used to organize the logic of both your [can-stache-element StacheElement] props and your [api#DataModeling Data Models]. The logic\nis expressed as properties and methods.\n\nThe following defines a `Todo` type with `toggleComplete` method.\n\n```js\nimport { ObservableObject, type } from \"can\";\n\n// -------------------------------\n// Define an observable Todo type:\n// -------------------------------\nclass Todo extends ObservableObject {\n static props = {\n name: string,\n complete: false\n };\n\n // `toggleComplete` is a method\n toggleComplete() {\n this.complete = !this.complete;\n }\n}\n\n// Create a todo instance:\nconst todo = new Todo({ name: \"Learn Observables\" });\n```\n
\n\n
\nExpand to see a larger example with numerous property behaviors:\n\n```js\nimport { ObservableObject, type } from \"can\";\nimport Todo from \"//canjs.com/demos/api/todo.mjs\";\n\n// -------------------------------\n// Define an observable Owner type:\n// -------------------------------\nclass Owner extends ObservableObject {\n static props = {\n first: String,\n last: String\n };\n}\n\n// -------------------------------\n// Define an observable Todo type:\n// -------------------------------\nclass Todo extends ObservableObject {\n\tstatic props = {\n\t\t// `id` is a Number\n\t\t// and uniquely identifies instances of this type.\n\t\tid: { type: Number, identity: true },\n\n\t\t// `complete` is a Boolean and defaults to `false`.\n\t\tcomplete: {\n\t\t\ttype: Boolean,\n\t\t\tdefault: false\n\t\t},\n\n\t\t// `dueDate` is a Date\n\t\tdueDate: Date,\n\n\t\t// `isDueWithin24Hours` property returns if the `.dueDate`\n\t\t// is in the next 24 hrs. This is a computed property.\n\t\tget isDueWithin24Hours() {\n\t\t\tlet msLeft = this.dueDate - new Date();\n\t\t\treturn msLeft >= 0 && msLeft <= 24 * 60 * 60 * 1000;\n\t\t},\n\n\t\t// `name` is a String.\n\t\tname: String,\n\n\t\t// `nameChangeCount` increments when `name` changes.\n\t\tnameChangeCount: {\n\t\t\tvalue({ listenTo, resolve }) {\n\t\t\t\tlet count = resolve(0);\n\t\t\t\tlistenTo(\"name\", () => {\n\t\t\t\t\tresolve(++count);\n\t\t\t\t});\n\t\t\t}\n\t\t},\n\n\t\t// Owner is a custom ObservableObject with a first and\n\t\t// last property. Whenever `owner` is set, the value\n\t\t// will be converted to the Owner type.\n\t\towner: type.convert(Owner),\n\n\t\t// `tags` is an observable array of items that\n\t\t// defaults to including \"new\"\n\t\ttags: {\n\t\t\tget default() {\n\t\t\t\treturn new ObservableArray([\"new\"]);\n\t\t\t}\n\t\t},\n\t};\n\n\t// `toggleComplete` is a method\n\ttoggleComplete() {\n\t\tthis.complete = !this.complete;\n\t}\n}\n\n// -----------------------------------------------------------\n// Create and use instances of the observable key-value type:\n// -----------------------------------------------------------\n\n// Create a todo instance:\nconst todo = new Todo({ name: \"Learn Observables\" });\n\n// Change a property:\ntodo.dueDate = new Date(new Date().getTime() + 1000 * 60 * 60);\n\n// Listen to changes\ntodo.listenTo(\"nameChangeCount\", ({ value }) => {\n\tconsole.log(value); //-> 1\n});\n\nlet handler = ({ value }) => {\n\tconsole.log(value); //-> \"Learn observables\"\n};\ntodo.listenTo(\"name\", handler);\n\ntodo.name = \"Learn observables\";\n\n// Stop listening to changes\ntodo.stopListening(\"name\", handler);\n\n// Stop listening to all registered handlers\ntodo.stopListening();\n\n// Call a method\ntodo.toggleComplete();\nconsole.log(todo.complete); //-> true\n\n// Assign properties\ntodo.assign({\n\towner: {\n\t\tfirst: \"Justin\",\n\t\tlast: \"Meyer\"\n\t}\n});\n\n// Serialize to a plain JavaScript object\nconsole.log(todo.serialize()); //-> {\n//\t\tcomplete: true,\n//\t\tdueDate: Date,\n//\t\tname: \"Learn observables\",\n//\t\towner: { first: \"Justin\", last: \"Meyer\" },\n//\t\ttags: [\"new\"]\n// }\n```\n
\n\n
\n\n
\nObservable lists\n\n```js\nimport { ObservableArray, type } from \"can\";\n\n// -----------------------------------\n// Define an observable TodoList type:\n// -----------------------------------\nclass TodoList extends ObservableArray {\n\t// Specify the behavior of items in the TodoList\n\tstatic items = type.convert(Todo);\n\n\t// Create a computed `complete` property\n\tget complete() {\n\t\t// Filter all complete todos\n\t\treturn this.filter({ complete: true });\n\t}\n}\n\n// -----------------------------------\n// Create and use instances of observable list types:\n// -----------------------------------\n\n/// Create a todo list\nconst todos = new TodoList([\n\t{ id: 1, name: \"learn observable lists\" },\n\tnew Todo({ id: 2, name: \"mow lawn\", complete: true })\n]);\n\n// Read the length and access items\nconsole.log(todos.length); //-> 2\nconsole.log(todos[0]); //-> Todo { id: 1, name: \"learn observable lists\" }\n\n// Read properties\nconsole.log(todos.complete); //-> TodoList[Todo{ id: 2, name: \"mow lawn\", complete: true }]\n\n// Listen for changes:\n// TODO\ntodos.listenTo(\"length\", ({ value }) => {\n\tconsole.log(value); //-> 1\n});\n\n// Make changes:\ntodos.pop();\n\n// Call non-mutating methods\nconst areSomeComplete = todos.some((todo) => {\n\treturn todo.complete === true;\n});\nconsole.log(areSomeComplete); //-> false\n```\n
\n\n
\n\n## Typed properties\n\n[can-type] can be used to define typed properties in [ObservableObject] and [StacheElement]\n- Types are strict by default, which means an error will be thrown if a property is set to a value of the wrong type.\n- [can-type/convert] can be used to create a property that will always convert its value to a specific type.\n- [can-type/maybe] can be used to create a property that can be `null` or `undefined`.\n\n```js\nimport { ObservableObject, type } from \"can\";\n\nclass Person extends ObservableObject {\n static props = {\n first: type.check(String), // type checking is the default behavior\n last: type.maybe(String), // maybe null, undefined or string\n age: Number, // type checking\n birthday: type.maybeConvert(Date) // converts the value to date if is defined \n };\n};\n\nconst farah = new Person({\n first: 'Farah',\n last: null,\n age: '4',\n birthday: undefined\n});\n\n// Uncaught Error: \"4\" (string) is not of type Number.\n// Property age is using \"type: Number\". Use \"age: type.convert(Number)\"\n// to automatically convert values to Numbers when setting the \"age\" property.\n```\n\n## Views\n\nRender a template that updates the page when any data changes using [can-stache]:\n\n```js\nimport { stache } from \"can\";\nimport Todo from \"//canjs.com/demos/api/todo.mjs\";\n\n// Create a template / view\nlet view = stache(`

I need to {{ this.name }}

`);\n\nconst todo = new Todo({ name: \"learn views\" });\n\n// Render the template into document fragment\nlet fragment = view(todo);\n\n// Insert fragment in the page\ndocument.body.appendChild(fragment);\n```\n
\n\n\n\n\nCommon [can-stache] tags and built in helpers:\n\n\n\n \n \n \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
ViewDataResult
\n\n```html\n

{{ this.value }}

\n```\n\n
\n\n```js\n{ value: \"esc\" }\n```\n\n\n\n```html\n

>b<esc>/b<

\n```\n\n
\n\n
<p>{{{ this.value }}}</p>
\n\n
\n\n```js\n{ value: \"unescape\" }\n```\n\n\n\n```html\n

unescape

\n```\n\n
\n\n```html\n

\n {{# if(this.value) }}\n Hi\n {{ else }}\n Bye\n {{/ if }}\n

\n```\n\n
\n\n```js\n{ value: true }\n\n\n\n\n\n\n\n```\n\n\n\n```html\n

\n\n Hi \n\n

\n\n\n\n```\n\n
\n\n```html\n

\n {{# if(this.promise.isPending) }}\n Pending\n {{/ if }}\n {{# if(this.promise.isRejected) }}\n Rejected {{ promise.reason }}\n {{/ if }}\n {{# if(this.promise.isResolved) }}\n Resolved {{ promise.value }}\n {{/ if }}\n

\n```\n\n
\n\n```js\n{\n promise:\n Promise.resolve(\"Yo\")\n}\n\n\n\n\n\n\n\n\n```\n\n\n\n```html\n

\n\n Resolved Yo\n\n

\n\n\n\n\n\n\n\n```\n\n
\n\n```html\n
    \n {{# for(todo of this.todos) }}\n
  • \n {{ todo.name }}-{{ this.owner }}\n
  • \n {{/ for }}\n
\n\n\n```\n\n
\n\n```js\n{\n todos: [\n { name: \"lawn\" },\n { name: \"dishes\" }\n ],\n owner: \"Justin\"\n}\n\n\n```\n\n\n\n```html\n
    \n
  • \n lawn-Justin \n
  • \n
  • \n dishes-Justin \n
  • \n
\n```\n\n
\n\n```html\n
    \n {{# for(todo of todos) }}\n
  • ...
  • \n {{ else }}\n
  • No todos
  • \n {{/ for }}\n
\n```\n\n
\n\n```js\n{\n todos: [],\n owner: \"Justin\"\n}\n\n\n\n\n```\n\n\n\n```html\n
    \n\n
  • No todos
  • \n\n
\n\n\n\n```\n\n
\n\n```html\n

\n {{# eq(this.value, 22) }}\n YES\n {{ else }}\n NO\n {{/ eq }}\n

\n```\n\n
\n\n```js\n{\n value: 22\n}\n\n\n\n\n\n```\n\n\n\n```html\n

\n\n YES \n\n

\n\n\n\n```\n\n
\n\n```html\n

\n {{ let first = this.value.first }}\n {{ first }} {{ this.value.last }}\n

\n\n\n\n```\n\n
\n\n```js\n{\n value: {\n first: \"Bohdi\",\n last: \"Meyer\"\n }\n}\n\n```\n\n\n\n```html\n

\n\n Bohdi Meyer \n\n

\n\n\n```\n\n
\n
\n\n```html\n\n\n\n```\n\n
\n
\n\n\nCommon [can-stache] expressions:\n\n\n\n \n \n \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
ViewDataResult
\n\n```html\n

{{ [key] }}

\n\n\n\n\n```\n\n
\n\n```js\n{\n key: \"age\",\n age: 3\n}\n```\n\n\n\n```html\n

3

\n\n\n\n\n```\n\n
\n\n```html\n

{{ add(age, 2) }}

\n\n\n\n\n\n\n```\n\n
\n\n```js\n{\n add(v1, v2){\n return v1+v2;\n },\n age: 3\n}\n```\n\n\n\n```html\n

5

\n\n\n\n\n\n\n```\n\n
\n\n```html\n

{{ add(v1=age v2=2) }}

\n\n\n\n\n\n\n```\n\n
\n\n```js\n{\n add(vals){\n return vals.v1+vals.v2;\n },\n age: 3\n}\n```\n\n\n\n```html\n

5

\n\n\n\n\n\n\n```\n\n
\n
\n\n```html\n\n\n\n```\n\n
\n
\n\n## Element Bindings\n\nListen to events on elements, read data, write data, or cross-bind data on elements with [can-stache-bindings]:\n\n\n\n \n \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
ViewRoughly Equivalent Code
\n\n```js\n\n\n\n\n```\n\n\n\n```js\ntodo.on(\"name\", () => {\n input.value = todo.name;\n});\n```\n\n
\n\n```js\n\n\n\n\n```\n\n\n\n```js\ninput.addEventListener(\"change\", () => {\n todo.name = input.value;\n});\n```\n\n
\n\n```js\n\n\n\n\n```\n\n\n\n```js\ninput.addEventListener(\"input\", () => {\n todo.name = input.value;\n});\n```\n\n
\n\n```js\n\n\n\n\n\n\n\n```\n\n\n\n```js\ntodo.on(\"name\", () => {\n input.value = todo.name;\n});\ninput.addEventListener(\"change\", () => {\n todo.name = input.value;\n});\n```\n\n
\n\n```js\n\n```\n\n\n\n```js\ninput.onchange = todo.method;\n```\n\n
\n\n```js\n\n```\n\n\n\n```js\nbutton.addEventListener(\"click\", () => {\n todo.priority = 1;\n});\n```\n\n
\n\n```js\n
\n\n\n\n```\n\n
\n\n```js\ntodo.on(\"name\", () => {\n\tthis.shake(div);\n});\n```\n\n
\n
\n\n```html\n\n\n\n```\n\n
\n
\n\n## Custom Element Bindings\n\nSimilar to the bindings on normal elements in the previous section — you can\nlisten to events on custom elements, read, write or cross-bind an element’s properties with [can-stache-bindings].\n\nThe following shows examples of passing data to and from\nthe `` element in the [api#CustomElementBasics Custom Elements Basics]\nsection:\n\n```html\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n```\n\n
\n\n```html\n\n\n\n\n```\n\n
\n
\n\nYou can also pass data to custom elements directly in html using [can-observable-bindings/fromAttribute]:\n\n```html\n\n\n```\n\n
\n\n```html\n\n\n\n\n```\n\n
\n
\n\nPass [can-stache.tags.named-partial can-stache renderers] to custom elements to customize layout:\n\n```js\n{{< incrementButton }}\n\t\n{{/ incrementButton }}\n\n{{< countDisplay }}\n\tYou have counted to {{ this.count }}!\n{{/ countDisplay }}\n\n\n```\n\nUse [can-stache/expressions/call call expressions] to call the passed renderer or the \n[can-observable-object/define/default default renderers] if one was not provided.\n\n```js\nimport { StacheElement } from \"can\";\n\nclass MyCounter extends StacheElement {\n\tstatic view = `\n\t\t{{ incrementButton(this) }}\n\t\t{{ countDisplay(this) }}\n\t`;\n\tstatic props = {\n\t\tincrementButton() {\n\t\t\treturn ``;\n\t\t},\n\t\tcountDisplay() {\n\t\t\treturn `{{ this.count }}`;\n\t\t},\n\t\tcount: 0,\n\t\tadd(increment) {\n\t\t\tthis.count += increment;\n\t\t}\n\t};\n}\ncustomElement.define(\"my-counter\", MyCounter);\n```\n\n
\n\n```html\n\n\n\n\n```\n\n
\n
\n\n\n## Data Modeling\n\nConnect data types to a restful service with [can-rest-model]:\n\n```js\nimport { restModel } from \"can\";\nimport Todo from \"//canjs.com/demos/api/todo.mjs\";\nimport TodoList from \"//canjs.com/demos/api/todo-list.mjs\";\n\nconst todoConnection = restModel({\n ObjectType: Todo,\n ArrayType: TodoList,\n url: \"/api/todos/{id}\"\n});\n```\n
\n\nRetrieve, create, update and destroy data programmatically:\n\n\n\n \n \n \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
JavaScript APIRequestResponse
\n\n```js\nTodo.getList({\n // Selects only the todos that match\n filter: {\n complete: { $in: [false, null] }\n },\n // Sort the results of the selection\n sort: \"-name\",\n // Paginate the sorted result\n page: { start: 0, end: 19 }\n}) //-> Promise\n```\n\n\n\n```\nGET /api/todos?\n filter[complete][$in][]=false&\n filter[complete][$in][]=null&\n sort=-name&\n page[start]=0&\n page[end]=19\n\n\n\n\n\n```\n\n\n\n```js\n{\n \"data\": [\n {\n \"id\": 20,\n \"name\": \"mow lawn\",\n \"complete\": false\n },\n // ...\n ]\n}\n```\n\n
\n\n```js\nTodo.get({\n id: 5\n}) //-> Promise\n\n\n\n```\n\n\n\n```\nGET /api/todos/5\n\n\n\n\n\n```\n\n\n\n```js\n{\n \"id\": 5,\n \"name\": \"do dishes\",\n \"complete\": true\n}\n```\n\n
\n\n```js\nconst todo = new Todo({\n name: \"make a model\"\n})\ntodo.save() //-> Promise\n\n\n```\n\n\n\n```\nPOST /api/todos\n {\n \"name\": \"make a model\",\n \"complete\": false\n }\n```\n\n\n\n```js\n{\n \"id\": 22,\n \"name\": \"make a model\",\n \"complete\": false\n}\n```\n\n
\n\n```js\ntodo.complete = true;\ntodo.save() //-> Promise\n\n\n\n\n```\n\n\n\n```\nPUT /api/todos/22\n {\n \"name\": \"make a model\",\n \"complete\": true\n }\n```\n\n\n\n```js\n{\n \"id\": 22,\n \"name\": \"make a model\",\n \"complete\": true\n}\n```\n\n
\n\n```js\ntodo.destroy() //-> Promise\n\n\n```\n\n\n\n```\nDELETE /api/todos/22\n\n\n```\n\n\n\n```\nSuccessful status code (2xx).\nResponse body is not necessary.\n```\n\n
\n\n\n\n\nCheck the status of request:\n\n```js\nconst todo = new Todo({ name: \"make a model\"});\n\n// Return if the todo hasn't been persisted\ntodo.isNew() //-> true\n\n// Listen to when any todo is created:\nTodo.on(\"created\", (ev, todo) => {});\n\nlet savedPromise = todo.save();\n\n// Return if the todo is being created or updated\ntodo.isSaving() //-> true\n\nsavedPromise.then(() => {\n todo.isNew() //-> false\n todo.isSaving() //-> false\n\n let destroyedPromise = todo.destroy();\n\n // Return if the todo is being destroyed\n todo.isDestroying() //-> true\n\n destroyedPromise.then(() => {\n todo.isDestroying() //-> false\n })\n});\n```\n\n\nConnect data types to a restful service and have CanJS automatically manage\nadding and removing items from lists with [can-realtime-rest-model]:\n\n```js\nimport { realtimeRestModel } from \"can\";\n\n// Define a real time restful model\nconst todoConnection = realtimeRestModel({\n ObjectType: Todo,\n ArrayType: Todo.List,\n url: \"/api/todos/{id}\"\n});\n\n// Update instances and lists from server-side events:\nvar loc = window.location;\nconst socket = new WebSocket('ws://'+loc.host+loc.pathname+\"/ws\");\n\nsocket.addEventListener(\"todo-created\",(event) => {\n todoConnection.createInstance( JSON.parse(event.data) );\n});\n\nsocket.addEventListener(\"todo-updated\",(event) => {\n todoConnection.updateInstance( JSON.parse(event.data) );\n});\n\nsocket.addEventListener(\"todo-removed\",(event) => {\n todoConnection.destroyInstance( JSON.parse(event.data) );\n});\n```\n\nSimulate a service layer where you can create, retrieve, update and delete (CRUD)\nrecords:\n\n```js\nimport { fixture } from \"can\";\n\nlet todosStore = fixture.store([\n { id: 0, name: \"use fixtures\", complete: false }\n], Todo);\n\nfixture(\"/api/todos/{id}\", todosStore);\n```\n\n## Routing\n\nDefine routing rules and initialize routing with [can-route]:\n\n```js\nimport { route } from \"can\";\n\n// Create two-way routing rule:\nroute.register(\"{page}\", { page: \"home\" });\n\n// Define routing data type\nclass RouteData extends ObservableObject {\n\tstatic props = {\n\t\tpage: String\n\t};\n}\n\n// Connect routing system to an instance\n// of the routing data type\nroute.data = new RouteData();\n// begin routing\nroute.start();\n\n\n// Provide access to the route data to your application component\nclass MyApp extends StacheElement {\n\tstatic view = '';\n\n\tstatic props = {\n\t\trouteData: {\n\t\t\tget default() {\n\t\t\t\treturn route.data;\n\t\t\t}\n\t\t}\n\t};\n}\n```\n\nCreate responsive links in [can-stache] views with [can-stache-route-helpers]:\n\n\n```html\nTodos\n\n```\n\n\n## Utilities\n\nMake AJAX requests with [can-ajax]:\n\n```js\nimport { ajax } from \"can-ajax\";\n\najax({\n url: \"http://query.yahooapis.com/v1/public/yql\",\n data: {\n format: \"json\",\n q: 'select * from geo.places where text=\"sunnyvale, ca\"'\n }\n}) //-> Promise\n````\n\nPerform differences with [can-diff]:\n\n```js\ndiff.list([\"a\",\"b\"], [\"a\",\"c\"])\n//-> [{ type: \"splice\", index: 1, deleteCount: 1, insert: [\"c\"] }]\n\ndiff.map({ a: \"a\" },{ a: \"A\" })\n//-> [{ type: \"set\", key: \"a\", value: \"A\" }]\n```\n\nRead and store the results of [feature detection](https://developer.mozilla.org/en-US/docs/Learn/Tools_and_testing/Cross_browser_testing/Feature_detection) with [can-globals]:\n\n```js\nimport { globals } from \"can\";\n\nglobals.getKeyValue(\"isNode\") //-> false\nglobals.getKeyValue(\"isBrowserWindow\") //-> true\nglobals.getKeyValue(\"MutationObserver\") //-> MutationObserver\n```\n\nRead and write nested values with [can-key]:\n\n```js\nimport { key } from \"can\";\n\nconst task = {\n name: \"learn can-key\",\n owner: { name: { first: \"Justin\", last: \"Meyer\" } }\n}\n\nkey.delete(task, \"owner.name.first\");\nkey.get(task, \"owner.name.last\") //-> \"Meyer\"\nkey.set(task, \"owner.name.first\", \"Bohdi\");\n```\n\nParse a URI into its parts with [can-parse-uri]:\n\n```js\nimport { parseURI } from \"can\";\n\nparseURI(\"http://foo:8080/bar.html?query#change\")\n//-> {\n// authority: \"//foo:8080\",\n// hash: \"#change\",\n// host: \"foo:8080\",\n// hostname: \"foo\",\n// href: \"http://foo:8080/bar.html?query#change\",\n// pathname: \"/bar.html\",\n// port: \"8080\",\n// protocol: \"http:\",\n// search: \"?query\"\n// }\n```\n\nConvert a string into another primitive type with [can-string-to-any]:\n\n```js\nimport { stringToAny } from \"can\";\nstringToAny( \"NaN\" ); // -> NaN\nstringToAny( \"44.4\" ); // -> 44.4\nstringToAny( \"false\" ); // -> false\n```\n\nConvert one string format to another string format with [can-string]:\n\n```js\nimport { string } from \"can\";\n\nstring.camelize(\"foo-bar\")) //-> \"fooBar\"\nstring.capitalize(\"foo\") //-> \"Foo\"\nstring.esc(\"
foo
\")//-> \"<div>foo</div>\"\nstring.hyphenate(\"fooBar\") //-> \"foo-bar\"\nstring.underscore(\"fooBar\") //-> \"foo_bar\"\n```\n\nOperate on any data type with [can-reflect]:\n\n```js\nimport { Reflect } from \"can\";\n\n// Test the type:\nReflect.isBuiltIn(new Date()) //-> true\nReflect.isBuiltIn(new Todo()) //-> false\nReflect.isConstructorLike(function(){}) //-> false\nReflect.isConstructorLike(Date) //-> true\nReflect.isListLike([]) //-> true\nReflect.isListLike({}) //-> false\nReflect.isMapLike([]) //-> true\nReflect.isMapLike({}) //-> true\nReflect.isMoreListLikeThanMapLike([]) //-> true\nReflect.isMoreListLikeThanMapLike({}) //-> false\nReflect.isObservableLike(new Todo()) //-> true\nReflect.isObservableLike({}) //-> false\nReflect.isPlainObject({}) //-> true\nReflect.isPlainObject(new Todo()) //-> false\nReflect.isPromiseLike(Promise.resolve()) //-> true\nReflect.isPromiseLike({}) //-> false\nReflect.isValueLike(22) //-> true\nReflect.isValueLike({}) //-> false\n\n// Read and mutate key-value data\nconst obj = {};\nReflect.setKeyValue(obj,\"prop\",\"VALUE\");\nReflect.getKeyValue(obj,\"prop\") //-> \"VALUE\"\nReflect.deleteKeyValue(obj,\"prop\",\"VALUE\");\n\nReflect.assign(obj, { name: \"Payal\" });\n```\n\nCreate types that work with [can-reflect.convert] using [can-type]:\n\n```js\nimport { Reflect, type } from \"can\";\n\nconst MaybeNumber = type.maybe(Number);\n\nReflect.convert(42, MaybeNumber); // -> 42\nReflect.convert(null, MaybeNumber); // -> null\nReflect.convert(undefined, MaybeNumber); // -> undefined\nReflect.convert(\"hello world\", MaybeNumber); // throws!\n\nconst ConvertString = type.convert(String);\n\nReflect.convert(42, ConvertString); // -> \"42\"\nReflect.convert(null, ConvertString); // -> \"null\"\nReflect.convert(undefined, ConvertString); // -> \"undefined\"\nReflect.convert(\"hello world\", ConvertString); // -> \"hello world\"\n\nconst MaybeConvertBoolean = type.maybeConvert(Boolean);\n\nReflect.convert(\"false\", MaybeConvertBoolean); // -> false\nReflect.convert(null, MaybeConvertBoolean); // -> null\nReflect.convert(undefined, MaybeConvertBoolean); // -> undefined\nReflect.convert(\"hello world\", MaybeConvertBoolean); // -> true\n\nconst StrictNumber = type.check(Number);\n\nReflect.convert(42, StrictNumber); // -> 42\nReflect.convert(null, StrictNumber); // throws!\nReflect.convert(undefined, StrictNumber); // throws!\nReflect.convert(\"hello world\", StrictNumber); // throws!\n```\n\n", + "description": "Welcome to the CanJS API documentation! This page is a CHEAT-SHEET for the most common APIs within CanJS. Read the\n[guides/technology-overview] page for background on the following APIs.\n\n", + "name": "api", + "title": "API Docs", "type": "page", "parent": "canjs", - "order": 0, - "comment": " " + "order": 2, + "outline": { + "depth": 1 + }, + "package": { + "name": "can", + "version": "6.5.0", + "main": "can.js", + "scripts": { + "preversion": "npm test", + "version": "git commit -am \"Update dist for release\" && git checkout -b release && git add -f dist/", + "postversion": "git push --tags && git checkout - && git branch -D release && git push", + "testee": "testee test/index.html --browsers firefox", + "testee-builders": "testee test/builders/test.html --browsers firefox", + "testee-production": "testee test/production.html --browsers firefox", + "testee-global-build": "testee test/global-build.html --browsers firefox", + "http-server": "http-server -p 3000 --silent", + "test": "npm run test-development && npm run test-production && npm run test-builders && npm run test-global-build", + "test-builders": "npm run build-webpack-test && npm run testee-builders", + "test-development": "npm run testee", + "test-global-build": "npm run build && bundlesize && npm run testee-global-build", + "test-local": "npm run build && npm run testee", + "test-production": "npm run build-tests && npm run testee-production", + "test-sauce-labs": "node test/test-sauce-labs.js", + "release:pre": "npm version prerelease && npm run build && npm publish --tag=pre", + "release:patch": "npm version patch && npm run build && npm publish", + "release:minor": "npm version minor && npm run build && npm publish", + "release:major": "npm version major && npm run build && npm publish", + "build": "node build.js", + "build-tests": "node test/build.js", + "build-webpack-test": "webpack --mode=production -o test/builders/webpack/bundle.js test/builders/webpack/index.js", + "document": "./pre-document.sh && npm run deps-bundle && bit-docs", + "document:force": "./pre-document.sh && npm run deps-bundle && bit-docs -fd", + "deps-bundle": "node build-dev-bundle" + }, + "title": "CanJS", + "description": "MIT-licensed, client-side, JavaScript framework that makes building rich web applications easy.", + "keywords": [ + "CanJS", + "DoneJS" + ], + "author": { + "name": "Bitovi", + "email": "contact@bitovi.com", + "web": "http://bitovi.com/" + }, + "homepage": "http://canjs.com/", + "repository": { + "type": "git", + "url": "git@github.com:canjs/canjs.git", + "github": "https://github.com/canjs/canjs" + }, + "dependencies": { + "can-ajax": "2.4.6", + "can-assign": "1.3.3", + "can-attribute-encoder": "1.1.4", + "can-attribute-observable": "2.0.2", + "can-bind": "1.5.1", + "can-child-nodes": "1.2.1", + "can-cid": "1.3.1", + "can-component": "5.0.0", + "can-compute": "4.1.1", + "can-connect": "4.0.2", + "can-connect-ndjson": "2.0.0", + "can-connect-tag": "2.0.0", + "can-construct": "3.5.6", + "can-construct-super": "3.2.1", + "can-control": "5.0.1", + "can-data-types": "1.2.1", + "can-debug": "2.0.7", + "can-deep-observable": "1.0.2", + "can-define": "2.8.0", + "can-define-backup": "2.1.2", + "can-define-lazy-value": "1.1.1", + "can-define-realtime-rest-model": "2.0.0", + "can-define-rest-model": "2.0.0", + "can-define-stream": "1.1.1", + "can-define-stream-kefir": "1.1.1", + "can-deparam": "1.2.2", + "can-diff": "1.5.0", + "can-dom-data": "1.0.3", + "can-dom-data-state": "1.1.2", + "can-dom-events": "1.3.11", + "can-dom-mutate": "2.0.8", + "can-event-dom-enter": "2.2.1", + "can-event-dom-radiochange": "2.2.1", + "can-event-queue": "1.1.8", + "can-fixture": "3.1.7", + "can-fixture-socket": "2.0.3", + "can-fragment": "1.3.1", + "can-globals": "1.2.2", + "can-kefir": "1.1.4", + "can-key": "1.2.1", + "can-key-tree": "1.2.2", + "can-list": "4.2.2", + "can-local-store": "1.0.1", + "can-log": "1.0.2", + "can-make-map": "1.2.2", + "can-map": "4.3.12", + "can-map-compat": "1.1.1", + "can-map-define": "4.4.0", + "can-memory-store": "1.0.3", + "can-namespace": "1.0.0", + "can-ndjson-stream": "1.0.2", + "can-observable-array": "1.1.4", + "can-observable-bindings": "1.3.3", + "can-observable-mixin": "1.0.10", + "can-observable-object": "1.1.4", + "can-observation": "4.2.0", + "can-observation-recorder": "1.3.1", + "can-observe": "2.3.2", + "can-param": "1.1.2", + "can-parse-uri": "1.2.2", + "can-query-logic": "1.2.2", + "can-queues": "1.3.2", + "can-realtime-rest-model": "2.0.0", + "can-reflect": "1.18.0", + "can-reflect-dependencies": "1.1.2", + "can-reflect-promise": "2.2.1", + "can-rest-model": "2.0.0", + "can-route": "5.0.2", + "can-route-hash": "1.0.2", + "can-route-mock": "1.0.2", + "can-route-pushstate": "6.0.0", + "can-set-legacy": "1.0.1", + "can-simple-dom": "1.7.1", + "can-simple-map": "4.3.3", + "can-simple-observable": "2.5.0", + "can-stache": "5.1.1", + "can-stache-bindings": "5.0.4", + "can-stache-converters": "5.0.0", + "can-stache-element": "1.2.0", + "can-stache-key": "1.4.3", + "can-stache-route-helpers": "2.0.0", + "can-stream": "1.1.1", + "can-stream-kefir": "1.2.1", + "can-string": "1.1.0", + "can-string-to-any": "1.2.1", + "can-super-model": "2.0.0", + "can-symbol": "1.6.5", + "can-type": "1.1.4", + "can-validate": "1.2.1", + "can-validate-interface": "1.0.3", + "can-validate-legacy": "2.0.1", + "can-validate-validatejs": "1.0.1", + "can-value": "1.1.2", + "can-vdom": "4.4.2", + "can-view-autorender": "6.0.0", + "can-view-callbacks": "5.0.0", + "can-view-live": "5.0.4", + "can-view-model": "4.0.3", + "can-view-parser": "4.1.3", + "can-view-scope": "4.13.6", + "can-view-target": "5.0.0", + "steal-stache": "5.0.0" + }, + "devDependencies": { + "@feathersjs/feathers": "^3.3.1", + "@feathersjs/socketio-client": "^1.2.1", + "@octokit/rest": "^16.27.3", + "@webcomponents/custom-elements": "^1.2.4", + "bit-docs": "^0.2.0", + "bundlesize": "^0.18.0", + "can-reflect-tests": "^1.0.0", + "can-test-helpers": "^1.1.1", + "core-js": "^2.5.7", + "es6-promise-polyfill": "^1.2.0", + "funcunit": "^3.4.2", + "gzip-size": "^4.1.0", + "http-server": "^0.11.1", + "jquery": "2.x - 3.x", + "jquery-ui": "^1.12.0", + "kefir": "^3.8.0", + "minimist": "^1.2.5", + "prop-types": "^15.5.10", + "qunit": "^2.9.2", + "semver": "^6.1.1", + "socket.io-client": "^2.2.0", + "steal": "^2.2.4", + "steal-conditional": "^1.1.3", + "steal-css": "^1.2.4", + "steal-qunit": "^2.0.0", + "steal-socket.io": "^4.0.9", + "steal-tools": "^2.2.5", + "test-saucelabs": "0.0.6", + "testee": "^0.9.0", + "version-and-release": "^0.1.1", + "webpack": "^4.12.0", + "webpack-cli": "^3.0.7" + }, + "demos": [ + "http://canjs.us/#examples", + "http://canjs.us/recipes" + ], + "googleAnalyticsTrackingCode": "UA-2302003-11", + "licenses": [ + { + "type": "MIT", + "url": "http://opensource.org/licenses/mit-license.php" + } + ], + "sideEffects": false, + "steal": { + "npmAlgorithm": "flat", + "main": "can", + "npmIgnore": [ + "bit-docs", + "testee", + "async", + "saucelabs", + "test-saucelabs", + "wd", + "http-server" + ], + "meta": { + "socket.io-client/dist/socket.io": { + "format": "cjs" + } + }, + "configDependencies": [ + "./node_modules/steal-conditional/conditional.js" + ], + "plugins": [ + "steal-stache" + ] + }, + "bit-docs": { + "html": { + "dependencies": { + "normalize.css": "^5.0.0", + "steal-conditional": "^0.3.6", + "steal-stache": "^4.0.1" + }, + "package": { + "steal": { + "configDependencies": [ + "./node_modules/steal-conditional/conditional" + ] + } + }, + "static": [], + "templates": [] + }, + "dependencies": { + "bit-docs-glob-finder": "^0.0.5", + "bit-docs-dev": "^0.0.3", + "bit-docs-js": "^0.0.6", + "bit-docs-tag-sourceref": "^0.0.3", + "bit-docs-generate-html": "^0.11.0", + "bit-docs-generate-searchmap": "^0.2.0", + "bit-docs-html-canjs": "3.0.0-pre.6", + "bit-docs-prettify": "^0.3.0", + "bit-docs-html-highlight-line": "^0.5.3", + "bit-docs-tag-demo": "^0.5.3", + "bit-docs-tag-package": "^1.0.0", + "bit-docs-html-codepen-link": "^2.0.3", + "bit-docs-html-toc": "^1.1.1" + }, + "glob": { + "pattern": "{node_modules,docs}/{can-*,steal-stache}/**/*.{js,md}", + "ignore": [ + "node_modules/can-namespace/**/*", + "node_modules/can-wait/examples/**/*", + "node_modules/can-*/dist/**/*", + "node_modules/*/node_modules/**/*", + "node_modules/can-debug/src/draw-graph/vis.js" + ] + }, + "altVersions": { + "5.33.3": "https://v5.canjs.com", + "4.3.0": "https://v4.canjs.com", + "3.14.1": "https://v3.canjs.com", + "2.3.35": "https://v2.canjs.com" + }, + "parent": "canjs", + "minifyBuild": true, + "codepen": [ + [ + "\"can\"", + "\"//unpkg.com/can@6/core.mjs\"" + ], + [ + "\"can/ecosystem\"", + "\"//unpkg.com/can@6/ecosystem.mjs\"" + ], + [ + "\"can/everything\"", + "\"//unpkg.com/can@6/everything.mjs\"" + ], + [ + "\"can/demos/technology-overview/mock-url\"", + "\"//unpkg.com/mock-url@^6.0.0/mock-url.mjs\"" + ], + [ + "\"can/demos/technology-overview/route-mini-app-components\"", + "\"//unpkg.com/route-mini-app@^5.0.0/components.mjs\"" + ], + [ + "return steal.import(", + "return import(" + ], + [ + "\"can/demos/technology-overview/page-login\"", + "\"//unpkg.com/route-mini-app@^5.0.0/page-login.mjs\"" + ], + [ + "`can/demos/technology-overview/page-${this.page}`", + "`//unpkg.com/route-mini-app@^5.0.0/page-${this.page}.mjs`" + ] + ] + }, + "bundlesize": [ + { + "path": "./core.min.mjs", + "maxSize": "106 kB" + }, + { + "path": "./core.mjs", + "maxSize": "314 kB" + }, + { + "path": "./dist/global/core.js", + "maxSize": "200 kB" + } + ] + }, + "templateRender": [ + "<%", + "%>" + ], + "subchildren": true, + "comment": " ", + "codepen": [ + [ + "\"can\"", + "\"//unpkg.com/can@6/core.mjs\"" + ], + [ + "\"can/ecosystem\"", + "\"//unpkg.com/can@6/ecosystem.mjs\"" + ], + [ + "\"can/everything\"", + "\"//unpkg.com/can@6/everything.mjs\"" + ], + [ + "\"can/demos/technology-overview/mock-url\"", + "\"//unpkg.com/mock-url@^6.0.0/mock-url.mjs\"" + ], + [ + "\"can/demos/technology-overview/route-mini-app-components\"", + "\"//unpkg.com/route-mini-app@^5.0.0/components.mjs\"" + ], + [ + "return steal.import(", + "return import(" + ], + [ + "\"can/demos/technology-overview/page-login\"", + "\"//unpkg.com/route-mini-app@^5.0.0/page-login.mjs\"" + ], + [ + "`can/demos/technology-overview/page-${this.page}`", + "`//unpkg.com/route-mini-app@^5.0.0/page-${this.page}.mjs`" + ] + ] }, "can-ecosystem": { "src": { @@ -157,18 +591,103 @@ "order": 12, "comment": " " }, - "can-legacy": { + "can-core": { "src": { - "path": "docs/can-canjs/can-legacy.md" + "path": "docs/can-canjs/can-core.md" }, - "body": "\n", - "description": "Former libraries that we still accept patches for, but are not under active development.\n\n", - "name": "can-legacy", - "title": "Legacy", + "body": "\n## Use\n\nCanJS’s core libraries are the best, most hardened and generally useful modules.\nEach module is part of an independent package, so you\nshould install the ones you use directly:\n\n```\nnpm install can-value can-stache-element can-realtime-rest-model can-observable-object can-observable-array can-route can-route-pushstate --save\n```\n\n\nLet’s explore each module a bit more.\n\n## can-value\n\n[can-value]s represent an observable value. A value can contain its\nown value and notify listeners of changes like:\n\n```js\nimport { value } from \"can\";\n\nlet name = value.with(\"Justin\");\n\n// read the value\nconsole.log(name.value); //-> \"Justin\"\n\nname.on((newVal, oldVal) => {\n console.log(newVal); //-> \"Matthew\"\n console.log(oldVal); //-> \"Justin\"\n});\n\nname.value = \"Matthew\";\n```\n
\n\nMore commonly, a value derives its value from other observables. The following\n`info` compute derives its value from a `person` object, `hobbies` array, and `age`\nvalue:\n\n```js\nimport { ObservableObject, ObservableArray, value } from \"can\";\n\nlet person = new ObservableObject({ first: \"Justin\", last: \"Meyer\" }),\n hobbies = new ObservableArray([\"js\", \"bball\"]),\n age = value.with(33);\n\nlet info = value.returnedBy(function(){\n return person.first +\" \"+ person.last + \" is \" + age.value +\n \"and likes \" + hobbies.join(\", \") + \".\";\n});\n\nconsole.log(info.value); //-> \"Justin Meyer is 33 and likes js, bball.\"\n\ninfo.on((newVal) => {\n console.log(newVal); //-> \"Justin Meyer is 33 and likes js.\"\n});\n\nhobbies.pop();\n```\n
\n\n\n## can-observable-object and can-observable-array\n\n[can-observable-object] and [can-observable-array] allow you to create observable\nobjects and arrays with well-defined properties. You can\n[can-observable-object/object.types.definitionObject define a property’s type initial value, enumerability, getter-setters and much more].\nFor example, you can define the behavior of a `Todo` type and a `TodoArray` type as follows:\n\n```js\nimport { ObservableObject, ObservableArray, type } from \"can\";\n\nclass Todo extends ObservableObject {\n static props = {\n // A todo has a:\n // .name that’s a string\n name: String,\n\n complete: { // .complete that’s\n type: Boolean, // a boolean\n default: false // initialized to false\n },\n\n // .dueDate that’s a date\n dueDate: Date,\n\n get isPastDue(){ // .pastDue that returns if the\n return new Date() > this.dueDate; // dueDate is before now\n }\n };\n\n toggleComplete() { // .toggleComplete method that\n this.complete = !this.complete; // changes .complete\n }\n}\n\nclass TodoArray extends ObservableArray {\n static props = {\n get completeCount(){ // has .completeCount\n return this.filter( // that returns\n (todo) => todo.complete // # of\n ) // complete todos\n .length;\n }\n };\n\n static items = type.convert(Todo); // has numeric properties\n // as todos\n}\n```\n
\n\nThis allows you to create a Todo, read its properties, and\ncall its methods like:\n\n```js\nimport { ObservableObject } from \"can\";\n\nclass Todo extends ObservableObject {\n static props = {\n // A todo has a:\n // .name that’s a string\n name: String,\n\n complete: { // .complete that’s\n type: Boolean, // a boolean\n default: false // initialized to false\n },\n\n // .dueDate that’s a date\n dueDate: Date,\n\n get isPastDue(){ // .pastDue that returns if the\n return new Date() > this.dueDate; // dueDate is before now\n }\n };\n\n toggleComplete() { // .toggleComplete method that\n this.complete = !this.complete; // changes .complete\n }\n}\nconst dishes = new Todo({\n\tname: \"do dishes\",\n\t// due yesterday\n\tdueDate: new Date(new Date() - 1000 * 60 * 60 * 24)\n});\nconsole.log(dishes.name); //-> \"do dishes\"\nconsole.log(dishes.isPastDue); //-> true\nconsole.log(dishes.complete); //-> false\ndishes.toggleComplete();\nconsole.log(dishes.complete); //-> true\n```\n
\n
\n\nAnd it allows you to create a `TodoArray`, access its items and properties\nlike:\n\n```js\nimport { ObservableObject, ObservableArray, type } from \"can\";\n\nclass Todo extends ObservableObject {\n static props = {\n // A todo has a:\n // .name that’s a string\n name: String,\n\n complete: { // .complete that’s\n type: Boolean, // a boolean\n default: false // initialized to false\n },\n\n // .dueDate that’s a date\n dueDate: Date,\n\n get isPastDue(){ // .pastDue that returns if the\n return new Date() > this.dueDate; // dueDate is before now\n }\n };\n\n toggleComplete() { // .toggleComplete method that\n this.complete = !this.complete; // changes .complete\n }\n}\n\nclass TodoArray extends ObservableArray {\n static props = {\n get completeCount(){ // has .completeCount\n return this.filter( // that returns\n (todo) => todo.complete // # of\n ) // complete todos\n .length;\n }\n };\n\n static items = type.convert(Todo); // has numeric properties\n // as todos\n}\nconst dishes = new Todo({\n\tname: \"do dishes\",\n\t// due yesterday\n\tdueDate: new Date(new Date() - 1000 * 60 * 60 * 24)\n});\ndishes.toggleComplete();\nconst todos = new TodoArray([dishes, { name: \"mow lawn\", dueDate: new Date() }]);\nconsole.log(todos.length); //-> 2\nconsole.log(todos[0].complete); //-> true\nconsole.log(todos.completeCount); //-> 1\n```\n
\n
\n\nThese observables provide the foundation\nfor data connection (models), component properties and even routing in your application.\n\n## can-set\n\n[can-set] models a service layer’s behavior as a [can-set.Algebra set.Algebra]. Once modeled, other libraries such as [can-connect] or [can-fixture] can\nadd a host of functionality like: real-time behavior, performance optimizations, and\nsimulated service layers.\n\nA `todosAlgebra` set algebra for a `GET /api/todos` service might look like:\n\n```js\nimport set from \"can-set\";\nlet todosAlgebra = new set.Algebra(\n // specify the unique identifier property on data\n set.prop.id(\"_id\"),\n // specify that completed can be true, false or undefined\n set.prop.boolean(\"complete\"),\n // specify the property that controls sorting\n set.prop.sort(\"orderBy\")\n)\n```\n\nThis assumes that the service:\n\n - Returns data where the unique property name is `_id`:\n ```js\n GET /api/todos\n -> [{_id: 1, name: \"mow lawn\", complete: true},\n {_id: 2, name: \"do dishes\", complete: false}, ...]\n ```\n - Can filter by a `complete` property:\n ```js\n GET /api/todos?complete=false\n -> [{_id: 2, name: \"do dishes\", complete: false}, ...]\n ```\n - Sorts by an `orderBy` property:\n ```js\n GET /api/todos?orderBy=name\n -> [{_id: 2, name: \"do dishes\", complete: false},\n {_id: 1, name: \"mow lawn\", complete: true}]\n ```\n\nIn the next section will use `todoAlgebra` to build a model with [can-connect].\n\n## can-connect\n\n[can-connect] connects a data type, typically an `ObservableObject` and associated `ObservableArray`,\nto a service layer. This is often done via the\n[can-rest-model] module which bundles many common behaviors\ninto a single api:\n\n```js\nimport { ObservableObject, ObservableArray, restModel } from \"can\";\n\nclass Todo extends ObservableObject {\n static props = {\n // ...\n };\n}\n\nclass TodoArray extends ObservableObject {\n static props = {\n // ...\n };\n\n static items = Todo;\n}\n\nconst connection = restModel({\n\turl: \"/api/todos\",\n\tObjectType: Todo,\n\tArrayType: TodoArray\n});\n```\n
\n\n`baseMap` extends the Object type, in this case, `Todo`, with\nthe ability to make requests to the service layer.\n\n - [can-connect/can/map/map.getList Get a list] of Todos\n ```js\n Todo.getList({ complete: true }).then((todos) => {});\n ```\n - [can-connect/can/map/map.get Get] a single Todo\n ```js\n Todo.get({ _id: 6 }).then((todo) => {});\n ```\n - [can-connect/can/map/map.prototype.save Create] a Todo\n ```js\n const todo = new Todo({ name: \"do dishes\", complete: false });\n todo.save().then((todo) => {});\n ```\n - [can-connect/can/map/map.prototype.save Update] an [can-connect/can/map/map.prototype.isNew already created] Todo\n ```js\n todo.complete = true;\n todo.save().then((todo) => {});\n ```\n - [can-connect/can/map/map.prototype.destroy Delete] a Todo\n ```js\n todo.destroy().then((todo) => {});\n ```\n\n## can-stache\n\n[can-stache] provides live binding mustache and handlebars syntax. While\ntemplates should typically be loaded with a module loader like [steal-stache],\nyou can create a template programmatically that lists out todos within a\npromise loaded from `Todo.getList` like:\n\n```js\nimport { stache, ObservableObject, ObservableArray, restModel } from \"can\";\n\nclass Todo extends ObservableObject {\n static props = {\n // ...\n };\n}\n\nclass TodoArray extends ObservableObject {\n static props = {\n // ...\n };\n\n static items = Todo;\n}\n\nconst connection = restModel({\n\turl: \"/api/todos\",\n\tObjectType: Todo,\n\tArrayType: TodoArray\n});\n\n// Creates a template\nlet template = stache(`\n\t
    \n\t\t{{# if(this.todos.isPending) }}
  • Loading…
  • {{/ if }}\n\t\t{{# if(this.todos.isResolved) }}\n\t\t\t{{# for(todo of this.todos.value) }}\n\t\t\t\t
  • {{ todo.name }}
  • \n\t\t\t{{else}}\n\t\t\t\t
  • No todos
  • \n\t\t\t{{/for}}\n\t\t{{/if}}\n\t
\n`);\n\n// Calls the template with some data\nlet fragment = template({\n\ttodos: Todo.getList({})\n});\n\n// Inserts the result into the page\ndocument.body.appendChild(fragment);\n```\n
\n
\n\n[can-stache] templates use magic tags like `{{}}` to control what\ncontent is rendered. The most common forms of those magic tags are:\n\n - [can-stache.tags.escaped {{key}}] - Insert the value at `key` in the page. If `key` is a function or helper, run it and insert the result.\n - [can-stache.tags.section {{#key}}...{{/key}}] - Render the content between magic tags based on some criteria.\n\n[can-stache] templates return document fragments that update whenever\ntheir source data changes.\n\n## can-stache-element\n\n[can-stache-element] creates custom elements with unit-testable properties. It\ncombines a view model created by [can-observable-object] with a template\ncreated by [can-stache].\n\n```html\n\n\n\n```\n
\n
\n\n## can-stache-bindings\n\n[can-stache-bindings] provides [can-view-callbacks.attr custom attributes] for\n[can-stache] event and data bindings.\n\nBindings look like:\n\n - `on:event=\"key()\"` for [can-stache-bindings.event event binding].\n - `prop:from=\"key\"` for [can-stache-bindings.toChild one-way binding to a child].\n - `prop:to=\"key\"` for [can-stache-bindings.toParent one-way binding to a parent].\n - `prop:bind=\"key\"` for [can-stache-bindings.twoWay two-way binding].\n\n[can-stache-bindings.event Event] binding examples:\n\n```html\n\n
  • \n\n\n\n```\n\n[can-stache-bindings.toChild One-way to child] examples:\n\n```html\n\n\n\n\n\n```\n\n[can-stache-bindings.toChild One-way to parent] examples:\n\n```html\n\n\n\n\n\n```\n\n[can-stache-bindings.twoWay Two-way] examples:\n\n```html\n\n\n\n\n\n```\n\n## can-route and can-route-pushstate\n\n[can-route] connects an `ObservableObject`’s properties to values in the\nurl. Create an object type, [can-route.data connect it to the url], and [can-route.start begin routing] like:\n\n```js\nimport { ObservableObject, route } from \"can\";\n\nclass AppViewModel extends ObservableObject {\n static props = {\n // Sets the default type to string\n todoId: String,\n todo: {\n get: function(){\n if(this.todoId) {\n return Todo.get({_id: this.todoId})\n }\n }\n }\n };\n\n static items = String;\n}\n\nconst appViewModel = new AppViewModel();\nroute.data = appViewModel;\n\nroute.start();\n```\n
    \n\nWhen the url changes, to something like `#!&todoId=5`, so will the\n`appViewModel`’s `todoId` and `todo` property:\n\n```js\nappViewModel.todoId //-> \"5\"\nappViewModel.todo //-> Promise\n```\n\nSimilarly, if `appViewModel`’s `todoId` is set like:\n\n```js\nappViewModel.todoId = 6;\n```\n\nThe hash will be updated:\n\n```js\nwindow.location.hash //-> \"#!&todoId=6\"\n```\n\nThe [can-route.register route.register] function can be used to specify pretty routing rules that\ntranslate property changes to a url and a url to property changes. For example,\n\n```js\n// a route like:\nroute.register(\"todo/{todoId}\");\n\n// and a hash like:\nwindow.location.hash = \"#!todo/7\";\n\n// produces an appViewModel like:\nappViewModel.serialize() //-> {route: \"todo/{todoId}\", todoId: \"7\"}\n```\n\n[can-route-pushstate] adds [pushstate](https://developer.mozilla.org/en-US/docs/Web/API/History_API) support.\nTo use it, set [can-route.urlData route.urlData] to an instance of `RoutePushstate`:\n\n```js\nimport { route, RoutePushstate } from \"can\";\n\nroute.urlData = new RoutePushstate();\n```\n\n\n## Want to learn more?\n\nIf you haven’t already, check out the [guides] page on how to learn CanJS. Specifically, you’ll\nwant to check out the [guides/chat] and [guides/todomvc] to learn the basics of using CanJS’s\ncore libraries. After that, check out the [guides/api] on how to use and learn from these API docs.\n\n", + "description": "The best, most hardened and generally useful libraries in CanJS. \n", + "name": "can-core", + "title": "Core", "type": "page", "parent": "api", - "order": 13, - "comment": " " + "order": 10, + "templateRender": [ + "<%", + "%>" + ], + "comment": " ", + "codepen": [ + [ + "\"can\"", + "\"//unpkg.com/can@6/core.mjs\"" + ], + [ + "\"can/ecosystem\"", + "\"//unpkg.com/can@6/ecosystem.mjs\"" + ], + [ + "\"can/everything\"", + "\"//unpkg.com/can@6/everything.mjs\"" + ], + [ + "\"can/demos/technology-overview/mock-url\"", + "\"//unpkg.com/mock-url@^6.0.0/mock-url.mjs\"" + ], + [ + "\"can/demos/technology-overview/route-mini-app-components\"", + "\"//unpkg.com/route-mini-app@^5.0.0/components.mjs\"" + ], + [ + "return steal.import(", + "return import(" + ], + [ + "\"can/demos/technology-overview/page-login\"", + "\"//unpkg.com/route-mini-app@^5.0.0/page-login.mjs\"" + ], + [ + "`can/demos/technology-overview/page-${this.page}`", + "`//unpkg.com/route-mini-app@^5.0.0/page-${this.page}.mjs`" + ] + ] + }, + "can-infrastructure": { + "src": { + "path": "docs/can-canjs/can-infrastructure.md" + }, + "body": "\n## Use\n\nThe infrastructure collection of libraries are lower-level utility libraries that\nare used by the [can-core] and [can-ecosystem] collections. They can also\nbe used by applications directly.\n\nLet’s explore what’s available.\n\n## can-event-queue\n\n[can-event-queue/map/map] is a mixin that adds event dispatching and listening functionality\non your objects. The following shows creating a `Person` constructor function\nwhose instances can produce events that can be listened to.\n\n```js\nimport { mapEventBindings } from \"can\";\n\n// Create the Person type\nfunction Person(){ /* ... */ };\nPerson.prototype.method = function(){ /* ... */ };\n\n// Add event mixin:\nmapEventBindings(Person.prototype);\n\n// Create an instance\nconst me = new Person();\n\n// Now listen and dispatch events!\nme.addEventListener(\"name\", function(ev,data){ console.log(data) }); // -> {foo: \"Bar\"}\n\nme.dispatch(\"name\", [{foo: \"Bar\"}]);\n```\n
    \n\n## can-queues\n\nA light weight queue system for scheduling tasks, it runs tasks in one of the following queues:\n\n1. [can-queues.notifyQueue] - Tasks that notify \"deriving\" observables that a source value has changed.\n2. [can-queues.deriveQueue] - Tasks that update the value of a \"deriving\" observable.\n3. [can-queues.domUIQueue] - Tasks that update the DOM.\n4. [can-queues.mutateQueue] - Tasks that might cause other mutations that add tasks to one of the previous queues.\n\n```js\nimport { queues } from \"can\";\n\nqueues.batch.start();\nqueues.mutateQueue.enqueue( console.log, console, [ \"say hi\" ] );\nqueues.batch.stop();\n```\n
    \n\n## can-observation\n\n[can-observation] provides a mechanism to notify when an observable has been read and a way to observe those reads called within a given function. [can-observation] provides the foundation for [can-compute]’s abilities.\n\nUse [can-observation-recorder.add ObservationRecorder.add] to signal when an an observable value has been read.\nThe following makes the `Person` type’s `getName()` observable:\n\n```js\nimport { Observation, ObservationRecorder, mapEventBindings } from \"can\";\n\n// Create the Person type\nfunction Person(){};\n\n// Add event mixin:\nmapEventBindings(Person.prototype);\n\nPerson.prototype.setName = function(newName){\n\tlet oldName = this.name;\n\tthis.name = newName;\n\tthis.dispatch(\"name\", [newName, oldName]);\n};\nPerson.prototype.getName = function(){\n\tObservationRecorder.add(this, \"name\");\n\treturn this.name;\n};\n```\n\nThe `Observation` constructor can be used, similar to a [can-compute] to observe\na function’s return value by tracking calls to `Observation.add`\n\n```js\nimport { Observation, ObservationRecorder, mapEventBindings } from \"can\";\n\n// Create the Person type\nfunction Person(){};\n\n// Add event mixin:\nmapEventBindings(Person.prototype);\n\nPerson.prototype.setName = function(newName){\n\tlet oldName = this.name;\n\tthis.name = newName;\n\tthis.dispatch(\"name\", [newName, oldName]);\n};\nPerson.prototype.getName = function(){\n\tObservationRecorder.add(this, \"name\");\n\treturn this.name;\n};\n\nconst person = new Person();\nperson.setName(\"Justin\");\n\n\nconst greetingObservation = new Observation(function(){\n\treturn person.getName() + \" says hi!\";\n});\n\nObservationRecorder.start();\n\ngreetingObservation.on(function(newValue) {\n console.log(newValue);\n});\n\nconsole.log(greetingObservation.value); //-> \"Justin says hi!\"\n\nperson.setName(\"Matt\") //-> console.logs \"Matt says hi!\";\n```\n
    \n\n## Utilities\n\n### DOM Utilities\n\nThe DOM utilities consist of:\n\n - Node and Element helpers: [can-child-nodes], [can-dom-data], [can-fragment].\n - Event helpers: [can-event-dom-enter], [can-event-dom-radiochange].\n - Ajax helpers: [can-ajax].\n - Environment identification helpers: [can-globals/document/document].\n\nAnd the [can-dom-mutate] helper which should be used to manipulate DOM\nnodes in elements that do not support [MutationObservers](https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver). \n\n\n### JS Utilities\n\nThe JS utilities consist of:\n\n- Functional helpers: [can-assign], [can-define-lazy-value], [can-make-map].\n- Type detection helpers: [can-reflect.isConstructorLike], [can-reflect.isFunctionLike], [can-reflect.isIteratorLike],[can-reflect.isListLike], [can-reflect.isMapLike], ,[can-reflect.isObservableLike], [can-reflect.isPlainObject], [can-reflect.isPromise], [can-reflect.isPrimitive], [can-types].\n- Environment detection helpers: [can-globals/is-browser-window/is-browser-window], [can-globals/is-node/is-node], [ccan-globals/is-browser-window/is-web-worker].\n- Environment identification helpers: [can-global], [can-globals].\n- URL helpers: [can-param], [can-deparam], [can-join-uris].\n- Diffing helper: [can-diff].\n- String helpers: [can-string], [can-string-to-any].\n- Object identification helpers: [can-cid].\n\n\n## can-view-callbacks\n\n[can-view-callbacks] lets you register callbacks for specific elements or attributes found in\ntemplates.\n\n```js\nimport { stache, viewCallbacks } from \"can\";\n\nviewCallbacks.tag(\"blue-el\", function(el, tagData) {\n el.style.background = \"blue\";\n var frag = tagData.subtemplate( {\n message: \"Hello\"\n }, tagData.options );\n \n el.appendChild(frag);\n});\n\nvar view = stache(\"{{ message }}\");\n\nvar frag = view();\n\ndocument.body.appendChild(frag);\n```\n
    \n\n## can-view-live\n\nSets up a live-binding between the DOM and a compute.\n\n```js\nimport { compute, fragment, viewLive } from \"can\";\n\nlet message = compute(\"World\");\n\nlet content = frag(\"Hello\",\"\",\"!\");\n\nlive.text(content.childNodes[1], message);\n\ndocument.body.appendChild(content);\n\nmessage(\"Earth\");\n\nconsole.log(document.body.innerHTML); //-> Hello Earth\n```\n
    \n\n\n## can-view-parser\n\n[can-view-parser] parses HTML and handlebars/mustache tokens. \n\n```js\nimport { viewParser } from \"can\";\n\nlet html = '

    ';\n\nlet attrs = [];\n\nviewParser(html, {\n attrStart: function(attrName){\n attrs.push(attrName)\n },\n attrEnd: function() {},\n start: function() {},\n end: function() {},\n attrValue: function() {},\n done: function() {}\n});\n\nconsole.log(attrs); //-> [\"first\", \"second\"]\n```\n
    \n\n## can-view-scope\n\n[can-view-scope] provides a lookup node within a contextual lookup. This is similar\nto a call object in closure in JavaScript. Consider how `message`, `first`, and `last` are looked up in the following JavaScript:\n\n```js\nlet message = \"Hello\"\nfunction outer(){\n let last = \"Abril\";\n\n function inner(){\n let first = \"Alexis\";\n console.log(message + \" \"+ first + \" \" + last);\n }\n inner();\n}\nouter();\n```\n\n[can-view-scope] can be used to create a similar lookup path:\n\n```js\nimport { Scope } from \"can\";\n\nlet globalScope = new Scope({message: \"Hello\"});\nlet outerScope = globalScope.add({last: \"Abril\"});\nlet innerScope = outerScope.add({first: \"Alexis\"});\nconsole.log(innerScope.get(\"../../message\")); //-> Hello\nconsole.log(innerScope.get(\"first\")); //-> Alexis\nconsole.log(innerScope.get(\"../last\")); //-> Abril\n```\n
    \n\n## can-view-target\n\n[can-view-target] is used to create a document fragment that can be quickly cloned but\nhave callbacks called quickly on specific elements within the cloned fragment.\n\n```js\nimport { target } from \"can\";\n\nlet aTarget = target([\n {\n tag: \"h1\",\n callbacks: [function(data){\n this.className = data.className\n }],\n children: [\n \"Hello \",\n function(data){\n this.nodeValue = data.message\n }\n ]\n },\n]);\n\n// target.clone ->

    |Hello||

    \n// target.paths -> path: [0], callbacks: [], children: {paths: [1], callbacks:[function(){}]}\n\nlet fragment = aTarget.hydrate({className: \"title\", message: \"World\"});\n\nconsole.log(fragment); // ->

    Hello World

    \n```\n
    \n\n## can-cid\n\n[can-cid] is used to get a unique identifier for an object, optionally prefixed by a type name. Once set, the unique identifier does not change, even if the type name changes on subsequent calls.\n\n```js\nimport { cid } from \"can\";\nconst x = {};\nconst y = {};\n\nconsole.log(cid(x, \"demo\")); // -> \"demo1\"\nconsole.log(cid(x, \"prod\")); // -> \"demo1\"\nconsole.log(cid(y)); // -> \"2\"\n```\n
    \n\n## can-types\n\n[can-types] is used to provide default types or test if something is of a certain type.\n\n```js\nimport types from 'can-types';\nlet oldIsMapLike = types.isMapLike;\ntypes.isMapLike = function(obj){\n return obj instanceof DefineMap || oldIsMapLike.apply(this, arguments);\n};\ntypes.DefaultMap = DefineMap;\n```\n\n## can-namespace\n\n[can-namespace] is a namespace where can-* packages can be registered.\n\n```js\nimport namespace from 'can-namespace';\n\nconst unicorn = {\n\t// ...\n};\n\nif (namespace.unicorn) {\n\tthrow new Error(\"You can't have two versions of can-unicorn, check your dependencies\");\n}\n\nexport default namespace.unicorn = unicorn;\n\n```\n\n## can-reflect\n\n[can-reflect] allows reflection on unknown data types.\n\n```js\nimport { ObservableObject, Reflect as canReflect } from \"can\";\n\nconst foo = new ObservableObject({ bar: \"baz\" });\n\nconsole.log(canReflect.getKeyValue(foo, \"bar\")); // -> \"baz\"\n```\n
    \n\n", + "description": "Utility libraries that power the core and ecosystem collection. \n", + "name": "can-infrastructure", + "title": "Infrastructure", + "type": "page", + "parent": "api", + "order": 11, + "comment": " ", + "codepen": [ + [ + "\"can\"", + "\"//unpkg.com/can@6/core.mjs\"" + ], + [ + "\"can/ecosystem\"", + "\"//unpkg.com/can@6/ecosystem.mjs\"" + ], + [ + "\"can/everything\"", + "\"//unpkg.com/can@6/everything.mjs\"" + ], + [ + "\"can/demos/technology-overview/mock-url\"", + "\"//unpkg.com/mock-url@^6.0.0/mock-url.mjs\"" + ], + [ + "\"can/demos/technology-overview/route-mini-app-components\"", + "\"//unpkg.com/route-mini-app@^5.0.0/components.mjs\"" + ], + [ + "return steal.import(", + "return import(" + ], + [ + "\"can/demos/technology-overview/page-login\"", + "\"//unpkg.com/route-mini-app@^5.0.0/page-login.mjs\"" + ], + [ + "`can/demos/technology-overview/page-${this.page}`", + "`//unpkg.com/route-mini-app@^5.0.0/page-${this.page}.mjs`" + ] + ] }, "can-namespace": { "src": { @@ -221,98 +740,510 @@ }, "comment": " " }, - "community": { + "can-legacy": { "src": { - "path": "docs/can-canjs/community.md" + "path": "docs/can-canjs/can-legacy.md" }, - "body": "\n\n\n## Upcoming Events\n\n[DoneJS.com’s Upcoming Events](https://donejs.com/community.html#events) section has a list of meetup events in the near future!\n\n## Contribute to CanJS\n\nCheck out the [guides/contribute Contribution guide] for information on [guides/contributing/bug-report reporting bugs], [guides/contributing/feature-suggestion suggesting features], and more!\n\n## Support\n\nLooking for professional help in the form of development services, support, or training?\n\n[Bitovi](https://www.bitovi.com) is the primary corporate sponsor of CanJS. [Contact Bitovi](https://www.bitovi.com/contact) to find help for your project.\n\nIf your company offers CanJS consulting services, [edit this page on GitHub](https://github.com/canjs/canjs/edit/master/docs/can-canjs/community.md) and submit a pull request to add yourself.\n\n", - "description": " Get involved with one of the most inviting communities on the internet!\n\n", - "name": "community", - "title": "Community", + "body": "\n", + "description": "Former libraries that we still accept patches for, but are not under active development.\n\n", + "name": "can-legacy", + "title": "Legacy", "type": "page", - "parent": "canjs", - "order": 3, - "outline": { - "depth": 0 - }, + "parent": "api", + "order": 13, "comment": " " }, - "guides/api": { + "about": { "src": { - "path": "docs/can-guides/api-guide.md" + "path": "docs/can-canjs/about.md" }, - "body": "\n\n## Documentation Structure\n\nCanJS’s documentation is broken down by pages for:\n\n - library collections\n - packages and modules and their exports\n - functions, properties, and type definitions (typedefs) related to module exports\n\nFor example, [can-define/map/map.prototype.forEach can-define/map/map.prototype.forEach] is a\nmethod that loops through properties and values on an [can-define/map/map DefineMap]:\n\n```js\nimport DefineMap from 'can-define/map/map';\n\nlet map = new DefineMap({name: \"Justin\"});\n\nmap.forEach(function(value, property){\n\n});\n```\n\n`.forEach` is a function the `prototype` of the [can-define/map/map DefineMap] export of the `can-define/map/map`\nmodule. The `can-define/map/map` is part of CanJS’s [can-core] collection.\n\nSo understanding CanJS’s API pages are about understanding the relationships between:\n\n- library collections\n- packages and modules and their exports\n- functions, properties, and type definitions (typedefs) related to module exports\n\n…and what’s documented on those pages. \n\n### Library Collection pages\n\nThe API docs are divided in 4 collection pages:\n\n- [can-core]\n- [can-ecosystem]\n- [can-infrastructure]\n- [can-legacy]\n\nEach collection page acts as an overview and cheat sheet for the modules and functionality\ncontained within the collection.\n\nThe [can-core] collection contains the documentation for the libraries that\nare use most commonly and directly within a CanJS application. This is where the Model-View-ViewModel\nlibraries of CanJS are documented.\n\nThe [can-ecosystem] collection contains less commonly used libraries or libraries that aren’t quite core ready yet. The most commonly used libraries here are [can-fixture], [can-stache-converters], and [can-jquery].\n\nThe [can-infrastructure] collection contains the utility libraries that power the core and ecosystem\ncollection. Often, this functionality is used indirectly. For example, the [can-event] mixin\nis used to add `on`, `off`, and `dispatch` methods to [can-define] and [can-compute]. And, [can-util] contains a wide variety of low-level DOM and JavaScript utilities.\n\nSometimes [can-infrastructure] is used directly. The most important examples are:\n\n - [can-event/batch/batch] is used to batch changes for faster performance.\n - [can-util/dom/attr/attr] provides special [can-util/dom/attr/attr.special.focused] and [can-util/dom/attr/attr.special.values] attributes that [can-stache-bindings] can be bound to.\n - [can-util/dom/events/events] provides special [can-util/dom/events/attributes/attributes],\n [can-util/dom/events/inserted/inserted], and [can-util/dom/events/removed/removed] events.\n - [can-view-callbacks] lets you register behavior for custom elements and attributes.\n\nFinally, the [can-legacy] collection. This is for libraries that are no longer under active\ndevelopment. Hopefully, you aren’t there very often.\n\n> Look to library collection pages for a high level cheat and explanation of every module within\n> the collection. \n\n## Package and Module Pages\n\nA package or module documents the \"direct\" functionality of the export and provides an overview of\nall functionality contained within the module or package.\n\nFor example, [can-define/list/list] documents the \"direct\" functionality of the export, namely\nthe [can-define/list/list DefineList] function that is exported. While [can-define/list/list.extend DefineList.extend] is the most common starting place when using [can-define/list/list DefineList], the [can-define/list/list DefineList] export method can only be used like `new DefineList()` directly. This is why `new DefineList()` is documented\non [can-define/list/list]. \n\nHowever, after the `new DefineList()` signature is detailed, [can-define/list/list] has a __#Use__\nsection that provides an overview of all functionality contained within the `can-define/list/list`\nmodule.\n\n> Look to Package and module pages for details of what is specifically exported and an overview\n> of what the module does, why it’s useful, and how to use it.\n\n## Functions, Properties, and Typedef pages\n\nWithin a module, there might be a variety of functions, properties and types a\nmodule might provide.\n\nThese values are generally organized by groupings. The most common groupings are:\n\n - _prototype_ - A property or function is on the prototype of a parent function.\n - _static_ - A property or method is a direct value on the parent function or object.\n - _events_ - Events dispatched on the parent object or instances of the parent function.\n - _types_ - Type definitions.\n\nLet’s see a few examples and then give an overview of how their content is structured.\n\n#### prototype\n\n[can-define/list/list.prototype.concat can-define/list/list.prototype.concat] is in\nthe _prototype_ group on [can-define/list/list] because `concat` is on\nthe `can-define/list/list` export’s `prototype`:\n\n```js\nimport DefineList from 'can-define/list/list';\nDefineList.prototype.concat //-> function\n```\n\nBecause of how JavaScript works, this means that you can call `.concat` directly on any instance\nof [can-define/list/list DefineList]:\n\n```js\nlet hobbies = new DefineList([\"learning\"]);\nhobbies.concat([\"programming\"]);\n```\n\n#### static\n\n[can-define/map/map.extend] s in\nthe _static_ group on [can-define/map/map] because `extend` is a direct property on the `can-define/map/map` export:\n\n```js\nimport DefineMap from 'can-define/map/map';\nDefineMap.prototype.map //-> function\n```\n\n#### types\n\nSometimes a method might expect data passed to it in a certain format, or returns\ndata in another format. These formats are often described separate from the\nmethod.\n\nFor example, the [can-fixture.store can-fixture.store] method returns an object\nof the [can-fixture/StoreType Store type].\n\n```js\nimport fixture from 'can-fixture';\n\nlet todoStore = fixture.store([{id: 1, name: \"trash\"}]);\n\ntodoStore.createData //-> function\ntodoStore.destroyData //-> function\ntodoStore.get //-> function\n```\n\nAs you can see above, a `Store` can have lots of methods\nitself: `createData`, `destroyData`, etc. So this type that isn’t directly\naccessible is documented under `can-fixture`’s _types_. It’s also\nspecified as the return value of [can-fixture.store can-fixture.store].\n\n### Functions, Properties, and Typedef content\n\nEach function, property, and typedef page will have one or more signature’s describing\nwhat is being documented.\n\nSignatures are the __what__ and the __how__. They should be precise on the\nbehavior of what is being documented.\n\nSome function, property, and typedef pages have __#Use__ sections that give\nmore information and examples on what is being documented.\n\n> Look to Functions, Properties, and Typedef pages to provide low-level details on\n> a specific piece of CanJS’s API.\n\n\n## How to find what you’re looking for…\n\n1. Get a good understand of the purpose behind each module. \n2. Start with core modules.\n3. Then check out infrastructure modules.\n\nIf you don’t find what you want on the lowest level, walk up to the parent module, it\nmight be in its __#Use__ section. \n\nIf not, let us know!\n\n", - "description": "This page walks through how to use and understand CanJS’s API documentation. \n", - "name": "guides/api", - "title": "Reading the API Docs", + "body": "\nCanJS is an evolving and improving set of client-side JavaScript architectural libraries that balances innovation and stability. It targets experienced developers building complex applications with long futures ahead of them.\n\nCanJS is part of the [DoneJS](https://donejs.com/) family of open source projects. The [DoneJS Team](https://donejs.com/About.html#team) and [Bitovi](https://www.bitovi.com) are responsible for CanJS. They steer its direction, add features, fix bugs, and help you become successful. Feel free to say hello anytime on [Slack](https://www.bitovi.com/community/slack) ([#canjs channel](https://bitovi-community.slack.com/messages/CFC22NZ8A)) or the [forums](https://forums.bitovi.com/c/canjs).\n\n
    \n \n \n
    \n\n**CanJS’s goals are briefly summarized in its mission statement:**\n\n> To minimize the cost of building and maintaining JavaScript applications by balancing innovation and stability, helping developers transcend a changing technology landscape.\n\n## Why CanJS?\n\n* Read more about [guides/mission our mission] and how we’ve been accomplishing those goals for 10 years.\n\n* If CanJS’s heart isn’t enough to convince you it’s a good fit, read up on its [guides/technical].\n\n* CanJS is used by some of the largest companies in the world. Find out who on [guides/who-uses-canjs]\n\n* Learn about CanJS’s future plans, how we make them, and how you can influence them on the [roadmap] page.\n\n", + "description": " Learn about CanJS’s [guides/mission mission], [guides/technical technical highlights], [guides/who-uses-canjs who uses CanJS], and our [roadmap future roadmap].\n\n", + "name": "about", + "title": "About", "type": "page", - "parent": "guides/other", - "order": 2, + "parent": "canjs", + "order": 0, "comment": " " }, - "can-assign": { - "type": "module", - "name": "can-assign", - "parent": "can-js-utilities", + "canjs": { "src": { - "line": 2, - "codeLine": 29, - "path": "node_modules/can-assign/can-assign.js" + "path": "docs/can-canjs/canjs.md" }, - "body": "\n```js\nvar assign = require(\"can-assign\");\n\nvar obj = {};\n\nassign(obj, {\n foo: \"bar\"\n});\n\nconsole.log(obj.foo); // -> \"bar\"\n```\n\n", - "description": "\nA simplified version of [Object.assign](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign), which only accepts a single source argument.\n", - "title": "can-assign", - "types": [ - { - "type": "function", - "returns": { - "types": [ - { - "type": "undefined" - } - ] - }, - "params": [] - } - ], - "collection": "can-infrastructure", - "signatures": [ - { - "code": "assign(target, source)", - "description": "", - "params": [ - { - "types": [ - { - "type": "Object", - "options": [] - } - ], - "name": "target", - "description": "The destination object. This object's properties will be mutated based on the object provided as `source`." - }, - { - "types": [ - { - "type": "Object", - "options": [] - } - ], - "name": "source", - "description": "The source object whose own properties will be applied to `target`.\n" + "body": "\n\n\n
    \n
    \n
    \n \n

    Build CRUD apps in fewer lines of code

    \n Learn how to build this CRUD app\n
    \n
    \n \n
    \n
    \n
    \n
    \n
    \n
    \n
    \n

    Model layer

    \n

    Components shouldn’t be concerned with how data is fetched, updated, or cached.

    \n

    \n CanJS provides the right abstractions for your model code to be cleanly separated from your UI code.\n Learn more…\n

    \n
    \n
    \n \n
    \n
    \n
    \n
    \n
    \n
    \n

    Promises in templates

    \n

    CanJS’s [can-stache stache templating language] can directly read the state and values from Promises.

    \n

    \n No need to write any extra code to determine whether a Promise is pending, resolved, or rejected.\n Learn more…\n

    \n
    \n
    \n\n```html\n{{# if(this.promise.isPending) }}\n Loading…\n{{/ if }}\n{{# if(this.promise.isRejected) }}\n Error: {{ this.promise.reason }}\n{{/ if }}\n{{# if(this.promise.isResolved) }}\n Result: {{ this.promise.value }}\n{{/ if }}\n```\n
    \n
    \n
    \n
    \n
    \n
    \n

    Real-time list updating

    \n

    After data is created, updated, or destroyed, CanJS automatically updates your lists for you.

    \n

    \n Filtering and sorting are preserved, so you don’t have to manually update your lists or fetch the same data again.\n Learn more…\n

    \n
    \n
    \n \n
    \n
    \n
    \n
    \n
    \n
    \n
    \n

    We have your back

    \n

    CanJS is backed by Bitovi, a company built on using and publishing open source software. We answer every question on our Slack and our Discourse forums. We want to help you get started with CanJS!

    \n \n
    \n
    \n \n \"Slack\"\n \n \n \"Discourse\"\n \n
    \n
    \n
    \n
    \n
    \n
    \n

    Model layer

    \n\nWith a single line of code, CanJS creates a model that represents the objects returned by a backend API.\nSee how `Todo` is created by passing a URL to [can-realtime-rest-model realtimeRestModel()].\n\nThe model layer is responsible for making GET, POST, PUT, and DELETE requests to your backend.\nWith your component UI code using the model’s standard interface to make requests, if the backend API changes,\nyou only have to configure the model and not change every component that uses that backend API.\n\nBy default, CanJS assumes your backend API is RESTful. If your backend API isn’t RESTful, that’s ok!\nCanJS has configuration options for you to control how it makes requests, parses data, and more.\n\n
    \n
    \n\n```js\nimport { realtimeRestModel } from \"can\";\n\nconst Todo = realtimeRestModel(\"/api/todos/{id}\").ObjectType;\n\n// Get todos sorted by name\nconst todosPromise = Todo.getList({sort: \"name\"});\ntodosPromise.then(todos => {\n // Your backend API might return something like:\n // todos = [ {name: \"a\"}, {name: \"b\"}, {name: \"c\"} ]\n});\n```\n\n
    \n
    \n
    \n
    \n

    Promises in templates

    \n\nCanJS’s [can-stache stache templating language] is similar to Handlebars and Mustache.\nWherever you see `{{ }}` in a template, CanJS evaluates the expression inside to either\nprint a value or perform some basic logic, like [can-stache.helpers.if #if] and\n[can-stache.helpers.for-of #for(of)].\n\nStache is able to read the state and value of Promises. See `isPending`, `isRejected`,\nand `isResolved` being read on `this.todosPromise` in the example code? Those return\ntrue depending on the current state of the Promise. `reason` is provided if the\nPromise is rejected with an error, and `value` contains the resolved value if\nthe promise succeeds.\n\nThese helpers make it much easier to include loading and error states in your app.\nWe promise you’ll love writing your templates this way.\n\n
    \n
    \n\n```html\n{{# if(this.todosPromise.isPending) }}\n\tLoading todos…\n{{/ if }}\n{{# if(this.todosPromise.isRejected) }}\n\tError: {{ this.todosPromise.reason.message }}\n{{/ if }}\n{{# if(this.todosPromise.isResolved) }}\n\t
      \n\t\t{{# for(todo of this.todosPromise.value) }}\n\t\t\t
    • \n\t\t\t\t{{ todo.name }}\n\t\t\t
    • \n\t\t{{/ for }}\n\t
    \n{{/ if }}\n```\n\n
    \n
    \n
    \n
    \n

    Real-time list updating

    \n\nHere you can see CanJS’s model layer in action. When `Todo.getList({sort: \"name\"})` is called,\nCanJS makes a GET request to `/api/todos?sort=name`\n\nWhen the array of to-dos comes back, CanJS associates that array with the query `{sort: \"name\"}`.\nWhen new to-dos are created, they’re added to the list that’s returned _automatically_, and\nin the right spot! You don’t have to write any code to make sure the new to-do gets inserted\ninto the right spot in the list.\n\nCanJS does this for filtering as well. If you make a query with a filter (e.g. `{filter: {complete: true}}`),\nwhen items are added, edited, or deleted that match that filter, those lists will be updated automatically.\n\nSave yourself time by not writing code that updates your app’s UI.\n\n
    \n
    \n\n```js\nimport { realtimeRestModel } from \"can\";\n\nconst Todo = realtimeRestModel(\"/api/todos/{id}\").ObjectType;\n\n// Get completed todos\nTodo.getList({sort: \"name\"}).then(todos => {\n // Let’s assume the API came back with\n // todos = [ {name: \"a\"}, {name: \"c\"} ]\n\n // Create a new todo client-side\n const newTodo = new Todo({name: \"b\"});\n\n // The todos list is immediately updated with the\n // new to-do in the right place, alphabetically:\n // todos = [ {name: \"a\"}, {name: \"b\"}, {name: \"d\"} ]\n});\n```\n\n
    \n
    \n
    \n\n\n\n
    \n
    \n\n## Get started with just a few lines of code\n\nBelow is an entire app that shows off some of the best features of CanJS:\n\n- One line of code to create a model from the data returned by a backend API (with [can-realtime-rest-model realtimeRestModel]).\n- `isPending`, `isRejected`, `isResolved`, and `value` helpers for directly reading the state of a Promise.\n- When you add a to-do, it automatically gets inserted into the list in the right position.\n\n

    \n See the Pen \n CanJS 5 — Basic Todo App by Bitovi (@bitovi)\n on CodePen.\n

    \n \n Type in a new to-do and click “Add” to see it appear in the list. Notice that new to-dos are inserted in alphabetical order, without any code that explicitly inserts the new one in the right place!\n \n
    \n
    \n\n
    \n

    Who Uses CanJS?

    \n
    \n \"Chase\"\n \"Bitovi\"\n \"Apple\"\n \"Delta\"\n \"HP\"\n \"FedEx\"\n \"Tucows\"\n
    \n
    \n
    \n
    \n
    \n

    Use DevTools to debug your app

    \n

    Use the CanJS DevTools to edit your app’s state at runtime, visualize the dependency graphs between elements and state, and debug changes to observables.

    \n

    Small bundle size

    \n \n

    At 72 KB gzipped, CanJS provides all the tools you need at a small size.

    \n
    \n
    \n

    Browser support

    \n

    CanJS supports Internet Explorer 11, Chrome, Edge, Firefox, and Safari.

    \n \"Sauce\n
    \n
    \n\n\n", + "description": "CanJS is a JavaScript framework for building CRUD apps in fewer lines of code. \n", + "name": "canjs", + "title": "CanJS — Build CRUD apps in fewer lines of code.", + "type": "page", + "dest": "../index", + "outline": { + "depth": 0 + }, + "package": { + "name": "can", + "version": "6.5.0", + "main": "can.js", + "scripts": { + "preversion": "npm test", + "version": "git commit -am \"Update dist for release\" && git checkout -b release && git add -f dist/", + "postversion": "git push --tags && git checkout - && git branch -D release && git push", + "testee": "testee test/index.html --browsers firefox", + "testee-builders": "testee test/builders/test.html --browsers firefox", + "testee-production": "testee test/production.html --browsers firefox", + "testee-global-build": "testee test/global-build.html --browsers firefox", + "http-server": "http-server -p 3000 --silent", + "test": "npm run test-development && npm run test-production && npm run test-builders && npm run test-global-build", + "test-builders": "npm run build-webpack-test && npm run testee-builders", + "test-development": "npm run testee", + "test-global-build": "npm run build && bundlesize && npm run testee-global-build", + "test-local": "npm run build && npm run testee", + "test-production": "npm run build-tests && npm run testee-production", + "test-sauce-labs": "node test/test-sauce-labs.js", + "release:pre": "npm version prerelease && npm run build && npm publish --tag=pre", + "release:patch": "npm version patch && npm run build && npm publish", + "release:minor": "npm version minor && npm run build && npm publish", + "release:major": "npm version major && npm run build && npm publish", + "build": "node build.js", + "build-tests": "node test/build.js", + "build-webpack-test": "webpack --mode=production -o test/builders/webpack/bundle.js test/builders/webpack/index.js", + "document": "./pre-document.sh && npm run deps-bundle && bit-docs", + "document:force": "./pre-document.sh && npm run deps-bundle && bit-docs -fd", + "deps-bundle": "node build-dev-bundle" + }, + "title": "CanJS", + "description": "MIT-licensed, client-side, JavaScript framework that makes building rich web applications easy.", + "keywords": [ + "CanJS", + "DoneJS" + ], + "author": { + "name": "Bitovi", + "email": "contact@bitovi.com", + "web": "http://bitovi.com/" + }, + "homepage": "http://canjs.com/", + "repository": { + "type": "git", + "url": "git@github.com:canjs/canjs.git", + "github": "https://github.com/canjs/canjs" + }, + "dependencies": { + "can-ajax": "2.4.6", + "can-assign": "1.3.3", + "can-attribute-encoder": "1.1.4", + "can-attribute-observable": "2.0.2", + "can-bind": "1.5.1", + "can-child-nodes": "1.2.1", + "can-cid": "1.3.1", + "can-component": "5.0.0", + "can-compute": "4.1.1", + "can-connect": "4.0.2", + "can-connect-ndjson": "2.0.0", + "can-connect-tag": "2.0.0", + "can-construct": "3.5.6", + "can-construct-super": "3.2.1", + "can-control": "5.0.1", + "can-data-types": "1.2.1", + "can-debug": "2.0.7", + "can-deep-observable": "1.0.2", + "can-define": "2.8.0", + "can-define-backup": "2.1.2", + "can-define-lazy-value": "1.1.1", + "can-define-realtime-rest-model": "2.0.0", + "can-define-rest-model": "2.0.0", + "can-define-stream": "1.1.1", + "can-define-stream-kefir": "1.1.1", + "can-deparam": "1.2.2", + "can-diff": "1.5.0", + "can-dom-data": "1.0.3", + "can-dom-data-state": "1.1.2", + "can-dom-events": "1.3.11", + "can-dom-mutate": "2.0.8", + "can-event-dom-enter": "2.2.1", + "can-event-dom-radiochange": "2.2.1", + "can-event-queue": "1.1.8", + "can-fixture": "3.1.7", + "can-fixture-socket": "2.0.3", + "can-fragment": "1.3.1", + "can-globals": "1.2.2", + "can-kefir": "1.1.4", + "can-key": "1.2.1", + "can-key-tree": "1.2.2", + "can-list": "4.2.2", + "can-local-store": "1.0.1", + "can-log": "1.0.2", + "can-make-map": "1.2.2", + "can-map": "4.3.12", + "can-map-compat": "1.1.1", + "can-map-define": "4.4.0", + "can-memory-store": "1.0.3", + "can-namespace": "1.0.0", + "can-ndjson-stream": "1.0.2", + "can-observable-array": "1.1.4", + "can-observable-bindings": "1.3.3", + "can-observable-mixin": "1.0.10", + "can-observable-object": "1.1.4", + "can-observation": "4.2.0", + "can-observation-recorder": "1.3.1", + "can-observe": "2.3.2", + "can-param": "1.1.2", + "can-parse-uri": "1.2.2", + "can-query-logic": "1.2.2", + "can-queues": "1.3.2", + "can-realtime-rest-model": "2.0.0", + "can-reflect": "1.18.0", + "can-reflect-dependencies": "1.1.2", + "can-reflect-promise": "2.2.1", + "can-rest-model": "2.0.0", + "can-route": "5.0.2", + "can-route-hash": "1.0.2", + "can-route-mock": "1.0.2", + "can-route-pushstate": "6.0.0", + "can-set-legacy": "1.0.1", + "can-simple-dom": "1.7.1", + "can-simple-map": "4.3.3", + "can-simple-observable": "2.5.0", + "can-stache": "5.1.1", + "can-stache-bindings": "5.0.4", + "can-stache-converters": "5.0.0", + "can-stache-element": "1.2.0", + "can-stache-key": "1.4.3", + "can-stache-route-helpers": "2.0.0", + "can-stream": "1.1.1", + "can-stream-kefir": "1.2.1", + "can-string": "1.1.0", + "can-string-to-any": "1.2.1", + "can-super-model": "2.0.0", + "can-symbol": "1.6.5", + "can-type": "1.1.4", + "can-validate": "1.2.1", + "can-validate-interface": "1.0.3", + "can-validate-legacy": "2.0.1", + "can-validate-validatejs": "1.0.1", + "can-value": "1.1.2", + "can-vdom": "4.4.2", + "can-view-autorender": "6.0.0", + "can-view-callbacks": "5.0.0", + "can-view-live": "5.0.4", + "can-view-model": "4.0.3", + "can-view-parser": "4.1.3", + "can-view-scope": "4.13.6", + "can-view-target": "5.0.0", + "steal-stache": "5.0.0" + }, + "devDependencies": { + "@feathersjs/feathers": "^3.3.1", + "@feathersjs/socketio-client": "^1.2.1", + "@octokit/rest": "^16.27.3", + "@webcomponents/custom-elements": "^1.2.4", + "bit-docs": "^0.2.0", + "bundlesize": "^0.18.0", + "can-reflect-tests": "^1.0.0", + "can-test-helpers": "^1.1.1", + "core-js": "^2.5.7", + "es6-promise-polyfill": "^1.2.0", + "funcunit": "^3.4.2", + "gzip-size": "^4.1.0", + "http-server": "^0.11.1", + "jquery": "2.x - 3.x", + "jquery-ui": "^1.12.0", + "kefir": "^3.8.0", + "minimist": "^1.2.5", + "prop-types": "^15.5.10", + "qunit": "^2.9.2", + "semver": "^6.1.1", + "socket.io-client": "^2.2.0", + "steal": "^2.2.4", + "steal-conditional": "^1.1.3", + "steal-css": "^1.2.4", + "steal-qunit": "^2.0.0", + "steal-socket.io": "^4.0.9", + "steal-tools": "^2.2.5", + "test-saucelabs": "0.0.6", + "testee": "^0.9.0", + "version-and-release": "^0.1.1", + "webpack": "^4.12.0", + "webpack-cli": "^3.0.7" + }, + "demos": [ + "http://canjs.us/#examples", + "http://canjs.us/recipes" + ], + "googleAnalyticsTrackingCode": "UA-2302003-11", + "licenses": [ + { + "type": "MIT", + "url": "http://opensource.org/licenses/mit-license.php" + } + ], + "sideEffects": false, + "steal": { + "npmAlgorithm": "flat", + "main": "can", + "npmIgnore": [ + "bit-docs", + "testee", + "async", + "saucelabs", + "test-saucelabs", + "wd", + "http-server" + ], + "meta": { + "socket.io-client/dist/socket.io": { + "format": "cjs" } + }, + "configDependencies": [ + "./node_modules/steal-conditional/conditional.js" ], + "plugins": [ + "steal-stache" + ] + }, + "bit-docs": { + "html": { + "dependencies": { + "normalize.css": "^5.0.0", + "steal-conditional": "^0.3.6", + "steal-stache": "^4.0.1" + }, + "package": { + "steal": { + "configDependencies": [ + "./node_modules/steal-conditional/conditional" + ] + } + }, + "static": [], + "templates": [] + }, + "dependencies": { + "bit-docs-glob-finder": "^0.0.5", + "bit-docs-dev": "^0.0.3", + "bit-docs-js": "^0.0.6", + "bit-docs-tag-sourceref": "^0.0.3", + "bit-docs-generate-html": "^0.11.0", + "bit-docs-generate-searchmap": "^0.2.0", + "bit-docs-html-canjs": "3.0.0-pre.6", + "bit-docs-prettify": "^0.3.0", + "bit-docs-html-highlight-line": "^0.5.3", + "bit-docs-tag-demo": "^0.5.3", + "bit-docs-tag-package": "^1.0.0", + "bit-docs-html-codepen-link": "^2.0.3", + "bit-docs-html-toc": "^1.1.1" + }, + "glob": { + "pattern": "{node_modules,docs}/{can-*,steal-stache}/**/*.{js,md}", + "ignore": [ + "node_modules/can-namespace/**/*", + "node_modules/can-wait/examples/**/*", + "node_modules/can-*/dist/**/*", + "node_modules/*/node_modules/**/*", + "node_modules/can-debug/src/draw-graph/vis.js" + ] + }, + "altVersions": { + "5.33.3": "https://v5.canjs.com", + "4.3.0": "https://v4.canjs.com", + "3.14.1": "https://v3.canjs.com", + "2.3.35": "https://v2.canjs.com" + }, + "parent": "canjs", + "minifyBuild": true, + "codepen": [ + [ + "\"can\"", + "\"//unpkg.com/can@6/core.mjs\"" + ], + [ + "\"can/ecosystem\"", + "\"//unpkg.com/can@6/ecosystem.mjs\"" + ], + [ + "\"can/everything\"", + "\"//unpkg.com/can@6/everything.mjs\"" + ], + [ + "\"can/demos/technology-overview/mock-url\"", + "\"//unpkg.com/mock-url@^6.0.0/mock-url.mjs\"" + ], + [ + "\"can/demos/technology-overview/route-mini-app-components\"", + "\"//unpkg.com/route-mini-app@^5.0.0/components.mjs\"" + ], + [ + "return steal.import(", + "return import(" + ], + [ + "\"can/demos/technology-overview/page-login\"", + "\"//unpkg.com/route-mini-app@^5.0.0/page-login.mjs\"" + ], + [ + "`can/demos/technology-overview/page-${this.page}`", + "`//unpkg.com/route-mini-app@^5.0.0/page-${this.page}.mjs`" + ] + ] + }, + "bundlesize": [ + { + "path": "./core.min.mjs", + "maxSize": "106 kB" + }, + { + "path": "./core.mjs", + "maxSize": "314 kB" + }, + { + "path": "./dist/global/core.js", + "maxSize": "200 kB" + } + ] + }, + "templateRender": [ + "<%", + "%>" + ], + "comment": " " + }, + "community": { + "src": { + "path": "docs/can-canjs/community.md" + }, + "body": "\n\n\n## Upcoming Events\n\n[DoneJS.com’s Upcoming Events](https://donejs.com/community.html#events) section has a list of meetup events in the near future!\n\n## Contribute to CanJS\n\nCheck out the [guides/contribute Contribution guide] for information on [guides/contributing/bug-report reporting bugs], [guides/contributing/feature-suggestion suggesting features], and more!\n\n## Support\n\nLooking for professional help in the form of development services, support, or training?\n\n[Bitovi](https://www.bitovi.com) is the primary corporate sponsor of CanJS. [Contact Bitovi](https://www.bitovi.com/contact) to find help for your project.\n\nIf your company offers CanJS consulting services, [edit this page on GitHub](https://github.com/canjs/canjs/edit/master/docs/can-canjs/community.md) and submit a pull request to add yourself.\n\n", + "description": " Get involved with one of the most inviting communities on the internet!\n\n", + "name": "community", + "title": "Community", + "type": "page", + "parent": "canjs", + "order": 3, + "outline": { + "depth": 0 + }, + "comment": " " + }, + "guides/api": { + "src": { + "path": "docs/can-guides/api-guide.md" + }, + "body": "\n\n## Documentation Structure\n\nCanJS’s documentation is broken down by pages for:\n\n - library collections\n - packages and modules and their exports\n - functions, properties, and type definitions (typedefs) related to module exports\n\nFor example, [can-observable-array/array.prototype.filter can-observable-array/array.prototype.filter] is a\nmethod that filters an array of [can-observable-array ObservableArray]:\n\n```js\nimport ObservableArray from \"can-observable-array\";\n\nlet users = new ObservableArray([{ name: \"Justin\" }, { name: \"Matt\" }]);\n\nconst filteredUsers = users.filter(function(item) {\n return item.name === \"Justin\";\n}); //-> { name: \"Justin: }\n```\n\n`.filter` is a function on the `prototype` of the [can-observable-array ObservableArray] export of the `can-observable-array`\nmodule. The `can-observable-array` is part of CanJS’s [can-core] collection.\n\nSo understanding CanJS’s API pages are about understanding the relationships between:\n\n- library collections\n- packages and modules and their exports\n- functions, properties, and type definitions (typedefs) related to module exports\n\n…and what’s documented on those pages. \n\n### Library Collection pages\n\nThe API docs are divided in 4 collection pages:\n\n- [can-core]\n- [can-ecosystem]\n- [can-infrastructure]\n- [can-legacy]\n\nEach collection page acts as an overview and cheat sheet for the modules and functionality\ncontained within the collection.\n\nThe [can-core] collection contains the documentation for the libraries that\nare use most commonly and directly within a CanJS application. This is where the custom element, observable, model, and routing libraries of CanJS are documented.\n\nThe [can-ecosystem] collection contains less commonly used libraries or libraries that aren’t quite core ready yet. The most commonly used libraries here are [can-fixture] and [can-stache-converters].\n\nThe [can-infrastructure] collection contains the utility libraries that power the core and ecosystem\ncollection. Often, this functionality is used indirectly. For example, the [can-event-queue/map/map] mixin\nis used to add `on`, `off`, and `dispatch` methods to [can-observable-object] and [can-observable-array].\n\nSometimes [can-infrastructure] is used directly. The most important examples are:\n\n - [can-queues] is used to schedule tasks and [can-queues.batch.start batch] changes for faster performance.\n - [can-dom-mutate/events/events] provides special `attributes`, `inserted`, and `removed` events.\n - [can-view-callbacks] lets you register behavior for custom elements and attributes.\n\nFinally, the [can-legacy] collection. This is for libraries that are no longer under active\ndevelopment. Hopefully, you aren’t there very often.\n\n> Look to library collection pages for a high level cheat and explanation of every module within\n> the collection. \n\n## Package and Module Pages\n\nA package or module documents the \"direct\" functionality of the export and provides an overview of\nall functionality contained within the module or package.\n\nFor example, [can-observable-array] documents the \"direct\" functionality of the export, namely\nthe [can-observable-array ObservableArray] function that is exported. While [can-observable-array#classextendsObservableArray classextendsObservableArray] is the most common starting place when using [can-observable-array ObservableArray], the [can-observable-array ObservableArray] export method can only be used like `new ObservableArray()` directly. This is why `new ObservableArray()` is documented\non [can-observable-array]. \n\nHowever, after the `new ObservableArray()` signature is detailed, [can-observable-array] has a __#Use__\nsection that provides an overview of all functionality contained within the `can-observable-array`\nmodule.\n\n> Look to Package and module pages for details of what is specifically exported and an overview\n> of what the module does, why it’s useful, and how to use it.\n\n## Functions, Properties, and Typedef pages\n\nWithin a module, there might be a variety of functions, properties and types a\nmodule might provide.\n\nThese values are generally organized by groupings. The most common groupings are:\n\n - _prototype_ - A property or function is on the prototype of a parent function.\n - _static_ - A property or method is a direct value on the parent function or object.\n - _events_ - Events dispatched on the parent object or instances of the parent function.\n - _types_ - Type definitions.\n\nLet’s see a few examples and then give an overview of how their content is structured.\n\n#### prototype\n\n[can-observable-array.prototype.filter can-observable-array.prototype.filter] is in\nthe _prototype_ group on [can-observable-array] because `filter` is on\nthe `can-observable-array` export’s `prototype`:\n\n```js\nimport ObservableArray from \"can-observable-array\";\nObservableArray.prototype.filter //-> function\n```\n\nBecause of how JavaScript works, this means that you can call `.filter` directly on any instance\nof [can-observable-array ObservableArray]:\n\n```js\nlet hobbies = new ObservableArray([\"learning\", \"programming\"]);\nhobbies.filter(hobby => hobby === \"programming\");\n```\n\n#### static\n\n[can-observable-object/object.static.propertyDefaults] in\nthe _static_ group on [can-observable-object] because `propertyDefaults` is a [static property](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes/Class_fields#Public_static_fields) on the `can-observable-object`:\n\n```js\nimport ObservableObject from \"can-observable-object\";\n\nclass Person extends ObservableObject {\n static propertyDefaults = {}\n}\n```\n\n#### types\n\nSometimes a method might expect data passed to it in a certain format, or returns\ndata in another format. These formats are often described separate from the\nmethod.\n\nFor example, the [can-fixture.store can-fixture.store] method returns an object\nof the [can-fixture/StoreType Store type].\n\n```js\nimport fixture from 'can-fixture';\n\nlet todoStore = fixture.store([{id: 1, name: \"trash\"}]);\n\ntodoStore.createData //-> function\ntodoStore.destroyData //-> function\ntodoStore.get //-> function\n```\n\nAs you can see above, a `Store` can have lots of methods\nitself: `createData`, `destroyData`, etc. So this type that isn’t directly\naccessible is documented under `can-fixture`’s _types_. It’s also\nspecified as the return value of [can-fixture.store can-fixture.store].\n\n### Functions, Properties, and Typedef content\n\nEach function, property, and typedef page will have one or more signature’s describing\nwhat is being documented.\n\nSignatures are the __what__ and the __how__. They should be precise on the\nbehavior of what is being documented.\n\nSome function, property, and typedef pages have __#Use__ sections that give\nmore information and examples on what is being documented.\n\n> Look to Functions, Properties, and Typedef pages to provide low-level details on\n> a specific piece of CanJS’s API.\n\n\n## How to find what you’re looking for…\n\n1. Get a good understand of the purpose behind each module. \n2. Start with core modules.\n3. Then check out infrastructure modules.\n\nIf you don’t find what you want on the lowest level, walk up to the parent module, it\nmight be in its __#Use__ section. \n\nIf not, let us know!\n\n", + "description": "This page walks through how to use and understand CanJS’s API documentation. \n", + "name": "guides/api", + "title": "Reading the API Docs", + "type": "page", + "parent": "guides/other", + "order": 2, + "comment": " " + }, + "guides/getting-started": { + "name": "guides/getting-started", + "title": "getting started", + "type": "group", + "parent": "guides", + "description": "", + "order": 1 + }, + "guides/topics": { + "name": "guides/topics", + "title": "topics", + "type": "group", + "parent": "guides", + "description": "", + "order": 2 + }, + "guides/experiment": { + "name": "guides/experiment", + "title": "app guides", + "type": "group", + "parent": "guides", + "description": "", + "order": 3 + }, + "guides/recipes/beginner": { + "name": "guides/recipes/beginner", + "title": "beginner recipes", + "type": "group", + "parent": "guides", + "description": "", + "order": 4 + }, + "guides/recipes/intermediate": { + "name": "guides/recipes/intermediate", + "title": "intermediate recipes", + "type": "group", + "parent": "guides", + "description": "", + "order": 5 + }, + "guides/recipes/advanced": { + "name": "guides/recipes/advanced", + "title": "advanced recipes", + "type": "group", + "parent": "guides", + "description": "", + "order": 6 + }, + "guides/upgrade": { + "name": "guides/upgrade", + "title": "upgrade", + "type": "group", + "parent": "guides", + "description": "", + "order": 7 + }, + "guides/other": { + "name": "guides/other", + "title": "other", + "type": "group", + "parent": "guides", + "description": "", + "order": 8 + }, + "guides": { + "src": { + "path": "docs/can-guides/Guides.md" + }, + "body": "\n## Development Guides\n\nThe following skill-tree diagram organizes our guides by topic vertically and by difficulty\nhorizontally. Harder and longer guides to the right. This allows you to\ntake the guides that fit your needs.\n\nFor example:\n\n- A user new to JavaScript programming might start with the [guides/technology-overview]\n then try a few of the more simple guides: [guides/chat], [guides/recipes/signup-simple], [guides/recipes/file-navigator-simple].\n- An advanced user might jump right to our most advanced guide - [https://donejs.com/place-my-order.html PlaceMyOrder].\n\nWe encourage everyone to take a look at:\n\n- [guides/technology-overview] to understand CanJS’s core concepts.\n- One of the _Platform and Environment Integration_ guides to\n get CanJS working in your development and production environments.\n- [guides/debugging] to know how to fix problems when they arise.\n\n> **Note:** Some of the following guides are on [DoneJS.com](http://donejs.com).\n> DoneJS is another framework built on top of CanJS.\n> These DoneJS guides feature CanJS extensively and are __extremely__\n> useful to understanding how to build a CanJS application even if you are\n> not using DoneJS.\n\n\n\n\n
    \n\n\n\n \n \n\n\n\n \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
    Architecture[guides/technology-overview]\n

    <%this.[guides/technology-overview].description%>

    \n\"Observables\n
    [guides/chat]\n

    <%this.[guides/chat].description%>

    \n\n
    [guides/todomvc]\n

    \n<%this.[guides/todomvc].description%>\n

    \n\n
    [https://donejs.com/place-my-order.html PlaceMyOrder]\n

    Build and deploy a real-time, multi-page DoneJS application.

    \n \n
    [guides/recipes/todomvc-with-steal]\n

    <%this.[guides/recipes/todomvc-with-steal].description%>

    \n\n
    [https://donejs.com/bitballs.html Bitballs]\n

    Walk through a DoneJS app built with PostgreSQL.

    \n\n
    Platform and Environment Integration[guides/setup]\n

    <%this.[guides/setup].description%>

    \n \n
    [https://donejs.com/Guide.html DoneJS Chat]\n

    Deploy to a\n CDN. Build a desktop and mobile app.

    \n \n
    [https://donejs.com/place-my-order.html PlaceMyOrder]\n

    Setup continuous integration, continuous deployment. Deploy to a\n CDN. Build a desktop and mobile app.\n

    \n
    Debugging[guides/debugging]\n

    <%this.[guides/debugging].description%>

    \n\"A
    State Management[guides/atm]\n

    <%this.[guides/atm].description%>

    \n\n
    [guides/recipes/credit-card-advanced]\n

    <%this.[guides/recipes/credit-card-advanced].description%>

    \n \n
    Testing\n [guides/atm]\n

    <%this.[guides/atm].description%>

    \n
    [guides/testing]\n

    <%this.[guides/testing].description%>

    \n \"\"\n
    Routing\n [https://donejs.com/bitballs.html Bitballs]\n

    The Bitballs example routes between a large number of pages.

    \n \n
    [guides/routing]\n

    <%this.[guides/routing].description%>

    \n \"\"\n
    Data[guides/recipes/file-navigator-advanced]\n

    <%this.[guides/recipes/file-navigator-advanced].description%>

    \n \n
    [guides/data]\n

    In progress. Help us by adding comments to the proposal.

    \n
    [guides/todomvc]\n

    \n Learn how to retrieve, create, update, and delete items.\n

    \n \n
    \n [https://donejs.com/bitballs.html Bitballs]\n

    Learn how to connect to a service built on PostgreSQL, handle\n relationships, and sessions.

    \n
    [https://donejs.com/place-my-order.html PlaceMyOrder]\n

    Build and deploy a real-time, CRUD DoneJS application.

    \n\n
    \n [https://github.com/donejs/bitcentive Bitcentive]\n

    Example repo showing how to connect to a document-based data layer.

    \n \n
    Rich User Interfaces[guides/recipes/signup-simple]\n

    <%this.[guides/recipes/signup-simple].description%>

    \n \n
    [guides/forms]\n

    <%this.[guides/forms].description%>

    \n \n
    [guides/recipes/playlist-editor]\n

    <%this.[guides/recipes/playlist-editor].description%>

    \n \n
    Non-DOM API Integration[guides/recipes/canvas-clock]\n

    <%this.[guides/recipes/canvas-clock].description%>

    \n\n
    [guides/recipes/weather-report-simple]\n

    <%this.[guides/recipes/weather-report-simple].description%>

    \n\n
    [guides/recipes/cta-bus-map]\n

    <%this.[guides/recipes/cta-bus-map].description%>

    \n
    [guides/recipes/text-editor]\n

    <%this.[guides/recipes/text-editor].description%>

    \n
    \n
    \n\n## Community\n\nOnce you’ve committed to CanJS, it’s important that you keep liking it and\nget better at using it. \n\nCanJS’s community has lots of people who can offer advice and tips on\nhow to build an application the right way. Instead of struggling,\nplease\n[join our Slack](https://www.bitovi.com/community/slack)\nand ask for advice in the\n[#canjs channel](https://bitovi-community.slack.com/messages/CFC22NZ8A)\nor the [forums](https://forums.bitovi.com/c/canjs). Share a screenshot of what you’re building\nand we’ll tell you what needs to be done.\n\nTo stay up on CanJS’s latest news, we suggest:\n\n - Following [@CanJS](https://twitter.com/canjs) on twitter.\n - Subscribing to Bitovi’s [development blog](https://www.bitovi.com/blog/topic/development).\n\nTo get hands-on instruction, sign up for a DoneJS meetup in your area:\n\n- [Boston](https://www.meetup.com/DoneJS-Boston/)\n- [Chicago](https://www.meetup.com/DoneJS-Chicago/)\n- [Ft. Lauderdale](https://www.meetup.com/DoneJS-Fort-Lauderdale/)\n- [Los Angeles](https://www.meetup.com/DoneJS-LA/)\n- [New York](https://www.meetup.com/DoneJS-NYC/)\n- [Phoenix](https://www.meetup.com/DoneJS-Phoenix/)\n- [Raleigh-Durham](https://www.meetup.com/DoneJS-raleigh-durham/)\n- [San Francisco](https://www.meetup.com/DoneJS-San-Francisco/)\n- [Seattle](https://www.meetup.com/DoneJS-Seattle/)\n- [Silicon Valley](https://www.meetup.com/DoneJS-Silicon-Valley/)\n\nIf you’ve already committed to CanJS and are looking to move to 3.0, read [migrate-3].\n\n## Contributing\n\nOnce you’ve settled down with CanJS, it’s time to think about adding extensions and improvements to the framework of your own. There are many ways to contribute to\nCanJS, including:\n\n - [guides/contributing/bug-report Report a bug]\n - [guides/contributing/feature-suggestion Suggest a feature]\n - [guides/contributing/code Code changes]\n - [guides/contributing/documentation Documentation improvements]\n - [Create a plugin](https://donejs.com/plugin.html)\n - [guides/contributing/evangelism Evangelism - Blog, meetup and conference talks]\n - [guides/contributing/releases Releases - Maintaining CanJS]\n\nCanJS is managed by the [DoneJS Contributors Team](https://donejs.com/About.html#team).\nAll contributions from all types of contributors are welcome. Contributing\nto an Open Source project can be an intimidating experience. We’re\ncommitted to making the experience as pleasant and rewarding as possible. We’re happy to set up a\npairing session to show you how to fix a bug or write a feature. \n\nIf you have any questions, you can always\n[join our Slack](https://www.bitovi.com/community/slack)\nand reach us in the\n[#canjs channel](https://bitovi-community.slack.com/messages/CFC22NZ8A).\n\nIf you want to become a CanJS contributor, you simply have to:\n\n - [Email](mailto:contact@bitovi.com) the core team expressing your interest.\n - Attend the weekly DoneJS Contributors meeting twice a month. [DoneJS Calendar](https://www.google.com/calendar/embed?src=jupiterjs.com_g27vck36nifbnqrgkctkoanqb4%40group.calendar.google.com&ctz=America/Chicago).\n - Make one small contribution, even a spelling correction, a month.\n\nIssues that should be easy for a new contributor to pick up have an “easy” label. [This GitHub search](https://github.com/search?utf8=%E2%9C%93&q=user%3Acanjs+is%3Aopen+is%3Aissue+label%3AEasy&type=Issues) makes it easy to find easy issues across all the CanJS repositories.\n\n", + "description": "Welcome to CanJS! These guides are here to help you master CanJS development, get involved with the CanJS community,\nand contribute back to CanJS.\n\n", + "name": "guides", + "title": "Guides", + "type": "page", + "parent": "canjs", + "order": 1, + "templateRender": [ + "<%", + "%>" + ], + "subchildren": true, + "comment": " " + }, + "can-ajax": { + "name": "can-ajax", + "type": "module", + "parent": "can-dom-utilities", + "src": { + "line": 8, + "codeLine": 71, + "path": "node_modules/can-ajax/can-ajax.js" + }, + "body": "\n", + "description": "\nMake an asynchronous HTTP (AJAX) request.\n", + "title": "can-ajax", + "types": [ + { + "type": "function", "returns": { "types": [ { - "type": "Object", - "options": [] + "type": "undefined" } - ], - "description": "Returns the `target` argument.\n" - } + ] + }, + "params": [] } ], + "collection": "can-infrastructure", "package": { "author": { "name": "Bitovi", @@ -320,93 +1251,265 @@ "url": "https://www.bitovi.com/" }, "bugs": { - "url": "https://github.com/canjs/can-assign/issues" + "url": "https://github.com/canjs/can-ajax/issues" }, "bundleDependencies": false, "dependencies": { - "can-namespace": "1.0.0" + "can-globals": "<2.0.0", + "can-namespace": "^1.0.0", + "can-param": "^1.0.1", + "can-parse-uri": "^1.0.0", + "can-reflect": "^1.16.3" }, "deprecated": false, - "description": "A simplified version of Object.assign, which only accepts a single source argument.", + "description": "jQuery-inspired AJAX request library.", "devDependencies": { + "can-make-map": "^1.0.0", "detect-cyclic-packages": "^1.1.0", - "done-serve": "^3.3.1", - "donejs-cli": "^3.1.1", - "generator-donejs": "^3.3.0", + "http-server": "^0.11.1", "jshint": "^2.9.1", - "steal": "^2.2.1", + "steal": "^1.11.8", "steal-qunit": "^2.0.0", - "steal-tools": "^2.2.1", + "steal-tools": "^1.11.9", + "test-saucelabs": "0.0.6", "testee": "^0.9.0" }, - "homepage": "https://canjs.com/", + "homepage": "https://canjs.com/doc/can-ajax.html", "keywords": [ "canjs", - "object", - "assign" + "ajax", + "jquery", + "http", + "request" ], - "main": "can-assign", - "name": "can-assign", + "license": "MIT", + "main": "can-ajax", + "name": "can-ajax", "repository": { "type": "git", - "url": "git://github.com/canjs/can-assign.git" + "url": "git://github.com/canjs/can-ajax.git" }, "scripts": { "build": "node build.js", - "detect-cycle": "detect-cyclic-packages --ignore done-serve", - "develop": "done-serve --static --develop --port 8080", + "ci": "npm run test && node test/test-saucelabs.js", + "detect-cycle": "detect-cyclic-packages", + "http-server": "http-server -p 3000 --silent", "jshint": "jshint ./*.js --config", - "postpublish": "git push --tags && git checkout master && git branch -D release && git push", + "postpublish": "git push --tags && git checkout - && git branch -D release && git push", "preversion": "npm test && npm run build", "release:major": "npm version major && npm publish", "release:minor": "npm version minor && npm publish", "release:patch": "npm version patch && npm publish", "test": "npm run detect-cycle && npm run jshint && npm run testee", - "testee": "testee test.html --browsers firefox", + "testee": "testee test/test.html --browsers firefox", "version": "git commit -am \"Update version number\" && git checkout -b release && git add -f dist/" }, "steal": { - "configDependencies": [ - "live-reload" - ], + "main": "can-ajax", "npmIgnore": [ "testee", - "generator-donejs", - "donejs-cli", "steal-tools" ] }, - "version": "1.3.3" + "version": "2.4.6" }, - "_curParam": { - "types": [ - { - "type": "Object", - "options": [] + "signatures": [ + { + "code": "ajax( ajaxOptions )", + "description": "\n\n Is used to make an asynchronous HTTP (AJAX) request similar to [jQuery.ajax()](http://api.jquery.com/jQuery.ajax/).\n\n ```js\n import { ajax } from \"can\";\n\n ajax({\n url: \"http://query.yahooapis.com/v1/public/yql\",\n data: {\n format: \"json\",\n q: 'select * from geo.places where text=\"sunnyvale, ca\"'\n }\n }).then(function(response){\n console.log( response.query.count ); // => 2\n });\n ```\n", + "params": [ + { + "types": [ + { + "type": "Object", + "options": [] + } + ], + "name": "ajaxOptions", + "description": "Configuration options for the AJAX request.\n - __url__ `{String}` The requested url.\n - __type__ `{String}` The method of the request. Ex: `GET`, `PUT`, `POST`, etc. Capitalization is ignored. _Default is `GET`_.\n - __data__ `{Object}` The data of the request. If data needs to be urlencoded (e.g. for GET requests or for CORS) it is serialized with [can-param].\n - __dataType__ `{String}` Type of data. _Default is `json`_.\n - __crossDomain__ `{Boolean}` If you wish to force a crossDomain request (such as JSONP) on the same domain, set the value of crossDomain to true. This allows, for example, server-side redirection to another domain. Default: `false` for same-domain requests, `true` for cross-domain requests.\n - __xhrFields__ `{Object}` Any fields to be set directly on the xhr request, [https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest] such as the withCredentials attribute that indicates whether or not cross-site Access-Control requests should be made using credentials such as cookies or authorization headers.\n - __beforeSend__ `{callback}` A pre-request callback function that can be used to modify the XHR object before it is sent. Use this to set custom headers, etc. The XHR and settings objects are passed as arguments.\n - __success__ `{callback}` A callback passed the response body when the request completes without error. Using the promise returned from ajax() should be preferred to passing a success callback\n - __error__ `{callback}` A callback passed the XHR object when the request fails to complete correctly. Using the promise returned from ajax() should be preferred to passing an error callback\n - __async__ `{Boolean}` Set `async` to `false` to create a synchronous XHR that blocks the thread until the request completes. success() or error() is called synchronously on completion, but promise callbacks are still resolved asychronously. Synchronous AJAX calls are **not recommended** and are only supported here for legacy reasons.\n" + } + ], + "returns": { + "types": [ + { + "type": "Promise" + } + ], + "description": "A Promise that resolves to the data. The Promise instance is abortable and exposes an `abort` method. Invoking abort on the Promise instance indirectly rejects it.\n\n" } - ], - "name": "source", - "description": "The source object whose own properties will be applied to `target`.\n" - }, + }, + { + "code": "ajaxSetup( ajaxOptions )", + "description": "\n\n Is used to persist ajaxOptions across all ajax requests and they can be over-written in the ajaxOptions of the actual request.\n [https://api.jquery.com/jquery.ajaxsetup/]\n\n ```js\n import { ajax } from \"can\";\n\n ajax.ajaxSetup({xhrFields: {withCredentials: true}});\n\n ajax({\n url: \"http://query.yahooapis.com/v1/public/yql\",\n data: {\n format: \"json\",\n q: 'select * from geo.places where text=\"sunnyvale, ca\"'\n }\n }).then(function(response){\n console.log( response.query.count ); // => 2\n });\n ```\n", + "params": [] + } + ], "_curReturn": { "types": [ { - "type": "Object", - "options": [] + "type": "Promise" } ], - "description": "Returns the `target` argument.\n" + "description": "A Promise that resolves to the data. The Promise instance is abortable and exposes an `abort` method. Invoking abort on the Promise instance indirectly rejects it.\n\n" } }, - "can-attribute-encoder": { + "can-assign": { "type": "module", - "name": "can-attribute-encoder", - "params": [ - { - "name": "items", - "types": [ - { - "type": "*" + "name": "can-assign", + "parent": "can-js-utilities", + "src": { + "line": 2, + "codeLine": 29, + "path": "node_modules/can-assign/can-assign.js" + }, + "body": "\n```js\nvar assign = require(\"can-assign\");\n\nvar obj = {};\n\nassign(obj, {\n foo: \"bar\"\n});\n\nconsole.log(obj.foo); // -> \"bar\"\n```\n\n", + "description": "\nA simplified version of [Object.assign](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign), which only accepts a single source argument.\n", + "title": "can-assign", + "types": [ + { + "type": "function", + "returns": { + "types": [ + { + "type": "undefined" + } + ] + }, + "params": [] + } + ], + "collection": "can-infrastructure", + "signatures": [ + { + "code": "assign(target, source)", + "description": "", + "params": [ + { + "types": [ + { + "type": "Object", + "options": [] + } + ], + "name": "target", + "description": "The destination object. This object's properties will be mutated based on the object provided as `source`." + }, + { + "types": [ + { + "type": "Object", + "options": [] + } + ], + "name": "source", + "description": "The source object whose own properties will be applied to `target`.\n" + } + ], + "returns": { + "types": [ + { + "type": "Object", + "options": [] + } + ], + "description": "Returns the `target` argument.\n" + } + } + ], + "package": { + "author": { + "name": "Bitovi", + "email": "contact@bitovi.com", + "url": "https://www.bitovi.com/" + }, + "bugs": { + "url": "https://github.com/canjs/can-assign/issues" + }, + "bundleDependencies": false, + "dependencies": { + "can-namespace": "1.0.0" + }, + "deprecated": false, + "description": "A simplified version of Object.assign, which only accepts a single source argument.", + "devDependencies": { + "detect-cyclic-packages": "^1.1.0", + "done-serve": "^3.3.1", + "donejs-cli": "^3.1.1", + "generator-donejs": "^3.3.0", + "jshint": "^2.9.1", + "steal": "^2.2.1", + "steal-qunit": "^2.0.0", + "steal-tools": "^2.2.1", + "testee": "^0.9.0" + }, + "homepage": "https://canjs.com/", + "keywords": [ + "canjs", + "object", + "assign" + ], + "main": "can-assign", + "name": "can-assign", + "repository": { + "type": "git", + "url": "git://github.com/canjs/can-assign.git" + }, + "scripts": { + "build": "node build.js", + "detect-cycle": "detect-cyclic-packages --ignore done-serve", + "develop": "done-serve --static --develop --port 8080", + "jshint": "jshint ./*.js --config", + "postpublish": "git push --tags && git checkout master && git branch -D release && git push", + "preversion": "npm test && npm run build", + "release:major": "npm version major && npm publish", + "release:minor": "npm version minor && npm publish", + "release:patch": "npm version patch && npm publish", + "test": "npm run detect-cycle && npm run jshint && npm run testee", + "testee": "testee test.html --browsers firefox", + "version": "git commit -am \"Update version number\" && git checkout -b release && git add -f dist/" + }, + "steal": { + "configDependencies": [ + "live-reload" + ], + "npmIgnore": [ + "testee", + "generator-donejs", + "donejs-cli", + "steal-tools" + ] + }, + "version": "1.3.3" + }, + "_curParam": { + "types": [ + { + "type": "Object", + "options": [] + } + ], + "name": "source", + "description": "The source object whose own properties will be applied to `target`.\n" + }, + "_curReturn": { + "types": [ + { + "type": "Object", + "options": [] + } + ], + "description": "Returns the `target` argument.\n" + } + }, + "can-attribute-encoder": { + "type": "module", + "name": "can-attribute-encoder", + "params": [ + { + "name": "items", + "types": [ + { + "type": "*" } ] }, @@ -619,7 +1722,7 @@ "src": { "path": "node_modules/can-attribute-observable/can-attribute-observable.md" }, - "body": "\n## Use\n\nThe [guides/forms] guide is a great place to see how these are used internally by CanJS.\n\n## Special Keys\n\n`AttributeObservable` allows you to specify the following special key values:\n\n### Focused\n\nIf the value is focused or not:\n\n```html\n\n\n\n```\n
    \n\n### Values\n\nGet the checked `` as an array:\n\n```html\n\n\n\n```\n
    \n\n", + "body": "\n## Use\n\nThe [guides/forms] guide is a great place to see how these are used internally by CanJS.\n\n## Special Keys\n\n`AttributeObservable` allows you to specify the following special key values:\n\n### Focused\n\nIf the value is focused or not:\n\n```html\n\n\n\n```\n
    \n\n### Values\n\nGet the checked `` as an array:\n\n```html\n\n\n\n```\n
    \n\n", "description": "Create an observable value from an element's property or attribute. \n", "type": "module", "title": "", @@ -649,11 +1752,12 @@ "dependencies": { "can-assign": "^1.3.1", "can-diff": "^1.0.1", - "can-dom-data": "^1.0.1", + "can-dom-data": "^1.0.3", "can-dom-events": "^1.1.2", - "can-dom-mutate": "^1.0.3", + "can-dom-mutate": "^2.0.0", "can-event-dom-radiochange": "^2.1.0", "can-globals": "^1.0.1", + "can-log": "^1.0.2", "can-observation": "^4.0.1", "can-observation-recorder": "^1.0.2", "can-queues": "^1.0.1", @@ -665,6 +1769,7 @@ "deprecated": false, "description": "Create observables from HTML attributes.", "devDependencies": { + "can-test-helpers": "^1.1.4", "can-vdom": "^4.0.1", "detect-cyclic-packages": "^1.1.1", "jshint": "^2.9.5", @@ -687,7 +1792,7 @@ "test": "npm run detect-cycle && npm run jshint && npm run testee", "testee": "testee test/test.html --browsers firefox" }, - "version": "1.2.6" + "version": "2.0.2" }, "signatures": [ { @@ -739,15 +1844,19 @@ "codepen": [ [ "\"can\"", - "\"//unpkg.com/can@5/core.mjs\"" + "\"//unpkg.com/can@6/core.mjs\"" + ], + [ + "\"can/ecosystem\"", + "\"//unpkg.com/can@6/ecosystem.mjs\"" ], [ "\"can/everything\"", - "\"//unpkg.com/can@5/everything.mjs\"" + "\"//unpkg.com/can@6/everything.mjs\"" ], [ "\"can/demos/technology-overview/mock-url\"", - "\"//unpkg.com/mock-url@^5.0.0/mock-url.mjs\"" + "\"//unpkg.com/mock-url@^6.0.0/mock-url.mjs\"" ], [ "\"can/demos/technology-overview/route-mini-app-components\"", @@ -1379,8 +2488,8 @@ ], "parent": "node_modules/can-connect/connect.js", "src": { - "line": 3, - "codeLine": 10, + "line": 2, + "codeLine": 9, "path": "node_modules/can-connect/connect.js" }, "body": "", @@ -1397,6 +2506,200 @@ }, "hide": true }, + "can-connect.behaviors": { + "name": "can-connect.behaviors", + "title": "behaviors", + "type": "group", + "parent": "can-connect", + "description": "", + "order": 1 + }, + "can-connect.modules": { + "name": "can-connect.modules", + "title": "modules", + "type": "group", + "parent": "can-connect", + "description": "", + "order": 2 + }, + "can-connect.types": { + "name": "can-connect.types", + "title": "data types", + "type": "group", + "parent": "can-connect", + "description": "", + "order": 3 + }, + "can-connect.deprecated": { + "name": "can-connect.deprecated", + "title": "deprecated", + "type": "group", + "parent": "can-connect", + "description": "", + "order": 4 + }, + "can-connect": { + "src": { + "path": "node_modules/can-connect/can-connect.md" + }, + "body": "\n## Purpose\n\n`can-connect` provides a wide variety of functionality useful for building\n_data models_. _Data models_ are used to organize how an application\nconnects with persisted data. _Data models_ can greatly simplify higher order\nfunctionality like components. Most commonly, `can-connect` is used to\ncreate _data models_ that make it easy to create, retrieve, update, and\ndelete (CRUD) data by making HTTP requests to a backend server's service layer.\n\nUnfortunately, there is a wide variety of service layer APIs. While REST, JSONAPI,\nGRAPHQL and other specifications attempt to create a uniform service layer, a\none-size-all approach would leave many CanJS users having to build their own data layer from scratch.\n\nThus, `can-connect`'s primary design goal is flexibility and re-usability,\n__not ease of use__. Some assembly is required! For easier, pre-assembled, _data models_,\ncheckout:\n\n- [can-rest-model] - Connect a data type to a restful service layer.\n- [can-realtime-rest-model] - Same as [can-rest-model], but adds automatic list management.\n- [can-super-model] - Same as [can-realtime-rest-model], but adds fall-through localStorage caching.\n\n`can-connect` includes behaviors used to assemble _data models_. It includes the\nfollowing behaviors that:\n\n__Load data:__\n\n - [can-connect/data/url/url data/url] —\n Persist data to RESTful or other types of HTTP services.\n\n - [can-connect/data/parse/parse data/parse] —\n Convert response data into a format needed for other extensions.\n\n__Convert data into special types:__\n\n - [can-connect/constructor/constructor constructor/] —\n Create instances of a provided constructor function or list type.\n\n - [can-connect/constructor/store/store constructor/store] —\n Prevent multiple instances of a given id or multiple lists of a given set from being created.\n\n__Keep lists updated with the most current data:__\n\n - [can-connect/real-time/real-time real-time] —\n Lists updated when instances are created or deleted.\n\n__Implement caching strategies:__\n\n - [can-connect/fall-through-cache/fall-through-cache fall-through-cache] —\n Use [can-connect/base/base.cacheConnection cache] data if possible when creating instances,\n then update the instance with server data upon completion of a background request.\n\n - [can-connect/cache-requests/cache-requests cache-requests] —\n Cache response data and use it for future requests.\n\n - [can-connect/data/combine-requests/combine-requests data/combine-requests] —\n Combine overlapping or redundant requests.\n\n__Provide caching storage (as a [can-connect/base/base.cacheConnection cacheConnection]):__\n\n - [can-connect/data/localstorage-cache/localstorage-cache data/localstorage-cache] —\n LocalStorage caching connection.\n\n - [can-connect/data/memory-cache/memory-cache data/memory-cache] —\n In-memory caching connection.\n\n__Glue certain behaviors together:__\n\n - [can-connect/data/callbacks/callbacks data/callbacks] —\n Add callback hooks are passed the results of the DataInterface methods (CRUD operations).\n\n - [can-connect/data/callbacks-cache/callbacks-cache data/callbacks-cache] —\n Handle [can-connect/data/callbacks/callbacks data/callbacks] and update the [can-connect/base/base.cacheConnection cache]\n when CRUD operations complete.\n\n__Provide convenient integration with CanJS:__\n\n - [can-connect/can/map/map can/map] —\n Create [can-define/map/map] or [can-define/list/list] instances from responses. Adds connection-aware\n methods to configured types.\n\n - [can-connect/can/ref/ref can/ref] - Handle references to other instances in the raw data responses. \n\n - [can-connect/can/merge/merge can/merge] - Minimize updates to deeply nested instance data when new data is\n returned from the server.\n\n - [can-connect/can/constructor-hydrate/constructor-hydrate can/constructor-hydrate] - Always check the\n instanceStore when creating new instances of the connection Map type.\n\n\n\n## Overview\n\nThe `can-connect` module exports a `connect` function that is used to assemble different behaviors (plugins)\nand some configuration options into a `connection`. For example, the following uses `connect` and the\n[can-connect/constructor/constructor constructor/constructor] and [can-connect/data/url/url data/url] behaviors\nto create a `todoConnection` connection:\n\n```js\nimport connect from \"can-connect\";\nimport constructor from \"can-connect/constructor/\";\nimport dataUrl from \"can-connect/data/url/\";\n\nconst todoConnection = connect(\n\t[ constructor, dataUrl ],\n\t{ url: \"/services/todos\" }\n);\n```\n\nA typical connection provides the ability to create, read, update, or delete (CRUD) data hosted by some data\nsource. Those operations are usually performed via the connection [can-connect/InstanceInterface InstanceInterface]\nmethods:\n\n - [can-connect/connection.get]\n - [can-connect/connection.getList]\n - [can-connect/connection.save]\n - [can-connect/connection.destroy]\n\nFor example, to get all todos from \"GET /services/todos\", we could write the following:\n\n```js\ntodoConnection.getList( {} ).then( function( todos ) { /* ... */ } );\n```\n\n__Behaviors__, like [can-connect/constructor/constructor constructor/constructor] and [can-connect/data/url/url data/url]\nimplement, extend, or require some set of [interfaces](#Interfaces). For example, [can-connect/data/url/url data/url]\nimplements the [can-connect/DataInterface DataInterface] methods, and [can-connect/constructor/constructor constructor/constructor] implements\nthe [can-connect/InstanceInterface InstanceInterface] methods.\n\nThe `connect` method arranges these behaviors in the right order to create a connection. For instance, the\n[can-connect/cache-requests/cache-requests cache-requests] behavior must be applied after the [can-connect/data/url/url data/url]\nconnection. This is because [can-connect/cache-requests/cache-requests cache-requests], overwrites [can-connect/data/url/url data/url]’s\n[can-connect/connection.getListData connection.getListData] method to first check the cache for the data. Only if the\ndata is not found, does it call [can-connect/data/url/url data/urls]’s [can-connect/connection.getListData].\n\nThis behavior arranging makes it so even if we write:\n\n```js\nimport dataUrl from \"can-connect/data/url/\";\nimport cacheRequests from \"can-connect/cache-requests/\";\nconnect( [ cacheRequests, dataUrl ] );\n```\n\nor\n\n```\nconnect([dataUrl, cacheRequests])\n```\n\n... the connection will be built in the right order!\n\nA __connection__ is just an object with each specified behavior on its prototype chain and the passed options object\nat the end of the prototype chain.\n\n\n### Basic Use\n\nWhen starting out with `can-connect`, it’s advisable to start out with the most basic behaviors:\n[can-connect/data/url/url data/url] and [can-connect/constructor/constructor constructor/constructor].\n[can-connect/data/url/url data/url] adds an implementation of the [can-connect/DataInterface DataInterface] that connects to a RESTful data source.\n[can-connect/constructor/constructor constructor/constructor] adds an implementation of the [can-connect/InstanceInterface InstanceInterface]\nthat can create, read, update and delete typed data via the lower-level [can-connect/DataInterface DataInterface].\n\nBy \"typed\" data we mean data that is more than just plain JavaScript objects. For example, we want might to create\n`Todo` objects that implement an `isComplete` method:\n\n```js\nimport assign from \"can-assign\";\n\nconst Todo = function( props ) {\n\tassign( this, props );\n};\n\nTodo.prototype.isComplete = function() {\n\treturn this.status === \"complete\";\n};\n```\n\nAnd, we might want a special `TodoList` type with implementations of `completed` and `active` methods:\n\n```js\nconst TodoList = function( todos ) {\n\t[].push.apply( this, todos );\n};\nTodoList.prototype = Object.create( Array.prototype );\n\nTodoList.prototype.completed = function() {\n\treturn this.filter( function( todo ) {\n\t\treturn todo.status === \"complete\";\n\t} );\n};\n\nTodoList.prototype.active = function() {\n\treturn this.filter( function( todo ) {\n\t\treturn todo.status !== \"complete\";\n\t} );\n};\n```\n\nWe can create a connection that connects a RESTful \"/api/todos\" endpoint to `Todo` instances and `TodoList` lists like:\n\n```js\nimport connect from \"can-connect\";\n\nconst todoConnection = connect( [\n\trequire( \"can-connect/constructor/constructor\" ),\n\trequire( \"can-connect/data/url/url\" )\n], {\n\turl: \"/todos\",\n\tlist: function( listData, set ) {\n\t\treturn new TodoList( listData.data );\n\t},\n\tinstance: function( props ) {\n\t\treturn new Todo( props );\n\t}\n} );\n```\n\nand then use that connection to get a `TodoList` of `Todo`s and render some markup:\n\n```js\nconst render = function( todos ) {\n\treturn \"
      \" + todos.map( function( todo ) {\n\t\treturn \"
    • \" + todo.name +\n \"
    • \";\n\t} ).join( \"\" ) + \"
    \";\n};\n\ntodoConnection.getList( {} ).then( function( todos ) {\n\tconst todosEl = document.getElementById( \"todos-list\" );\n\ttodosEl.innerHTML = \"

    Active

    \" +\n render( todos.active() ) +\n \"

    Complete

    \" +\n render( todos.completed() );\n} );\n```\n\nThe following demo shows the result:\n\n
    \n\nThis connection also lets you create, update, and destroy a Todo instance. First create a todo instance:\n\n```js\nconst todo = new Todo( {\n\tname: \"take out trash\"\n} );\n```\n\nThen, use the connection's `save` to create and update the todo, and `destroy` to delete it:\n\n\n```js\n// POSTs to /api/todos with JSON request body {name:\"take out trash\"}\n// server returns {id: 5}\ntodoConnection.save( todo ).then( function( todo ) {\n\ttodo.id; //-> 5\n\ttodo.name = \"take out garbage\";\n\n\t// PUTs to /api/todos/5 with JSON request body {name:\"take out garbage\"}\n\t// server returns {id: 5, name:\"take out garbage\"}\n\ttodoConnection.save( todo ).then( function( todo ) {\n\n\t\t// DELETEs to /api/todos/5\n\t\t// server returns {}\n\t\ttodoConnection.destroy( todo ).then( function( todo ) {\n\n\t\t} );\n\t} );\n} );\n```\n\n### Behavior Configuration\n\nWhenever `connect` creates a connection, it always adds the [can-connect/base/base base] behavior.\nThis behavior is where the configuration options passed to `connect` are stored and it also defines\nseveral configurable options that are used by most other behaviors. For example, if your backend\nuses a property named `_id` to uniquely identify todos, you can specify this with\n[can-connect/base/base.queryLogic] like:\n\n```js\nimport constructor from \"can-connect/constructor/\";\nimport dataUrl from \"can-connect/data/url/\";\nimport QueryLogic from \"can-query-logic\";\n\nvar queryLogic = new QueryLogic({identity: [\"_id\"]});\n\nconst todoConnection = connect(\n\t[ constructor, dataUrl ],\n\t{\n\t\turl: \"/api/todos\",\n\t\tqueryLogic: queryLogic\n\t}\n);\n```\n\nBehaviors list their configurable options in their own documentation pages. \n\n### Behavior Overwriting\n\nIf the configuration options available for a behavior are not enough, it's possible to overwrite any\nbehavior with your own behavior.\n\nFor example, [can-connect/constructor/constructor constructor/constructor]’s\n[can-connect/constructor/constructor.updatedInstance updatedInstance] method sets the instance’s\nproperties to match the result of [can-connect/connection.updateData updateData]. But if the\n`PUT /api/todos/5 {name:\"take out garbage\"}` request returns `{}`, the following example would\nresult in a todo with only an `id` property:\n\n```js\nconst todo = new Todo( { id: 5, name: \"take out garbage\" } );\n\n// PUTs to /api/todos/5 with JSON request body {name:\"take out garbage\"}\n// server returns {}\ntodoConnection.save( todo ).then( function( todo ) {\n\ttodo.id; //-> 5\n\ttodo.name; //-> undefined\n} );\n```\n\nThe following overwrites [can-connect/constructor/constructor constructor/constructor]’s\nimplementation of `updateData`:\n\n```js\nimport constructor from \"can-connect/constructor/\";\nimport dataUrl from \"can-connect/data/url/\";\nconst mergeDataBehavior = {\n\tupdateData: function( instance, data ) {\n\t\tObject.assign( instance, data );\n\t}\n};\n\nconst todoConnection = connect( [\n\tconstructor,\n\tdataUrl,\n\tmergeDataBehavior\n], {\n\turl: \"/api/todos\"\n} );\n```\n\nYou can add your own behavior that can overwrite any underlying behaviors by adding it to the end\nof the behaviors list.\n\n\n### CanJS use\n\nIf you are using CanJS, you can either:\n\n- use the [can-connect/can/map/map can/map] behavior which provides many connection methods and\n settings to integrate closely with [can-define/map/map can-define/map] and\n [can-define/list/list can-define/list] types.\n\n- use the [can-connect/can/super-map/super-map can/super-map] helper to create a connection that\n bundles [can-connect/can/map/map can/map] and many of the other behaviors.\n\nUsing [can-connect/can/map/map can/map] to create a connection looks like:\n\n```js\nimport DefineMap from \"can-define/map/map\";\nimport DefineList from \"can-define/list/list\";\nimport dataUrl from \"can-connect/data/url/url\";\nimport constructor from \"can-connect/constructor/constructor\";\nimport constructorStore from \"can-connect/constructor/store/store\";\nimport canMap from \"can-connect/can/map/map\";\n\nconst Todo = DefineMap.extend( { /* ... */ } );\nTodo.List = DefineList.extend( {\n\t\"#\": Todo\n} );\n\nconst todoConnection = connect(\n\t[ dataUrl, constructor, constructorStore, canMap ],\n\t{\n\t\tMap: Todo,\n\t\turl: \"/todos\"\n\t}\n);\n```\n\nUsing [can-connect/can/super-map/super-map] to create a connection looks like:\n\n```js\nimport DefineMap from \"can-define/map/\";\nimport DefineList from \"can-define/list/\";\nimport superMap from \"can-connect/can/super-map/\";\n\nconst Todo = DefineMap.extend( { /* ... */ } );\nTodo.List = DefineList.extend( {\n\t\"#\": Todo\n} );\n\nconst todoConnection = superMap( {\n\tMap: Todo,\n\turl: \"/todos\"\n} );\n```\n\n\n\nBoth the above connections contain the [can-connect/constructor/store/store constructor/store] behavior.\nThis means when you create a binding to a `Todo` or `Todo.List` instance, they will automatically\ncall [can-connect/constructor/store/store.addInstanceReference constructor/store.addInstanceReference]\nor [can-connect/constructor/store/store.addListReference constructor/store.addListReference].\n[can-connect/constructor/store/store constructor/store] then retains the instance for the life\nof the binding and ensures only single shared instance of a particular piece of data exists. This\nprevents a common programming problem where multiple copies of an instance are held by parts of\nan application that loaded the same data.\n\n### Other use\n\nIntegrating `can-connect` with another framework is typically pretty easy. In general, the pattern involves creating\na behavior that integrates with your framework’s observable instances. The [can-connect/can/map/map can/map] behavior\ncan serve as a good guide. You’ll typically want to implement the following methods in your behavior:\n\n`.instance` - Creates the appropriate observable object type.\n`.list` - Creates the appropriate observable array type.\n`.serializeInstance` - Return a plain object out of the observable object type.\n`.serializeList` - Return a plain array out of the observable array type. \n\n`.createdInstance` - Update an instance with data returned from `createData`.\n`.updatedInstance` - Update an instance with data returned from `updateData`.\n`.destroyedInstance` - Update an instance with data returned from `destroyData`.\n`.updatedList` - Update a list with raw data.\n\nAnd, in most frameworks you know when a particular observable is being used, typically\nobserved, and when it can be discarded. In those places, you should call:\n\n- [can-connect/constructor/store/store.addInstanceReference] — when an instance is being used.\n- [can-connect/constructor/store/store.deleteInstanceReference] — when an instance is no longer being used.\n- [can-connect/constructor/store/store.addListReference] — when a list is being used.\n- [can-connect/constructor/store/store.deleteListReference] — when a list is no longer being used.\n\n\n## Interfaces\n\nThe following is a list of the primary interface methods and properties implemented or consumed by the core behaviors.\n\n### Identifiers\n\n`.id( props | instance ) -> String` - Returns a unique identifier for the instance or raw data. \n`.queryLogic -> QueryLogic - A [can-query-logic] instance that defines the unique property and query behavior.\n`.listQuery(list) -> set` - Returns the set a list represents. \n`.listQueryProp -> Symbol=can.listQuery` - The property on a List that contains its set. \n\nImplemented by the [can-connect/base/base base] behavior.\n\n### Instance Interface\n\nThe following methods operate on instances and lists.\n\n#### CRUD Methods\n\n`.getList(set) -> Promise` - Retrieve a list of instances. \n`.getData(set) -> Promise` - Retrieve a single instance. \n`.save(instance) -> Promise` - Create or update an instance. \n`.destroy(instance) -> Promise` - Destroy an instance. \n\nImplemented by [can-connect/constructor/constructor constructor/constructor] behavior.\n\nOverwritten by [can-connect/constructor/store/store constructor/store] and [can-connect/can/map/map can/map] behaviors.\n\n#### Instance Callbacks\n\n`.createdInstance(instance, props)` - Called whenever an instance is created. \n`.updatedInstance(instance, props)` - Called whenever an instance is updated. \n`.destroyedInstance(instance, props)` - Called whenever an instance is destroyed. \n`.updatedList(list, updatedListData, set)` - Called whenever a list has been updated. \n\nImplemented by [can-connect/constructor/constructor constructor/constructor] behavior.\n\nOverwritten by [can-connect/real-time/real-time real-time] and\n[can-connect/constructor/callbacks-once/callbacks-once constructor/callbacks-once] behaviors.\n\n#### Hydrators and Serializers\n\n`.instance(props) -> Instance` - Create an instance given raw data. \n`.list({data: Array}) -> List` - Create a list given an array of instances. \n`.hydrateInstance(props) -> Instance` - Provide an instance given raw data. \n`.hydrateList({ListData}, set) -> List` - Provide a list given raw data. \n`.hydratedInstance(instance)` - Called whenever an instance is created in memory. \n`.hydratedList(list, set)` - Called whenever a list is created in memory. \n`.serializeInstance(instance) -> Object` - Return the serialized form of an instance. \n`.serializeList(list) -> Array` - Return the serialized form of a list and its instances. \n\nImplemented by [can-connect/constructor/constructor constructor/constructor] behavior.\n\nOverwritten by [can-connect/constructor/store/store] and [can-connect/fall-through-cache/fall-through-cache] behaviors.\n\n#### Store Interface\n\n`.addInstanceReference(instance)` - Add a reference to an instance so that multiple copies can be avoided. \n`.deleteInstanceReference(instance)` - Remove a reference to an instance, freeing memory when an instance is no longer bound to.\n`.addListReference(list)` - Add a reference to a list so that multiple copies can be avoided. \n`.deleteListReference(list)` - Remove a reference to an list, freeing memory when a list is no longer bound to.\n\nImplemented by the [can-connect/constructor/store/store constructor/store] behavior.\n\n### Data Interface\n\nThe raw-data connection methods. \n\n#### CRUD Methods\n\n`.getListData(set) -> Promise` - Retrieve list data. \n`.updateListData(listData[, set]) -> Promise` - Update a list’s data.\n`.getSets() -> Promise>` - Return the sets available to the connection, typically those stored in a [can-connect/base/base.cacheConnection cache connection]. \n`.getData(params) -> Promise` - Retrieve data for a particular item. \n`.createData(props, cid) -> Promise` - Create a data store record given the serialized form of the data. A\n client ID is passed of the instance that is being created. \n`.updateData(props) -> Promise` - Update a data store record given the serialized form of the data. \n`.destroyData(props) -> Promise` - Delete a data store record given the serialized form of the data. \n`.clear() -> Promise` - Clear all data in the connection. Typically used to remove all data from a [connection.cacheConnection cache connection].\n\nImplemented by [can-connect/data/url/url data/url],\n[can-connect/data/localstorage-cache/localstorage-cache data/localstorage-cache] and\n[can-connect/data/memory-cache/memory-cache data/memory-cache] behaviors.\n\nOverwritten by [can-connect/cache-requests/cache-requests cache-requests],\n[can-connect/data/combine-requests/combine-requests combine-requests] and\n[can-connect/fall-through-cache/fall-through-cache fall-through-cache] behaviors.\n\nConsumed by [can-connect/constructor/constructor constructor/constructor] behavior. \n\n#### Data Callbacks\n\n`.gotListData(listData, set) -> ListaData` - Called whenever a list of data records are retrieved. \n`.gotData( props, params) -> props` - Called whenever an individual data record is retrieved. \n`.createdData( props, params, cid) -> props` - Called whenever an individual data record data is created. \n`.updatedData( props, params) -> props` - Called whenever an individual data record is updated. \n`.destroyedData( props, params) -> props` - Called whenever an individual data record is deleted. \n\nImplemented by the [can-connect/data/callbacks/callbacks data/callbacks] behavior.\n\nOverwritten by [can-connect/data/callbacks-cache/callbacks-cache data/callbacks-cache] and\n[can-connect/real-time/real-time real-time] behaviors.\n\n#### Response Parsers\n\n`.parseListData(*) -> ListData` - Given the response of getListData, return required object format. \n`.parseInstanceData(*) -> props` - Given the response of getData, createData, updateData, and destroyData,\nreturn the required object format.\n\nImplemented by the [can-connect/data/parse/parse data/parse] behavior.\n\n#### Real-time Methods\n\n`createInstance( props ) -> Promise` - Inform the connection a new data record has been created. \n`updateInstance( props ) -> Promise` - Inform the connection a data record has been updated. \n`destroyInstance( props ) -> Promise` - Inform the connection a data record has been destroyed. \n\nImplemented by the [can-connect/real-time/real-time real-time] behavior.\n\n## Creating Behaviors\n\nTo create your own behavior, call `connect.behavior` with the name of your behavior and a function that returns an\nobject that defines the hooks you want to overwrite or provide:\n\n```js\nconnect.behavior( \"my-behavior\", function( baseConnection ) {\n\treturn {\n\n\t\t// Hooks here\n\t};\n} );\n```\n\nFor example, creating a basic localStorage behavior might look like:\n\n```js\nconnect.behavior( \"localstorage\", function( baseConnection ) {\n\treturn {\n\t\tgetData: function( params ) {\n\t\t\tconst id = this.id( params );\n\t\t\treturn new Promise( function( resolve ) {\n\t\t\t\tconst data = localStorage.getItem( baseConnection.name + \"/\" + id );\n\t\t\t\tresolve( JSON.parse( data ) );\n\t\t\t} );\n\t\t},\n\t\tcreateData: function( props ) {\n\t\t\tconst id = localStorage.getItem( baseConnection.name + \"-ID\" ) || \"0\";\n\t\t\tconst nextId = JSON.parse( id ) + 1;\n\n\t\t\tlocalStorage.setItem( baseConnection.name + \"-ID\", nextId );\n\t\t\treturn new Promise( ( resolve ) => {\n\t\t\t\tprops[ this.queryLogic.identityKeys()[0] ] = nextId;\n\t\t\t\tlocalStorage.setItem( baseConnection.name + \"/\" + nextId, props );\n\t\t\t\tresolve( props );\n\t\t\t} );\n\t\t},\n\t\tupdateData: function() { /* ... */ },\n\t\tdestroyData: function() { /* ... */ }\n\t};\n} );\n```\n\n", + "description": "`can-connect` provides persisted data middleware. Assemble powerful model layers from fully modularized behaviors (i.e. plugins). \n\n", + "type": "module", + "title": "", + "types": [ + { + "type": "function", + "returns": { + "types": [ + { + "type": "undefined" + } + ] + }, + "params": [] + } + ], + "name": "can-connect", + "parent": "can-data-modeling", + "collection": "can-infrastructure", + "outline": { + "depth": 2 + }, + "package": { + "author": { + "name": "Bitovi" + }, + "bugs": { + "url": "https://github.com/canjs/can-connect/issues" + }, + "bundleDependencies": false, + "dependencies": { + "can-ajax": "^2.0.1", + "can-assign": "^1.3.3", + "can-construct": "^3.5.5", + "can-define": "^2.7.13", + "can-define-connected-singleton": "^0.2.0", + "can-diff": "<2.0.0", + "can-event-queue": "<2.0.0", + "can-globals": "^1.0.1", + "can-key": "<2.0.0", + "can-local-store": "<2.0.0", + "can-log": "^1.0.0", + "can-make-rest": "<2.0.0", + "can-memory-store": "<2.0.0", + "can-namespace": "1.0.0", + "can-observation-recorder": "<2.0.0", + "can-query-logic": "^1.0.0", + "can-queues": "<2.0.0", + "can-reflect": "^1.17.10", + "can-symbol": "^1.6.1", + "can-validate-interface": "^1.0.0" + }, + "deprecated": false, + "description": "Data connection middleware and utilities", + "devDependencies": { + "can-dom-events": "^1.1.0", + "can-fixture": "^3.1.7", + "can-list": "^4.0.0", + "can-map": "^4.0.0", + "can-observable-array": "^1.0.0", + "can-observable-object": "^1.0.0", + "can-observation": "^4.0.0", + "can-observe": "^2.1.3", + "can-set-legacy": "<2.0.0", + "can-simple-observable": "^2.0.0", + "can-test-helpers": "^1.1.2", + "can-type": "<2.0.0", + "http-server": "^0.11.0", + "jquery": "2.x - 3.x", + "jshint": "^2.9.4", + "steal": "^2.2.1", + "steal-css": "^1.0.0", + "steal-qunit": "^2.0.0", + "steal-tools": "^1.0.0", + "test-saucelabs": "^0.0.6", + "testee": "^0.9.0" + }, + "homepage": "https://github.com/canjs/can-connect#readme", + "keywords": [ + "CanJS" + ], + "license": "MIT", + "main": "can-connect.js", + "name": "can-connect", + "repository": { + "type": "git", + "url": "git+https://github.com/canjs/can-connect.git" + }, + "scripts": { + "build": "node build.js", + "ci": "npm run test && node test/test-saucelabs.js", + "http-server": "http-server -p 3000 --silent", + "jshint": "jshint --config .jshintrc --exclude ./node_modules,./dist .", + "postpublish": "git push --tags && git push", + "preversion": "npm test", + "release:major": "npm version major && npm publish", + "release:minor": "npm version minor && npm publish", + "release:patch": "npm version patch && npm publish", + "release:pre": "npm version prerelease && npm publish --tag=pre", + "test": "npm run jshint && testee --browsers firefox test/test.html" + }, + "steal": { + "plugins": [ + "steal-stache", + "steal-css" + ] + }, + "version": "4.0.2" + }, + "signatures": [ + { + "code": "connect(behaviors, options)", + "description": "\n\nIterate through passed behaviors and assemble them into a connection.\n\n```js\nimport connect from \"can-connect\";\nimport dataUrl from \"can-connect/data/url/\";\nimport connectConstructor from \"can-connect/constructor/\";\nconst todosConnection = connect( [ dataUrl, connectConstructor ], {\n\turl: \"/api/todos\"\n} );\n```\n", + "params": [ + { + "types": [ + { + "type": "Array", + "template": [ + { + "types": [ + { + "type": "can-connect/Behavior" + } + ] + } + ] + } + ], + "name": "behaviors", + "description": "\nAn array of behaviors that will be used to compose the final connection.\n" + }, + { + "types": [ + { + "type": "Object", + "options": [] + } + ], + "name": "options", + "description": "\nAn object of configuration parameters for the behaviors in the connection.\n\n" + } + ] + } + ], + "_curParam": { + "types": [ + { + "type": "Object", + "options": [] + } + ], + "name": "options", + "description": "\nAn object of configuration parameters for the behaviors in the connection.\n\n" + }, + "comment": " " + }, "can-connect-tag": { "src": { "path": "node_modules/can-connect-tag/can-connect-tag.md" @@ -1432,29 +2735,27 @@ }, "bundleDependencies": false, "dependencies": { - "can-dom-mutate": "^1.0.4", + "can-dom-mutate": "^2.0.0", "can-namespace": "^1.0.0", - "can-observation": "^4.0.1", + "can-observation": "^4.2.0", "can-observation-recorder": "^1.1.1", "can-reflect": "^1.16.3", - "can-stache": "^4.5.5", - "can-stache-bindings": "^4.2.5", + "can-stache": "^5.0.0", + "can-stache-bindings": "^5.0.0", "can-symbol": "^1.6.1", - "can-view-callbacks": "^4.1.2", - "can-view-nodelist": "^4.1.0", - "steal-stache": "^4.0.0" + "can-view-callbacks": "^5.0.0" }, "deprecated": false, "description": "Create custom elements for your connection models", "devDependencies": { - "can-connect": "^3.0.0-pre.9", + "can-connect": "^4.0.0", "can-define": "^2.3.3", "can-dom-events": "^1.2.0", "can-fixture": "^2.0.3", "can-list": "^4.0.2", "can-map": "^4.0.2", - "can-query-logic": "^0.8.10", - "can-set-legacy": "^0.3.0", + "can-query-logic": "^1.0.0", + "can-set-legacy": "^1.0.0", "can-simple-observable": "^2.0.5", "jquery": "^3.3.1", "jshint": "^2.9.1", @@ -1480,11 +2781,12 @@ "build": "node build.js", "develop": "done-serve --static --develop --port 8080", "jshint": "jshint ./*.js --config", - "postpublish": "git push --tags && git checkout master && git branch -D release && git push", + "postpublish": "git push --tags && git checkout - && git branch -D release && git push", "preversion": "npm test && npm run build", "release:major": "npm version major && npm publish", "release:minor": "npm version minor && npm publish", "release:patch": "npm version patch && npm publish", + "release:pre": "npm version prerelease && npm publish --tag pre", "test": "npm run jshint && npm run testee", "testee": "testee test.html --browsers firefox", "version": "git commit -am \"Update version number\" && git checkout -b release && git add -f dist/" @@ -1498,13 +2800,9 @@ "generator-donejs", "donejs-cli", "steal-tools" - ], - "plugins": [ - "steal-stache", - "steal-css" ] }, - "version": "1.0.1" + "version": "2.0.0" }, "signatures": [ { @@ -1544,146 +2842,253 @@ "description": "\n" } }, - "can-construct-super": { + "can-construct": { + "name": "can-construct", + "type": "module", + "description": " \nProvides a way to easily use the power of prototypal inheritance\nwithout worrying about hooking up all the particulars yourself. Use\n[can-construct.extend can-construct.extend] to create an inheritable\nconstructor function of your own.\n\n", "src": { - "path": "node_modules/can-construct-super/can-construct-super.md" + "path": "node_modules/can-construct/docs/construct.md" }, - "body": "\nWith this plugin, functions that are inheriting from base functions\nare provided with a specialized `this._super` reference to the base\nfunction from which they inherit.\n\nThis is especially useful for calling base classes' `[can-construct::init init]` and `[can-construct::setup setup]`, but it can be used in any inheriting function.\n\nThe `Person` and `Programmer` examples from `[can-construct::init init]` demonstrate `_super`'s use.\nHere's how those classes look without can.Construct.super:\n\n```\nvar Person = Construct.extend({\n init: function(first, last) {\n this.first = first;\n this.last = last;\n }\n});\n\nvar Programmer = Person.extend({\n init: function(first, last, language) {\n // call base's init\n Person.prototype.init.apply(this, arguments);\n\n // other initialization code\n this.language = language;\n },\n bio: function() {\n return \"Hi! I'm \" + this.first + \" \" + this.last +\n \" and I write \" + this.language + \".\";\n }\n});\n```\n\nAnd here's how `Programmer` works using `_super`:\n\n```\nvar Programmer = Person.extend({\n init: function(first, last, language) {\n // call base's init\n this._super(first, last);\n\n // other initialization code\n this.language = language;\n },\n bio: function() {\n return \"Hi! I'm \" + this.first + \" \" + this.last +\n \" and I write \" + this.language + \".\";\n }\n});\n```\n\nIf you want to pass an array of arguments (or an arguments object) to `_super`, use [apply](https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Function/apply):\n\n```\nvar Programmer = Person.extend({\n init: function(first, last, language) {\n // call base's init\n this._super.apply(this, arguments);\n\n // other initialization code\n this.language = language;\n },\n bio: function() {\n return \"Hi! I'm \" + this.first + \" \" + this.last +\n \" and I write \" + this.language + \".\";\n }\n});\n```\n\n## `_super` on constructors\n\ncan.Construct.super also adds `super` to the constructor, so you\ncan use it in static functions.\n\nHere is a base class that has a method that squares numbers and an inherited class that has a method that cubes numbers:\n\n```\nvar Squarer = can.Construct.extend({\n raise: function(n) {\n return n*n;\n }\n}, {});\n\nvar Cuber = Squarer.extend({\n raise: function(n) {\n return n * this._super(n);\n }\n}, {});\n```\n\n", - "description": "\ncan.Construct.super is a plugin that makes it easier to call base\nfunctions from inside inheriting functions.\n", - "type": "module", - "title": "", - "name": "can-construct-super", + "body": "\n## Use\n\nIn the example below, `Animal` is a constructor function returned by [can-construct.extend can-construct.extend]. All instances of `Animal` will have a `speak`\nmethod, and the `Animal` constructor has a `legs` property.\n\n```js\nimport Construct from \"can-construct\";\nconst Animal = Construct.extend( {\n\tlegs: 4\n},\n{\n\tspeak: function() {\n\t\tconsole.log( this.sound );\n\t}\n} );\n```\n\nAn optional [can-construct::setup setup] function can be specified to handle the instantiation of the constructor function.\n```js\nconst Animal = Construct.extend( {\n\tlegs: 4,\n\tsetup: function( sound ) {\n\t\treturn [ sound ];\n\t}\n},\n{\n\tspeak: function() {\n\t\tconsole.log( this.sound );\n\t}\n} );\n```\n[can-construct::setup setup] returns {Array|undefined} If an array is returned, the array's items are passed as arguments to [can-construct::init init].\n\nIn addition [can-construct::init init] can be specified which is a method that gets called with each new instance.\n```js\nconst Animal = Construct.extend( {\n\tlegs: 4,\n\tinit: function( sound ) {\n\t\tthis.sound = sound;\n\t}\n},\n{\n\tspeak: function() {\n\t\tconsole.log( this.sound );\n\t}\n} );\n```\n\nFor more information on deciding when to use [can-construct::setup setup] or [can-construct::init init]\nsee the bottom of the [can-construct::setup setup] documentation.\n\nYou can make instances of your object by calling your constructor function with the `new` keyword. When an object is created, the [can-construct::init init]\nmethod gets called (if you supplied one):\n\n```js\nconst panther = new Animal( \"growl\" );\npanther.speak(); // \"growl\"\npanther instanceof Animal; // true\n```\n\n## Plugins\n\nThere are plugins available to help make using `can-construct` even simpler.\n\n- [can-construct-super] allows you to easily call base methods by making `this._super` available in inherited methods.\n\n", + "title": "can-construct", + "types": [ + { + "type": "function", + "returns": { + "types": [ + { + "type": "undefined" + } + ] + }, + "params": [] + } + ], "parent": "can-typed-data", - "collection": "can-ecosystem", - "plugin": "can-construct-super", + "collection": "can-infrastructure", "package": { "author": { - "name": "Bitovi" + "name": "Bitovi", + "email": "contact@bitovi.com", + "url": "http://bitovi.com" }, "bugs": { - "url": "https://github.com/canjs/can-construct-super/issues" + "url": "https://github.com/canjs/can-construct/issues" }, "bundleDependencies": false, "dependencies": { - "can-construct": "^3.2.0", - "can-reflect": "^1.6.0" + "can-log": "^1.0.0", + "can-namespace": "1.0.0", + "can-reflect": "^1.16.1", + "can-string": "<2.0.0", + "can-symbol": "^1.6.4" }, "deprecated": false, - "description": "Provides a reference to the prototypal parent using this._super in can-construct objects", + "description": "easy constructor functions", "devDependencies": { - "bit-docs": "0.0.7", "detect-cyclic-packages": "^1.1.0", - "jshint": "^2.9.3", + "jshint": "^2.9.1", "steal": "^1.2.8", "steal-qunit": "^2.0.0", "steal-tools": "^1.1.2", "testee": "^0.9.0" }, - "homepage": "https://github.com/canjs/can-construct-super#readme", + "homepage": "http://canjs.com", "keywords": [ "canjs", + "canjs-plugin", "donejs" ], - "license": "MIT", - "main": "can-construct-super", - "name": "can-construct-super", + "main": "can-construct", + "name": "can-construct", "repository": { "type": "git", - "url": "git+https://github.com/canjs/can-construct-super.git" + "url": "git://github.com/canjs/can-construct.git" }, "scripts": { "build": "node build.js", "detect-cycle": "detect-cyclic-packages --ignore done-serve", - "develop": "done-serve --static --develop --port 8080", - "jshint": "jshint ./*.js --config", + "jshint": "jshint *.js --config", "postversion": "git push --tags && git checkout master && git branch -D release && git push", "preversion": "npm test && npm run build", "release:major": "npm version major && npm publish", "release:minor": "npm version minor && npm publish", "release:patch": "npm version patch && npm publish", - "release:pre": "npm version prerelease && npm publish --tag=pre", + "release:pre": "npm version prerelease && npm publish", "test": "npm run detect-cycle && npm run jshint && npm run testee", - "testee": "testee test/test.html --browsers firefox", + "testee": "testee test.html --browsers firefox", "version": "git commit -am \"Update dist for release\" && git checkout -b release && git add -f dist/" }, "steal": { - "main": "can-construct-super", - "npmIgnore": [ - "documentjs", - "testee", - "generator-donejs", - "donejs-cli", - "steal-tools" + "configDependencies": [ + "live-reload" ] }, - "version": "3.2.1" + "version": "3.5.6" }, "signatures": [ { - "code": "construct._super([...args])", - "description": "\n\nCalls the base constructor function's method.\n", + "code": "new Construct( ...args )", + "description": "\n\nCreates a new instance using Construct's constructor functions.\n", "params": [ { "types": [ { - "type": "Any" + "type": "*" } ], - "variable": true, + "optional": true, "name": "args", - "description": "parameters to pass to the base function\n" + "description": "The arguments passed to the constructor." } - ] + ], + "returns": { + "types": [ + { + "type": "Object", + "options": [] + } + ], + "description": "The instantiated object.\n" + } } ], "_curParam": { "types": [ { - "type": "Any" + "type": "*" } ], - "variable": true, + "optional": true, "name": "args", - "description": "parameters to pass to the base function\n" + "description": "The arguments passed to the constructor." + }, + "_curReturn": { + "types": [ + { + "type": "Object", + "options": [] + } + ], + "description": "The instantiated object.\n" }, "comment": " " }, - "can.Control.processor": { + "can-construct.static": { "src": { - "path": "node_modules/can-control/control.processor.md" + "line": 149, + "codeLine": 152, + "path": "node_modules/can-construct/can-construct.js" }, + "type": "static", "body": "", - "description": "A function that handles the binding and unbinding of a [can.Control]'s declarative event method. \n\n", - "type": "typedef", - "title": "", + "description": "\n", + "name": "can-construct.static", + "parent": "can-construct", + "title": "static" + }, + "can-construct.constructorExtends": { + "name": "can-construct.constructorExtends", + "type": "property", + "parent": "can-construct.static", + "src": { + "line": 153, + "codeLine": 220, + "path": "node_modules/can-construct/can-construct.js" + }, + "body": "\n If `constructorExtends` is:\n\n - `true` - the constructor extends\n - `false` - a new instance of the constructor is created\n\n This property defaults to false.\n\n Example of constructExtends as `true`:\n\n ```js\n var Animal = Construct.extend({\n constructorExtends: true // the constructor extends\n },{\n sayHi: function() {\n console.log(\"hai!\");\n }\n });\n\n var Pony = Animal({\n gallop: function () {\n console.log(\"Galloping!!\");\n }\n }); // Pony is now a constructor function extended from Animal\n\n var frank = new Animal(); // frank is a new instance of Animal\n\n var gertrude = new Pony(); // gertrude is a new instance of Pony\n gertrude.sayHi(); // \"hai!\" - sayHi is \"inherited\" from Animal\n gertrude.gallop(); // \"Galloping!!\" - gallop is unique to instances of Pony\n```\n\n The default behavior is shown in the example below:\n\n ```js\n var Animal = Construct.extend({\n constructorExtends: false // the constructor does NOT extend\n },{\n sayHi: function() {\n console.log(\"hai!\");\n }\n });\n\n var pony = Animal(); // pony is a new instance of Animal\n var frank = new Animal(); // frank is a new instance of Animal\n\n pony.sayHi() // \"hai!\"\n frank.sayHi() // \"hai!\"\n```\n By default to extend a constructor, you must use [can-construct.extend extend].\n\t \n", + "description": " Toggles the behavior of a constructor function called\n without the `new` keyword to extend the constructor function or\n create a new instance.\n\n ```js\n var animal = Animal();\n // vs\n var animal = new Animal();\n ```\n\n", "types": [ { - "type": "function", + "type": "Boolean" + } + ], + "title": "constructorExtends", + "comment": " " + }, + "can-construct.newInstance": { + "type": "function", + "name": "can-construct.newInstance", + "parent": "can-construct.static", + "src": { + "line": 221, + "codeLine": 286, + "path": "node_modules/can-construct/can-construct.js" + }, + "body": "Creates a new instance of the constructor function. This method is useful for creating new instances\nwith arbitrary parameters. Typically, however, you will simply want to call the constructor with the\n__new__ operator.\n\n## Example\n\nThe following creates a `Person` Construct and overrides `newInstance` to cache all\ninstances of Person to prevent duplication. If the properties of a new Person match an existing one it\nwill return a reference to the previously created object, otherwise it returns a new object entirely.\n\n```js\n// define and create the Person constructor\nvar Person = Construct.extend({\n init : function(first, middle, last) {\n this.first = first;\n this.middle = middle;\n this.last = last;\n }\n});\n\n// store a reference to the original newInstance function\nvar _newInstance = Person.newInstance;\n\n// override Person's newInstance function\nPerson.newInstance = function() {\n // if cache does not exist make it an new object\n this.__cache = this.__cache || {};\n // id is a stingified version of the passed arguments\n var id = JSON.stringify(arguments);\n\n // look in the cache to see if the object already exists\n var cachedInst = this.__cache[id];\n if(cachedInst) {\n return cachedInst;\n }\n\n //otherwise call the original newInstance function and return a new instance of Person.\n var newInst = _newInstance.apply(this, arguments);\n this.__cache[id] = newInst;\n return newInst;\n};\n\n// create two instances with the same arguments\nvar justin = new Person('Justin', 'Barry', 'Meyer'),\n\tbrian = new Person('Justin', 'Barry', 'Meyer');\n\nconsole.log(justin === brian); // true - both are references to the same instance\n```\n\n \n", + "description": "Returns an instance of `Construct`. This method can be overridden to return a cached instance.\n\n", + "title": "newInstance", + "signatures": [ + { + "code": "Construct.newInstance([...args])", + "description": "\n", + "params": [ + { + "types": [ + { + "type": "*" + } + ], + "optional": true, + "name": "args", + "description": "arguments that get passed to [can-construct::setup] and [can-construct::init]. Note\nthat if [can-construct::setup] returns an array, those arguments will be passed to [can-construct::init]\ninstead." + } + ], "returns": { "types": [ { - "type": "function", - "returns": { - "types": [ - { - "type": "undefined" - } - ] - }, - "params": [] + "type": "class" } ], - "description": "A callback function that unbinds any event handlers bound within this processor.\n" - }, + "description": "instance of the class\n" + } + } + ], + "_curParam": { + "types": [ + { + "type": "*" + } + ], + "optional": true, + "name": "args", + "description": "arguments that get passed to [can-construct::setup] and [can-construct::init]. Note\nthat if [can-construct::setup] returns an array, those arguments will be passed to [can-construct::init]\ninstead." + }, + "_curReturn": { + "types": [ + { + "type": "class" + } + ], + "description": "instance of the class\n" + }, + "comment": " " + }, + "can-construct.setup": { + "type": "function", + "name": "can-construct.setup", + "parent": "can-construct.static", + "src": { + "line": 339, + "codeLine": 400, + "path": "node_modules/can-construct/can-construct.js" + }, + "body": "The static `setup` method is called immediately after a constructor\nfunction is created and\nset to inherit from its base constructor. It is useful for setting up\nadditional inheritance work.\nDo not confuse this with the prototype `[can-construct::setup]` method.\n\n## Example\n\nThis `Parent` class adds a reference to its base class to itself, and\nso do all the classes that inherit from it.\n\n```js\nParent = Construct.extend({\n setup : function(base, fullName, staticProps, protoProps){\n this.base = base;\n\n // call base functionality\n Construct.setup.apply(this, arguments)\n }\n},{});\n\nParent.base; // Construct\n\nChild = Parent({});\n\nChild.base; // Parent\n```\n \n", + "description": "Perform initialization logic for a constructor function. \n", + "title": "setup", + "signatures": [ + { + "code": "Construct.setup(base, fullName, staticProps, protoProps)", + "description": "\n\nA static `setup` method provides inheritable setup functionality\nfor a Constructor function. The following example\ncreates a Group constructor function. Any constructor\nfunctions that inherit from Group will be added to\n`Group.childGroups`.\n\n```js\nGroup = Construct.extend({\n setup: function(Construct, fullName, staticProps, protoProps){\n this.childGroups = [];\n if(Construct !== Construct){\n this.childGroups.push(Construct)\n }\n Construct.setup.apply(this, arguments)\n }\n},{})\nvar Flock = Group.extend(...)\nGroup.childGroups[0] //-> Flock\n```", "params": [ { "types": [ { - "type": "HTMLElement" + "type": "constructor" } ], - "name": "element", - "description": "the control's element or the object \nspecified by the templated event handler (`\"{object}\"`).\n" + "name": "base", + "description": "The base constructor that is being inherited from." }, { "types": [ @@ -1691,83 +3096,120 @@ "type": "String" } ], - "name": "eventName", - "description": "The event type.\n" + "name": "fullName", + "description": "The name of the new constructor." }, { "types": [ { - "type": "CSSSelectorString" + "type": "Object", + "options": [] } ], - "name": "selector", - "description": "The selector preceding the event in the binding used on the Control.\n" + "name": "staticProps", + "description": "The static properties of the new constructor." }, { "types": [ { - "type": "function", - "returns": { - "types": [ - { - "type": "undefined" - } - ] - }, - "params": [ - { - "types": [ - { - "type": "Object", - "options": [] - } - ], - "name": "element", - "description": "foo" - }, - { - "types": [ - { - "type": "Event" - } - ], - "name": "event", - "description": "bar\n" - } - ], - "context": { - "types": [ - { - "type": "can.Control" - } - ] - } + "type": "Object", + "options": [] } ], - "name": "handler", - "description": "The callback function being bound.\n" + "name": "protoProps", + "description": "The prototype properties of the new constructor.\n" + } + ] + } + ], + "_curParam": { + "types": [ + { + "type": "Object", + "options": [] + } + ], + "name": "protoProps", + "description": "The prototype properties of the new constructor.\n" + }, + "comment": " " + }, + "can-construct.extend": { + "type": "function", + "name": "can-construct.extend", + "parent": "can-construct.static", + "src": { + "line": 415, + "codeLine": 593, + "path": "node_modules/can-construct/can-construct.js" + }, + "body": "## Inheritance\nCreating \"subclasses\" with `Construct` is simple. All you need to do is call the base constructor\nwith the new function's static and instance properties. For example, we want our `Snake` to\nbe an `Animal`, but there are some differences:\n\n\n var Snake = Animal.extend({\n legs: 0\n }, {\n init: function() {\n Animal.prototype.init.call(this, 'ssssss');\n },\n slither: function() {\n console.log('slithering...');\n }\n });\n\n var baslisk = new Snake();\n baslisk.speak(); // \"ssssss\"\n baslisk.slither(); // \"slithering...\"\n baslisk instanceof Snake; // true\n baslisk instanceof Animal; // true\n\n\n## Static properties and inheritance\n\nIf you pass all three arguments to Construct, the second one will be attached directy to the\nconstructor, allowing you to imitate static properties and functions. You can access these\nproperties through the `[can-construct::constructor this.constructor]` property.\n\nStatic properties can get overridden through inheritance just like instance properties. In the example below,\nwe override both the legs static property as well as the the init function for each instance:\n\n```js\nvar Animal = Construct.extend({\n legs: 4\n}, {\n init: function(sound) {\n this.sound = sound;\n },\n speak: function() {\n console.log(this.sound);\n }\n});\n\nvar Snake = Animal.extend({\n legs: 0\n}, {\n init: function() {\n this.sound = 'ssssss';\n },\n slither: function() {\n console.log('slithering...');\n }\n});\n\nAnimal.legs; // 4\nSnake.legs; // 0\nvar dog = new Animal('woof');\nvar blackMamba = new Snake();\ndog.speak(); // 'woof'\nblackMamba.speak(); // 'ssssss'\n```\n\n## Alternative value for a new instance\n\nSometimes you may want to return some custom value instead of a new object when creating an instance of your class.\nFor example, you want your class to act as a singleton, or check whether an item with the given id was already\ncreated and return an existing one from your cache store (e.g. using [can-connect/constructor/store/store]).\n\nTo achieve this you can return [can-construct.ReturnValue] from `setup` method of your class.\n\nLets say you have `myStore` to cache all newly created instances. And if an item already exists you want to merge\nthe new data into the existing instance and return the updated instance.\n\n```\nvar myStore = {};\n\nvar Item = Construct.extend({\n setup: function(params){\n if (myStore[params.id]){\n var item = myStore[params.id];\n\n // Merge new data to the existing instance:\n Object.assign(item, params);\n\n // Return the updated item:\n return new Construct.ReturnValue( item );\n } else {\n // Save to cache store:\n myStore[this.id] = this;\n\n return [params];\n }\n },\n init: function(params){\n Object.assign(this, params);\n }\n});\n\nvar item_1 = new Item( {id: 1, name: \"One\"} );\nvar item_1a = new Item( {id: 1, name: \"OnePlus\"} )\n```\n \n", + "description": "\n", + "title": "extend", + "signatures": [ + { + "code": "Construct.extend([name,] [staticProperties,] instanceProperties)", + "description": "\n\nExtends `Construct`, or constructor functions derived from `Construct`,\nto create a new constructor function. Example:\n\n```js\nvar Animal = Construct.extend({\n sayHi: function(){\n console.log(\"hi\")\n }\n});\n\nvar animal = new Animal()\nanimal.sayHi();\n```\n", + "params": [ + { + "types": [ + { + "type": "String" + } + ], + "optional": true, + "name": "name", + "description": "Adds a name to the constructor function so\nit is nicely labeled in the developer tools. The following:\n\n Construct.extend(\"ConstructorName\",{})\n\nreturns a constructur function that will show up as `ConstructorName`\nin the developer tools.\nIt also sets \"ConstructorName\" as [can-construct.shortName shortName].\n" }, { "types": [ { - "type": "can.Control" + "type": "Object", + "options": [] } ], - "name": "control", - "description": "The Control the event is bound on.\n" + "optional": true, + "name": "staticProperties", + "description": "Properties that are added the constructor\nfunction directly. For example:\n\n```js\nvar Animal = Construct.extend({\n findAll: function(){\n return can.ajax({url: \"/animals\"})\n }\n},{}); // need to pass an empty instanceProperties object\n\nAnimal.findAll().then(function(json){ ... })\n```\n\nThe [can-construct.setup static setup] method can be used to\nspecify inheritable behavior when a Constructor function is created.\n" + }, + { + "types": [ + { + "type": "Object", + "options": [] + } + ], + "name": "instanceProperties", + "description": "Properties that belong to\ninstances made with the constructor. These properties are added to the\nconstructor's `prototype` object. Example:\n\n var Animal = Construct.extend({\n\t findAll: function() {\n\t\treturn can.ajax({url: \"/animals\"});\n\t }\n },{\n init: function(name) {\n this.name = name;\n },\n sayHi: function() {\n console.log(this.name,\" says hai!\");\n }\n })\n var pony = new Animal(\"Gertrude\");\n pony.sayHi(); // \"Gertrude says hai!\"\n\nThe [can-construct::init init] and [can-construct::setup setup] properties\nare used for initialization.\n" } - ] + ], + "returns": { + "types": [ + { + "type": "function", + "returns": { + "types": [ + { + "type": "undefined" + } + ] + }, + "params": [] + } + ], + "description": "The constructor function.\n\n```js\nvar Animal = Construct.extend(...);\nvar pony = new Animal(); // Animal is a constructor function\n```" + } } ], - "name": "can.Control.processor", "_curParam": { "types": [ { - "type": "can.Control" + "type": "Object", + "options": [] } ], - "name": "control", - "description": "The Control the event is bound on.\n" + "name": "instanceProperties", + "description": "Properties that belong to\ninstances made with the constructor. These properties are added to the\nconstructor's `prototype` object. Example:\n\n var Animal = Construct.extend({\n\t findAll: function() {\n\t\treturn can.ajax({url: \"/animals\"});\n\t }\n },{\n init: function(name) {\n this.name = name;\n },\n sayHi: function() {\n console.log(this.name,\" says hai!\");\n }\n })\n var pony = new Animal(\"Gertrude\");\n pony.sayHi(); // \"Gertrude says hai!\"\n\nThe [can-construct::init init] and [can-construct::setup setup] properties\nare used for initialization.\n" }, "_curReturn": { "types": [ @@ -1783,188 +3225,77 @@ "params": [] } ], - "description": "A callback function that unbinds any event handlers bound within this processor.\n" + "description": "The constructor function.\n\n```js\nvar Animal = Construct.extend(...);\nvar pony = new Animal(); // Animal is a constructor function\n```" }, - "hide": true + "comment": " " }, - "can-data-types": { + "can-construct.shortName": { "src": { - "path": "node_modules/can-data-types/can-data-types.md" + "line": 679, + "codeLine": 693, + "path": "node_modules/can-construct/can-construct.js" }, - "body": "\n## Use\n\nThis package is used by [can-define] (and eventually [can-observe]) to define\ntypes. These types include a [can-reflect.getSchema] that enables them to be\nconverted to [can-query-logic] set types.\n\n```js\nimport {DefineMap, MaybeDate, MaybeString, MaybeNumber} from \"can\";\n\nconst Todo = DefineMap.extend({\n id: MaybeNumber,\n name: MaybeString,\n dueDate: MaybeDate\n});\n```\n\n", - "description": "A package of type objects that are used to test if a value is a member of the type and convert values to the type.\n\n", - "type": "module", - "title": "", + "type": "property", + "body": "\n```js\nvar MyConstructor = Construct.extend(\"MyConstructor\",{},{});\nMyConstructor.shortName // \"MyConstructor\"\n```\n\t\t \n", + "description": "\nIf you pass a name when creating a Construct, the `shortName` property will be set to the\nname.\n", "types": [ { - "type": "Object", - "options": [] + "type": "String" } ], - "name": "can-data-types", - "parent": "can-typed-data", - "collection": "can-infrastructure", - "package": { - "author": { - "name": "DoneJS Contributors", - "email": "core@donejs.com", - "url": "http://donejs.com" - }, - "bugs": { - "url": "https://github.com/canjs/can-data-types/issues" - }, - "bundleDependencies": false, - "dependencies": { - "can-namespace": "^1.0.0", - "can-reflect": "^1.16.1" - }, - "deprecated": false, - "description": "Reusable special data types", - "devDependencies": { - "can-symbol": "^1.6.1", - "jshint": "^2.9.1", - "steal": "^2.2.1", - "steal-qunit": "^2.0.0", - "steal-tools": "^2.2.1", - "testee": "^0.9.0" - }, - "homepage": "https://github.com/canjs/can-data-types#readme", - "keywords": [ - "canjs", - "donejs", - "donejs-plugin" - ], - "license": "MIT", - "main": "can-data-types", - "name": "can-data-types", - "repository": { - "type": "git", - "url": "git://github.com/canjs/can-data-types.git" - }, - "scripts": { - "build": "node build.js", - "develop": "done-serve --static --develop --port 8080", - "jshint": "jshint ./*.js --config", - "postpublish": "git push --tags && git push", - "preversion": "npm test", - "release:major": "npm version major && npm publish", - "release:minor": "npm version minor && npm publish", - "release:patch": "npm version patch && npm publish", - "test": "npm run jshint && npm run testee", - "testee": "testee test.html --browsers firefox" - }, - "steal": { - "main": "can-data-types", - "configDependencies": [ - "live-reload" - ], - "npmIgnore": [ - "testee", - "generator-donejs", - "donejs-cli", - "steal-tools" - ] - }, - "version": "1.2.1" - }, - "comment": " " + "title": "shortName", + "name": "can-construct.shortName", + "parent": "can-construct.static" }, - "can-define-connected-singleton": { + "can-construct.prototype": { "src": { - "path": "node_modules/can-define-connected-singleton/can-define-connected-singleton.md" + "line": 714, + "codeLine": 717, + "path": "node_modules/can-construct/can-construct.js" }, - "body": "\nSingleton decorator for can-define/map/map\n\n## Overview\n\nThis function is used to extend a DefineMap constructor so that a single instance of persisted data is easily referenced, very much like a singleton. This is useful for situations where you only want access to a single shared instance of a class whose data is loaded from a services. The primary use case for this is for referencing a user's session in a client application.\n\n## Usage\n\n```js\nimport singleton from 'can-define-connected-singleton';\nimport DefineMap from 'can-define/map/map';\n\n// function wrapper (recommended)\nconst MyType = singleton(\n\tDefineMap.extend({ ... })\n);\n\n// or as a *legacy* decorator\n// SEE: https://github.com/loganfsmyth/babel-plugin-transform-decorators-legacy\nconst MyType = DefineMap.extend({ ... });\n```\n\nFor a practical example of usage refer to the [guides/data-managing-sessions Managing Sessions data guide] which uses a [can-connect] behavior that includes the functionality from this module.\n\n## How does it work\n\nOnce you have decorated your class, the class will have three new static properties:\n\n- **`MyType.current`** - the current value for the singleton\n- **`MyType.currentPromise`** - the promise which should resolve to the value for the singleton\n- **`MyType.saving`** - the instance of the singleton currently active as part of an ongoing save request\n\nThe first time you read either `current` or `currentPromise`, the value will be loaded by calling the static `get` method on your class. The `get` method should return a Promise, and this promise will be stored on the static `currentPromise` property of your class:\n\n```js\nconst MyType = singleton(\n DefineMap.extend({ ... })\n);\n\n// define the static \"get\" method \n// NOTE: the can-map behavior for can-connect does this for you\nMyType.get = function() {\n return Promise.resolve('the value');\n}\n\n// triggers a call to MyType.get()\nMyType.current; //-> initially undefined\n\nMyType.currentPromise.then(value => {\n MyType.current === value; //-> true\n});\n```\n\nIf your service requires you to pass parameters as part of loading the singleton, e.g logging in to retrieve a session model, your application should use the `save` method on an instance of your class at some point prior to use of `current` or `currentPromise`. The `save` method should return a Promise, and this promise will be stored on the static `currentPromise` property of the class. The instance being saved will be stored on the static `saving` property of the class for the duration of the request:\n\n```js\nconst MyType = singleton(\n DefineMap.extend({ \n // define the static \"get\" method \n // NOTE: the can/map behavior for can-connect does this for you\n get: function() {\n return Promise.resolve('the value');\n },\n ...\n }, {\n // define the instance \"save\" method \n // NOTE: the can/map behavior for can-connect does this for you\n save: function() {\n return new Promise((resolve, reject) => {\n setTimeout(() => resolve(this), 1000);\n }); \n }\n })\n);\n\n\nconst instance = new MyType({ username: 'nils', password: 'foobar' });\nconst promise = instance.save();\n\nMyType.current; //-> initially undefined, doesn't start a request since .save is ongoing \nMyType.saving === instance; //-> true\nMyType.currentPromise === promise; //-> .currentPromise is the is the ongoing save request \nMyType.currentPromise.then(value => {\n MyType.current === value; //-> true\n MyType.current === instance; //-> true\n MyType.saving; //-> undefined after the .save finished \n});\n```\n \n\n## Configuration options\n\nBy default, the singleton decorator uses the following options:\n\n```js\n{\n currentPropertyName: 'current',\n savingPropertyName: 'saving',\n fetchMethodName: 'get',\n createMethodName: 'save',\n destroyMethodName: 'destroy'\n}\n```\n\nYou can specify your own options using the following syntax:\n\n```js\nconst options = {\n currentPropertyName: 'foo',\n fetchMethodName: 'doFoo'\n};\n\n// as a function wrapper (recommended)\nconst MyType = singleton( options )(\n\tDefineMap.extend({ ... })\n);\n\n// or as a decorator\nconst MyType = DefineMap.extend({ ... });\n```\n\nUsing the above options, your class would be decorated with `foo` and `fooPromise` properties instead of `current` and `currentPromise`, respectively. Furthermore, the static `doFoo` method will be invoked instead of the `get` method for loading the singleton data.\n", - "description": "\n# can-define-connected-singleton\n", - "name": "can-define-connected-singleton", - "type": "page", - "singleton": [ - true, - "( options )" - ] + "type": "prototype", + "body": "", + "description": "\t \n", + "name": "can-construct.prototype", + "parent": "can-construct", + "title": "prototype" }, - "can-define-lazy-value": { - "type": "module", - "name": "can-define-lazy-value", - "parent": "can-js-utilities", + "can-construct.prototype.constructor": { "src": { - "line": 1, - "codeLine": 42, - "path": "node_modules/can-define-lazy-value/define-lazy-value.js" + "line": 718, + "codeLine": 746, + "path": "node_modules/can-construct/can-construct.js" }, - "body": "", - "description": "", - "title": "", + "type": "property", + "body": "\n## Example\n\nThis Construct has a static counter that counts how many instances have been created:\n\n```js\nvar Counter = Construct.extend({\n count: 0\n}, {\n init: function() {\n this.constructor.count++;\n }\n});\n\nvar childCounter = new Counter();\nconsole.log(childCounter.constructor.count); // 1\nconsole.log(Counter.count); // 1\n```\n\t \n", + "description": "\nA reference to the constructor function that created the instance. This allows you to access\nthe constructor's static properties from an instance.\n", "types": [ { - "type": "function", - "returns": { - "types": [ - { - "type": "undefined" - } - ] - }, - "params": [] + "type": "Object", + "options": [] } ], - "collection": "can-infrastructure", - "package": { - "author": { - "name": "Bitovi", - "email": "contact@bitovi.com", - "url": "https://bitovi.com" - }, - "bugs": { - "url": "https://github.com/canjs/can-define-lazy-value/issues" - }, - "bundleDependencies": false, - "dependencies": {}, - "deprecated": false, - "description": "Define properties with lazy values using Object.defineProperty", - "devDependencies": { - "jshint": "^2.9.1", - "steal": "^2.2.1", - "steal-qunit": "^2.0.0", - "steal-tools": "^2.2.1", - "testee": "^0.9.0" - }, - "homepage": "https://canjs.com", - "keywords": [ - "canjs", - "donejs-plugin" - ], - "license": "MIT", - "main": "define-lazy-value", - "name": "can-define-lazy-value", - "repository": { - "type": "git", - "url": "git://github.com/canjs/can-define-lazy-value.git" - }, - "scripts": { - "build": "node build.js", - "jshint": "jshint ./*.js --config", - "postpublish": "git push --tags && git checkout master && git branch -D release && git push", - "preversion": "npm test && npm run build", - "release:major": "npm version major && npm publish", - "release:minor": "npm version minor && npm publish", - "release:patch": "npm version patch && npm publish", - "release:pre": "npm version prerelease && npm publish --tag=pre", - "test": "npm run jshint && npm run testee", - "testee": "testee test.html --browsers firefox", - "version": "git commit -am \"Update version number\" && git checkout -b release && git add -f dist/" - }, - "steal": { - "npmIgnore": [ - "testee", - "steal-tools" - ] - }, - "version": "1.1.1" + "title": "constructor", + "name": "can-construct.prototype.constructor", + "parent": "can-construct.prototype", + "comment": " " + }, + "can-construct.ReturnValue": { + "type": "function", + "name": "can-construct.ReturnValue", + "parent": "can-construct.static", + "src": { + "line": 746, + "codeLine": 780, + "path": "node_modules/can-construct/can-construct.js" }, + "body": "\n", + "description": "\nUse to overwrite the return value of new Construct(...).\n", + "title": "ReturnValue", "signatures": [ { - "code": "defineLazyValue(obj, prop, fn, writable)", - "description": "\n\nUse Object.defineProperty to define properties whose values will be created lazily when they are first read.\n\n```js\nvar _id = 1;\nfunction getId() {\n return _id++;\n}\n\nfunction MyObj(name) {\n this.name = name;\n}\n\ndefineLazyValue(MyObj.prototype, 'id', getId);\n\nvar obj1 = new MyObj('obj1');\nvar obj2 = new MyObj('obj2');\n\nconsole.log( obj2 ); // -> { name: \"obj2\" }\nconsole.log( obj1 ); // -> { name: \"obj1\" }\n\n// the first `id` read will get id `1`\nconsole( obj2.id ); // -> 1\nconsole( obj1.id ); // -> 2\n\nconsole.log( obj2 ); // -> { name: \"obj2\", id: 1 }\nconsole.log( obj1 ); // -> { name: \"obj1\", id: 2 }\n\n```\n", + "code": "new Construct.ReturnValue( value )", + "description": "\n\n This constructor function can be used for creating a return value of the `setup` method.\n [can-construct] will check if the return value is an instance of `Construct.ReturnValue`.\n If it is then its `value` will be used as the new instance.\n", "params": [ { "types": [ @@ -1973,43 +3304,8 @@ "options": [] } ], - "name": "object", - "description": "The object to add the property to." - }, - { - "types": [ - { - "type": "String" - } - ], - "name": "prop", - "description": "The name of the property." - }, - { - "types": [ - { - "type": "function", - "returns": { - "types": [ - { - "type": "undefined" - } - ] - }, - "params": [] - } - ], - "name": "fn", - "description": "A function to get the value the property should be set to." - }, - { - "types": [ - { - "type": "boolean" - } - ], - "name": "writable", - "description": "Whether the field should be writable (false by default).\n" + "name": "value", + "description": "A value to be used for a new instance instead of a new object.\n\n```js\nvar Student = function( name, school ){\n this.name = name;\n this.school = school;\n}\n\nvar Person = Construct.extend({\n setup: function( options ){\n if (options.school){\n return new Constructor.ReturnValue( new Student( options.name, options.school ) );\n } else {\n return [options];\n }\n }\n});\n\nvar myPerson = new Person( {name: \"Ilya\", school: \"PetrSU\"} );\n\nmyPerson instanceof Student // => true\n```\n" } ] } @@ -2017,329 +3313,263 @@ "_curParam": { "types": [ { - "type": "boolean" + "type": "Object", + "options": [] } ], - "name": "writable", - "description": "Whether the field should be writable (false by default).\n" + "name": "value", + "description": "A value to be used for a new instance instead of a new object.\n\n```js\nvar Student = function( name, school ){\n this.name = name;\n this.school = school;\n}\n\nvar Person = Construct.extend({\n setup: function( options ){\n if (options.school){\n return new Constructor.ReturnValue( new Student( options.name, options.school ) );\n } else {\n return [options];\n }\n }\n});\n\nvar myPerson = new Person( {name: \"Ilya\", school: \"PetrSU\"} );\n\nmyPerson instanceof Student // => true\n```\n" } }, - "can-define-object": { + "can-construct.prototype.setup": { "src": { - "path": "node_modules/can-define-object/doc/can-define-object.md" - }, - "body": "\n## Mixed-in instance methods and properties\n\nInstances of `DefineObject` have all methods and properties from\n[can-event-queue/map/map]:\n\n{{#each (getChildren [can-event-queue/map/map])}}\n- [{{name}}] - {{description}}{{/each}}\n\nExample:\n\n```js\nimport { DefineObject } from \"can/everything\";\n\nclass MyType extends DefineObject {\n static define = {\n prop: String\n };\n}\n\nconst myInstance = new MyType( {prop: \"VALUE\"} );\n\nmyInstance.on( \"prop\", ( event, newVal, oldVal ) => {\n\tconsole.log( newVal ); //-> \"VALUE\"\n\tconsole.log( oldVal ); //-> \"NEW VALUE\"\n} );\n\nmyInstance.prop = \"NEW VALUE\";\n```\n
    \n\n\n## Mixed-in type methods and properties\n\nExtended `DefineObject` classes have all methods and properties from\n[can-event-queue/type/type]:\n\n{{#each (getChildren [can-event-queue/type/type])}}\n- [{{name}}] - {{description}}{{/each}}\n\nExample:\n\n```js\nimport { DefineObject, Reflect as canReflect } from \"can/everything\";\n\nclass MyType extends DefineObject {\n static define = {\n prop: String\n };\n}\n\ncanReflect.onInstancePatches( MyType, ( instance, patches ) => {\n console.log(patches) //-> {key:\"prop\", type:\"set\", value:\"VALUE\"}\n} );\n\nlet instance = new MyType({prop: \"value\"});\ninstance.prop = \"VALUE\";\n```\n
    \n\n## Overview\n\n`can-define-object` is used to create easily extensible observable types with well defined behavior.\n\nFor example, a `Todo` type, with a `name` property, `completed` property, and a `toggle` method, might be defined like:\n\n```js\nimport { DefineObject } from \"can/everything\";\n\nclass Todo extends DefineObject {\n static define = {\n name: String,\n completed: false // default value\n };\n\n toggle() {\n this.completed = !this.completed;\n }\n}\n\nconst myTodo = new Todo({ name: \"my first todo!\" });\nmyTodo.toggle();\nconsole.log( myTodo ); //-> {name: \"my first todo!\", completed: true}\n```\n
    \n\nThe _Object_ set on `static define` defines the properties that will be\non _instances_ of a `Todo`. There are a lot of ways to define properties. The\n[can-define-object/object.types.definitionObject] type lists them all. Here, we define:\n\n - `name` as a property that will be type checked as a `String`.\n - `completed` as a property that will be type check as a `Boolean`\n with an initial value of `false`.\n\nThis also defines a `toggle` method that will be available on _instances_ of `Todo`.\n\n`Todo` is a constructor function. This means _instances_ of `Todo` can be be created by\ncalling `new Todo()` as follows:\n\n```js\nimport { DefineObject } from \"can/everything\";\n\nclass Todo extends DefineObject {\n static define = {\n name: String,\n completed: false\n };\n\n toggle() {\n this.completed = !this.completed;\n }\n}\n\nconst myTodo = new Todo();\nmyTodo.name = \"Do the dishes\";\nconsole.log( myTodo.completed ); //-> false\n\nmyTodo.toggle();\nconsole.log( myTodo.completed ); //-> true\n```\n
    \n
    \n\n## Typed properties\n\nDefineObject uses [can-type] to define typing rules for properties. It supports both strict typing (type checking) and loose typing (type conversion).\n\nIf a property is specified as a specific type, DefineObject will perform type checking. This means that if the `first` property in the example below is set to any value that is not a string, an error will be thrown:\n\n```js\nimport { DefineObject } from \"can/everything\";\n\nclass Person extends DefineObject {\n static define = {\n first: String\n };\n}\n\nconst person = new Person();\nperson.first = \"Justin\"; // -> 👌\n\nperson.first = false; // -> Uncaught Error: Type value 'false' is not of type String.\n```\n
    \n\n[can-type] also supports functions like [can-type/maybe type.maybe] and [can-type/convert type.convert] for handling other typing options. In the example below, `maybeNumber` can be a number or `null` or `undefined` and `alwaysString` will be converted to a string no matter what value is passed.\n\n```js\nimport { DefineObject, type } from \"can/everything\";\n\nclass Obj extends DefineObject {\n static define = {\n maybeNumber: type.maybe(Number),\n alwaysString: type.convert(String)\n };\n}\n\nconst obj = new Obj();\n\nobj.maybeNumber = 9; // -> 👌\nobj.maybeNumber = null; // -> 👌\nobj.maybeNumber = undefined; // -> 👌\nobj.maybeNumber = \"not a number\"; // -> Uncaught Error: Type value 'not a number' is not of type Number.\n\nobj.alwaysString = \"Hello\"; // -> 👌\nobj.alwaysString = 9; // -> 👌, converted to \"9\"\nobj.alwaysString = null; // -> 👌, converted to \"null\"\nobj.alwaysString = undefined; // -> 👌, converted to \"undefined\"\n```\n
    \n\nTo see all the ways types can be defined, check out the [can-type can-type docs].\n\n## Declarative properties\n\nArguably `can-define-object`'s most important ability is its support of declarative properties\nthat functionally derive their value from other property values. This is done by\ndefining [can-define-object/define/get getter] properties like `fullName` as follows:\n\n```js\nimport { DefineObject } from \"can/everything\";\n\nclass Person extends DefineObject {\n static define = {\n first: String,\n last: String\n };\n\n get fullName() {\n return this.first + \" \" + this.last;\n }\n}\n\nconst person = new Person({\n\tfirst: \"Justin\",\n\tlast: \"Meyer\"\n});\n\nconsole.log(person.fullName); //-> \"Justin Meyer\"\n```\n
    \n
    \n\nThis property can be bound to like any other property:\n\n```js\nimport { DefineObject } from \"can/everything\";\n\nclass Person extends DefineObject {\n static define = {\n first: String,\n last: String\n };\n\n get fullName() {\n return this.first + \" \" + this.last;\n }\n}\n\nconst me = new Person({\n\tfirst: \"Harry\",\n\tlast: \"Potter\"\n});\n\nme.on( \"fullName\", ( ev, newValue, oldValue ) => {\n\tconsole.log( newValue ); //-> Harry Henderson\n\tconsole.log( oldValue ); //-> Harry Potter\n} );\n\nme.last = \"Henderson\";\n```\n
    \n
    \n\n`getter` properties use [can-observation] internally. This means that when bound,\nthe value of the `getter` is cached and only updates when one of its source\nobservables change. For example:\n\n```js\nimport { DefineObject } from \"can/everything\";\n\nclass Person extends DefineObject {\n static define = {\n first: String,\n last: String,\n };\n\n get fullName() {\n console.log( \"calculating fullName\" );\n return this.first + \" \" + this.last;\n }\n}\n\nconst hero = new Person( { first: \"Wonder\", last: \"Woman\" } );\n\nhero.on( \"fullName\", () => {} );\n\nconsole.log( hero.fullName ); // logs \"calculating fullName\", \"Wonder Woman\"\n\nconsole.log( hero.fullName ); // \"Wonder Woman\"\n\nhero.first = \"Bionic\"; // logs \"calculating fullName\"\n\nhero.last = \"Man\"; // logs \"calculating fullName\"\n\nconsole.log( hero.fullName ); // logs \"Bionic Man\"\n```\n
    \n\n### Asynchronous properties\n\nProperties can also be asynchronous using `async(resolve)`. These are very useful when you have a type\nthat requires data from the server. For example, a DefineObject might take a `todoId` value, and want to make a `todo` property available:\n\n```js\nimport { DefineObject, ajax } from \"can/everything\";\n\nclass Todo extends DefineObject {\n static define = {\n todoId: Number,\n\n todo: {\n async(resolve, lastSetValue) {\n ajax( { url: \"/todos/\" + this.todoId } ).then( resolve );\n }\n }\n };\n}\n```\n\n\nAsync props are passed a `resolve` argument when bound. Typically in an application,\nyour template will automatically bind on the `todo` property. But to use it in a test might\nlook like:\n\n```js\nimport { DefineObject, ajax, fixture } from \"can/everything\";\n\nclass TodoViewModel extends DefineObject {\n static define = {\n todoId: Number,\n\n todo: {\n async(resolve, lastSetValue) {\n ajax( { url: \"/todos/\" + this.todoId } ).then( resolve );\n }\n }\n };\n}\n\nfixture( \"GET /todos/5\", () => {\n return { id: 5, name: \"take out trash\" };\n} );\n\nconst todoVM = new TodoViewModel( { todoId: 5 } );\n\ntodoVM.on( \"todo\", function( ev, newVal ) {\n console.log( newVal.name ) //-> \"take out trash\"\n} );\n\nconsole.log(todoVM.todo) //-> undefined\n```\n
    \n\n### Getter limitations\n\nThere's some functionality that a getter or an asynchronous property can not describe\ndeclaratively. For these situations, you can use [can-define-object/define/set] or\neven better, use [can-define-object/define/value].\n\nFor example, consider a __state__ and __city__ locator where you pick a United States\n__state__ like _Illinois_ and then a __city__ like _Chicago_. In this example,\nwe want to clear the choice of __city__ whenever the __state__ changes.\n\nThis can be implemented with [can-define-object/define/set] like:\n\n```js\nimport { DefineObject, type } from \"can/everything\";\n\nclass Locator extends DefineObject {\n static define = {\n state: {\n type: String,\n set() {\n this.city = null;\n }\n },\n city: type.maybe(String)\n };\n}\n\nconst locator = new Locator( {\n\tstate: \"IL\",\n\tcity: \"Chicago\"\n} );\n\nlocator.state = \"CA\";\nconsole.log( locator.city ); //-> null;\n```\n
    \n\nThe problem with this code is that it relies on side effects to manage the behavior of\n`city`. If someone wants to understand how `city` behaves, they might have to search all of the code for the Locator class.\n\nThe [can-define-object/define/value] behavior allows you to consolidate the\nbehavior of a property to a single place. For example, the following implements `Locator` with [can-define-object/define/value]:\n\n```js\nimport { DefineObject } from \"can/everything\";\n\nclass Locator extends DefineObject {\n static define = {\n state: String,\n\n city: {\n value({ lastSet, listenTo, resolve }) { \n // When city is set, update `city` with the set value.\n listenTo( lastSet, resolve );\n\n // When state is set, set `city` to null.\n listenTo( \"state\", () => {\n resolve( null );\n } );\n\n // Initialize the value to the `set` value.\n resolve( lastSet.get() );\n }\n }\n };\n}\n\nconst locator = new Locator( {\n\tstate: \"IL\",\n\tcity: \"Chicago\",\n} );\n\nlocator.state = \"CA\";\nconsole.log( locator.city ); //-> null\n```\n
    \n\nWhile [functional reactive programming](https://en.wikipedia.org/wiki/Functional_reactive_programming) (FRP) can take time to master at first, once you do, your code will be much easier to understand and\ndebug. The [can-define-object/define/value] behavior supports the basics of FRP programming - the ability to listen events and changes in other properties and `resolve` the property to a new value.\n\n## Sealed instances and strict mode\n\nBy default, `DefineObject` instances are __not__ [can-define-object/object.static.seal sealed]. This\nmeans that setting properties that are not defined when the constructor is defined will be set on those instances anyway.\n\n```js\nimport { DefineObject } from \"can/everything\";\n\nclass MyType extends DefineObject {\n static define = {\n myProp: String\n };\n}\n\nconst myType = new MyType();\n\nmyType.otherProp = \"value\"; // no error thrown\n```\n
    \n\nSetting the extended DefineObject to be sealed will instead result in throwing an error in files that are in [strict mode](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode). For example:\n\n```js\nimport { DefineObject } from \"can/everything\";\n\nclass MyType extends DefineObject {\n static define = {\n myProp: String\n };\n\n static seal = true;\n}\n\nconst myType = new MyType();\n\ntry {\n myType.otherProp = \"value\"; // error!\n} catch(err) {\n console.log(err.message);\n}\n```\n
    \n
    \n\nRead the [can-define/map/map.seal] documentation for more information on this behavior.\n\n", - "description": "Create observable objects used to manage state in explicitly defined ways. \n", - "name": "can-define-object", - "type": "module", - "types": [ - { - "type": "function", - "returns": { - "types": [ - { - "type": "undefined" - } - ] - }, - "params": [] - } - ], - "parent": "can-observables", - "collection": "can-ecosystem", - "alias": "can.DefineObject", - "outline": { - "depth": 2 + "line": 784, + "codeLine": 831, + "path": "node_modules/can-construct/can-construct.js" }, - "templateRender": true, + "type": "function", + "body": "\n## Deciding between `setup` and `init`\n\n\nUsually, you should use [can-construct::init init] to do your constructor function's initialization.\nYou should, instead, use `setup` when:\n\n - there is initialization code that you want to run before the inheriting constructor's\n `init` method is called.\n - there is initialization code that should run whether or not inheriting constructors\n call their base's `init` methods.\n - you want to modify the arguments that will get passed to `init`.\n\n\n", + "description": "\n", + "title": "setup", + "name": "can-construct.prototype.setup", + "parent": "can-construct.prototype", "signatures": [ { - "code": "class extends DefineObject", - "description": "\n\n Extending `DefineObject` creates a new class using the class body to configure [can-define-object/object.static.define defines], methods, getters, and setters.\n\n ```js\n import { DefineObject } from \"can/everything\";\n\n class Scientist extends DefineObject {\n static define = {\n name: String,\n occupation: String\n };\n\n get title() {\n return `${this.name}: ${this.occupation}`;\n }\n }\n\n let ada = new Scientist({\n name: \"Ada Lovelace\",\n occupation: \"Mathematician\"\n });\n\n console.log( ada.title ); // -> \"Ada Lovelace: Mathematician\"\n ```\n
    \n\n\n Use extends to create classes for models, ViewModels, and [can-stache-define-element custom elements].\n", - "params": [], - "returns": { - "types": [ - { - "type": "Constructor" - } - ], - "description": "An extended class that can be instantiated using `new`.\n" - } - }, - { - "code": "new DefineObject([props])", - "description": "\n\n Calling `new DefineObject(props)` creates a new instance of DefineObject or an extended DefineObject. Then, `new DefineObject(props)` assigns every property on `props` to the new instance. If props are passed that are not defined already, those properties are set on the instance. If the instance should be [can-define-object/object.static.seal sealed], it is sealed.\n\n ```js\n import { DefineObject } from \"can/everything\";\n\n const person = new DefineObject( {\n\t\tfirst: \"Justin\",\n\t\tlast: \"Meyer\"\n } );\n\n console.log( person ); //-> {first: \"Justin\", last: \"Meyer\"}\n ```\n
    \n\n\n Custom `DefineObject` types, with special properties and behaviors, can be defined with the [extends signature](#classextendsDefineObject).\n", + "code": "construct.setup(...args)", + "description": "\n\nA setup function for the instantiation of a constructor function.\n", "params": [ { "types": [ { - "type": "Object", - "options": [] + "type": "*" } ], - "optional": true, - "name": "props", - "description": "Properties and values to seed the map with." + "name": "args", + "description": "The arguments passed to the constructor.\n" } ], "returns": { "types": [ { - "type": "can-define-object" + "type": "Array" + }, + { + "type": "undefined" + }, + { + "type": "can-construct.ReturnValue" } ], - "description": "An instance of `DefineObject` with the properties from _props_.\n" + "description": "If an array is returned, the array's items are passed as\narguments to [can-construct::init init]. If a [can-construct.ReturnValue] instance is returned, the ReturnValue\ninstance's value will be returned as the result of calling new Construct(). The following example always makes\nsure that init is called with a jQuery wrapped element:\n\n```js\n\tWidgetFactory = Construct.extend({\n\t\t\tsetup: function(element){\n\t\t\t\t\treturn [$(element)]\n\t\t\t}\n\t});\n\n\tMyWidget = WidgetFactory.extend({\n\t\t\tinit: function($el){\n\t\t\t\t\t$el.html(\"My Widget!!\")\n\t\t\t}\n\t});\n ```\n\nOtherwise, the arguments to the\nconstructor are passed to [can-construct::init] and the return value of `setup` is discarded.\n" } } ], - "codepen": [ - [ - "\"can\"", - "\"//unpkg.com/can@5/core.mjs\"" - ], - [ - "\"can/everything\"", - "\"//unpkg.com/can@5/everything.mjs\"" - ], - [ - "\"can/demos/technology-overview/mock-url\"", - "\"//unpkg.com/mock-url@^5.0.0/mock-url.mjs\"" - ], - [ - "\"can/demos/technology-overview/route-mini-app-components\"", - "\"//unpkg.com/route-mini-app@^5.0.0/components.mjs\"" - ], - [ - "return steal.import(", - "return import(" - ], - [ - "\"can/demos/technology-overview/page-login\"", - "\"//unpkg.com/route-mini-app@^5.0.0/page-login.mjs\"" - ], - [ - "`can/demos/technology-overview/page-${this.page}`", - "`//unpkg.com/route-mini-app@^5.0.0/page-${this.page}.mjs`" - ] - ], - "_curReturn": { + "_curParam": { "types": [ { - "type": "can-define-object" + "type": "*" } ], - "description": "An instance of `DefineObject` with the properties from _props_.\n" + "name": "args", + "description": "The arguments passed to the constructor.\n" }, - "_curParam": { + "_curReturn": { "types": [ { - "type": "Object", - "options": [] + "type": "Array" + }, + { + "type": "undefined" + }, + { + "type": "can-construct.ReturnValue" } ], - "optional": true, - "name": "props", - "description": "Properties and values to seed the map with." + "description": "If an array is returned, the array's items are passed as\narguments to [can-construct::init init]. If a [can-construct.ReturnValue] instance is returned, the ReturnValue\ninstance's value will be returned as the result of calling new Construct(). The following example always makes\nsure that init is called with a jQuery wrapped element:\n\n```js\n\tWidgetFactory = Construct.extend({\n\t\t\tsetup: function(element){\n\t\t\t\t\treturn [$(element)]\n\t\t\t}\n\t});\n\n\tMyWidget = WidgetFactory.extend({\n\t\t\tinit: function($el){\n\t\t\t\t\t$el.html(\"My Widget!!\")\n\t\t\t}\n\t});\n ```\n\nOtherwise, the arguments to the\nconstructor are passed to [can-construct::init] and the return value of `setup` is discarded.\n" }, "comment": " " }, - "can-deparam": { - "name": "can-deparam", - "type": "module", - "parent": "can-routing", + "can-construct.prototype.init": { "src": { - "line": 3, - "codeLine": 39, - "path": "node_modules/can-deparam/can-deparam.js" + "line": 832, + "codeLine": 891, + "path": "node_modules/can-construct/can-construct.js" }, - "body": "\n## Try it\n\nUse this JS Bin to play around with this package:\n\ncan-deparam on jsbin.com\n\n\n", - "description": "Deserialize a query string into an array or object. ", - "title": "can-deparam", - "types": [ + "type": "function", + "body": "If a prototype `init` method is provided, `init` is called when a new Construct is created---\nafter [can-construct::setup]. The `init` method is where the bulk of your initialization code\nshould go. A common thing to do in `init` is save the arguments passed into the constructor.\n\n## Examples\n\nFirst, we'll make a Person constructor that has a first and last name:\n\n```js\nvar Person = Construct.extend({\n init: function(first, last) {\n this.first = first;\n this.last = last;\n }\n});\n\nvar justin = new Person(\"Justin\", \"Meyer\");\njustin.first; // \"Justin\"\njustin.last; // \"Meyer\"\n```\n\nThen, we'll extend Person into Programmer, and add a favorite language:\n\n```js\nvar Programmer = Person.extend({\n init: function(first, last, language) {\n // call base's init\n Person.prototype.init.apply(this, arguments);\n\n // other initialization code\n this.language = language;\n },\n bio: function() {\n return \"Hi! I'm \" + this.first + \" \" + this.last +\n \" and I write \" + this.language + \".\";\n }\n});\n\nvar brian = new Programmer(\"Brian\", \"Moschel\", 'ECMAScript');\nbrian.bio(); // \"Hi! I'm Brian Moschel and I write ECMAScript.\";\n```\n\n## Modified Arguments\n\n[can-construct::setup] is able to modify the arguments passed to `init`.\nIf you aren't receiving the arguments you passed to `new Construct(args)`,\ncheck that they aren't being changed by `setup` along\nthe inheritance chain.\n\n", + "description": "Called when a new instance of a Construct is created. \n", + "title": "init", + "name": "can-construct.prototype.init", + "parent": "can-construct.prototype", + "signatures": [ { - "type": "function", - "returns": { - "types": [ - { - "type": "undefined" - } - ] - }, - "params": [] + "code": "construct.init(...args)", + "description": "", + "params": [ + { + "types": [ + { + "type": "*" + } + ], + "name": "args", + "description": "the arguments passed to the constructor (or the items of the array returned from [can-construct::setup])\n" + } + ] } ], - "collection": "can-infrastructure", + "_curParam": { + "types": [ + { + "type": "*" + } + ], + "name": "args", + "description": "the arguments passed to the constructor (or the items of the array returned from [can-construct::setup])\n" + }, + "comment": " " + }, + "can-construct-super": { + "src": { + "path": "node_modules/can-construct-super/can-construct-super.md" + }, + "body": "\nWith this plugin, functions that are inheriting from base functions\nare provided with a specialized `this._super` reference to the base\nfunction from which they inherit.\n\nThis is especially useful for calling base classes' `[can-construct::init init]` and `[can-construct::setup setup]`, but it can be used in any inheriting function.\n\nThe `Person` and `Programmer` examples from `[can-construct::init init]` demonstrate `_super`'s use.\nHere's how those classes look without can.Construct.super:\n\n```\nvar Person = Construct.extend({\n init: function(first, last) {\n this.first = first;\n this.last = last;\n }\n});\n\nvar Programmer = Person.extend({\n init: function(first, last, language) {\n // call base's init\n Person.prototype.init.apply(this, arguments);\n\n // other initialization code\n this.language = language;\n },\n bio: function() {\n return \"Hi! I'm \" + this.first + \" \" + this.last +\n \" and I write \" + this.language + \".\";\n }\n});\n```\n\nAnd here's how `Programmer` works using `_super`:\n\n```\nvar Programmer = Person.extend({\n init: function(first, last, language) {\n // call base's init\n this._super(first, last);\n\n // other initialization code\n this.language = language;\n },\n bio: function() {\n return \"Hi! I'm \" + this.first + \" \" + this.last +\n \" and I write \" + this.language + \".\";\n }\n});\n```\n\nIf you want to pass an array of arguments (or an arguments object) to `_super`, use [apply](https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Function/apply):\n\n```\nvar Programmer = Person.extend({\n init: function(first, last, language) {\n // call base's init\n this._super.apply(this, arguments);\n\n // other initialization code\n this.language = language;\n },\n bio: function() {\n return \"Hi! I'm \" + this.first + \" \" + this.last +\n \" and I write \" + this.language + \".\";\n }\n});\n```\n\n## `_super` on constructors\n\ncan.Construct.super also adds `super` to the constructor, so you\ncan use it in static functions.\n\nHere is a base class that has a method that squares numbers and an inherited class that has a method that cubes numbers:\n\n```\nvar Squarer = can.Construct.extend({\n raise: function(n) {\n return n*n;\n }\n}, {});\n\nvar Cuber = Squarer.extend({\n raise: function(n) {\n return n * this._super(n);\n }\n}, {});\n```\n\n", + "description": "\ncan.Construct.super is a plugin that makes it easier to call base\nfunctions from inside inheriting functions.\n", + "type": "module", + "title": "", + "name": "can-construct-super", + "parent": "can-typed-data", + "collection": "can-ecosystem", + "plugin": "can-construct-super", "package": { "author": { - "name": "Bitovi", - "email": "contact@bitovi.com", - "url": "https://www.bitovi.com/" + "name": "Bitovi" }, "bugs": { - "url": "https://github.com/canjs/can-deparam/issues" + "url": "https://github.com/canjs/can-construct-super/issues" }, "bundleDependencies": false, "dependencies": { - "can-namespace": "1.0.0" + "can-construct": "^3.2.0", + "can-reflect": "^1.6.0" }, "deprecated": false, - "description": "Deserialize a query string into an array or object.", + "description": "Provides a reference to the prototypal parent using this._super in can-construct objects", "devDependencies": { - "can-string-to-any": "^1.0.1", + "bit-docs": "0.0.7", "detect-cyclic-packages": "^1.1.0", - "jshint": "^2.9.1", - "steal": "^2.2.1", + "jshint": "^2.9.3", + "steal": "^1.2.8", "steal-qunit": "^2.0.0", - "steal-tools": "^2.2.1", + "steal-tools": "^1.1.2", "testee": "^0.9.0" }, - "homepage": "https://canjs.com/doc/can-deparam.html", + "homepage": "https://github.com/canjs/can-construct-super#readme", "keywords": [ "canjs", - "query string" + "donejs" ], - "main": "can-deparam", - "name": "can-deparam", + "license": "MIT", + "main": "can-construct-super", + "name": "can-construct-super", "repository": { "type": "git", - "url": "git://github.com/canjs/can-deparam.git" + "url": "git+https://github.com/canjs/can-construct-super.git" }, "scripts": { "build": "node build.js", "detect-cycle": "detect-cyclic-packages --ignore done-serve", "develop": "done-serve --static --develop --port 8080", "jshint": "jshint ./*.js --config", - "postpublish": "git push --tags && git checkout master && git branch -D release && git push", + "postversion": "git push --tags && git checkout master && git branch -D release && git push", "preversion": "npm test && npm run build", "release:major": "npm version major && npm publish", "release:minor": "npm version minor && npm publish", "release:patch": "npm version patch && npm publish", + "release:pre": "npm version prerelease && npm publish --tag=pre", "test": "npm run detect-cycle && npm run jshint && npm run testee", - "testee": "testee test.html --browsers firefox", - "version": "git commit -am \"Update version number\" && git checkout -b release && git add -f dist/" + "testee": "testee test/test.html --browsers firefox", + "version": "git commit -am \"Update dist for release\" && git checkout -b release && git add -f dist/" }, "steal": { - "configDependencies": [ - "live-reload" - ], + "main": "can-construct-super", "npmIgnore": [ + "documentjs", "testee", "generator-donejs", "donejs-cli", "steal-tools" ] }, - "version": "1.2.1" + "version": "3.2.1" }, "signatures": [ { - "code": "deparam(params)", - "description": "\n", + "code": "construct._super([...args])", + "description": "\n\nCalls the base constructor function's method.\n", "params": [ { "types": [ { - "type": "String" - } - ], - "name": "params", - "description": "A form-urlencoded string of key-value pairs." - }, - { - "types": [ - { - "type": "function", - "returns": { - "types": [ - { - "type": "undefined" - } - ] - }, - "params": [] + "type": "Any" } ], - "optional": true, - "name": "valueDeserializer", - "description": "A function that decodes the string values. For example, using\n[can-string-to-any] will convert `\"null\"` to `null` like:\n\n ```js\n import stringToAny from \"can-string-to-any\";\n deparam(\"value=null\", stringToAny) //-> {value: null}\n ```" + "variable": true, + "name": "args", + "description": "parameters to pass to the base function\n" } - ], - "returns": { - "types": [ - { - "type": "Object", - "options": [] - } - ], - "description": "The params formatted into an object\n\nTakes a string of name value pairs and returns a Object literal that represents those params.\n\n```js\nvar deparam = require(\"can-deparam\");\n\nconsole.log(JSON.stringify(deparam(\"?foo=bar&number=1234\"))); // -> '{\"foo\" : \"bar\", \"number\": 1234}'\nconsole.log(JSON.stringify(deparam(\"#foo[]=bar&foo[]=baz\"))); // -> '{\"foo\" : [\"bar\", \"baz\"]}'\nconsole.log(JSON.stringify(deparam(\"foo=bar%20%26%20baz\"))); // -> '{\"foo\" : \"bar & baz\"}'\n```" - } + ] } ], "_curParam": { "types": [ { - "type": "function", - "returns": { - "types": [ - { - "type": "undefined" - } - ] - }, - "params": [] - } - ], - "optional": true, - "name": "valueDeserializer", - "description": "A function that decodes the string values. For example, using\n[can-string-to-any] will convert `\"null\"` to `null` like:\n\n ```js\n import stringToAny from \"can-string-to-any\";\n deparam(\"value=null\", stringToAny) //-> {value: null}\n ```" - }, - "_curReturn": { - "types": [ - { - "type": "Object", - "options": [] + "type": "Any" } ], - "description": "The params formatted into an object\n\nTakes a string of name value pairs and returns a Object literal that represents those params.\n\n```js\nvar deparam = require(\"can-deparam\");\n\nconsole.log(JSON.stringify(deparam(\"?foo=bar&number=1234\"))); // -> '{\"foo\" : \"bar\", \"number\": 1234}'\nconsole.log(JSON.stringify(deparam(\"#foo[]=bar&foo[]=baz\"))); // -> '{\"foo\" : [\"bar\", \"baz\"]}'\nconsole.log(JSON.stringify(deparam(\"foo=bar%20%26%20baz\"))); // -> '{\"foo\" : \"bar & baz\"}'\n```" + "variable": true, + "name": "args", + "description": "parameters to pass to the base function\n" }, "comment": " " }, - "can-dom-events.addEvent": { - "type": "function", - "name": "can-dom-events.addEvent", - "parent": "can-dom-events.static", + "static": { "src": { - "line": 11, - "codeLine": 27, - "path": "node_modules/can-dom-events/can-dom-events.js" + "line": 106, + "codeLine": 109, + "path": "node_modules/can-route/can-route.js" }, - "body": "\n", - "description": "\nAdd a custom event to the global event registry.\n", - "title": "addEvent", - "signatures": [ + "type": "static", + "body": "", + "description": "\n", + "name": "static", + "parent": null, + "title": "static" + }, + "prototype": { + "src": { + "line": 157, + "codeLine": 160, + "path": "node_modules/can-map/can-map.js" + }, + "type": "prototype", + "body": "", + "description": " \n", + "name": "prototype", + "parent": null, + "title": "prototype" + }, + "can.Control.processor": { + "src": { + "path": "node_modules/can-control/control.processor.md" + }, + "body": "", + "description": "A function that handles the binding and unbinding of a [can.Control]'s declarative event method. \n\n", + "type": "typedef", + "title": "", + "types": [ { - "code": "addEvent( event [, eventType ] )", - "description": "\n\n```js\nvar removeReturnEvent = domEvents.addEvent(enterEvent, \"return\");\n```\n", - "params": [ - { - "types": [ - { - "type": "can-dom-events/EventDefinition" - } - ], - "name": "event", - "description": "The custom event definition." - }, - { - "types": [ - { - "type": "String" - } - ], - "name": "eventType", - "description": "The event type to associated with the custom event." - } - ], + "type": "function", "returns": { "types": [ { @@ -2354,175 +3584,17 @@ "params": [] } ], - "description": "The callback to remove the custom event from the registry.\n" - } - } - ], - "_curParam": { - "types": [ - { - "type": "String" - } - ], - "name": "eventType", - "description": "The event type to associated with the custom event." - }, - "_curReturn": { - "types": [ - { - "type": "function", - "returns": { + "description": "A callback function that unbinds any event handlers bound within this processor.\n" + }, + "params": [ + { "types": [ { - "type": "undefined" + "type": "HTMLElement" } - ] - }, - "params": [] - } - ], - "description": "The callback to remove the custom event from the registry.\n" - } - }, - "can-dom-events.addEventListener": { - "type": "function", - "name": "can-dom-events.addEventListener", - "parent": "can-dom-events.static", - "src": { - "line": 31, - "codeLine": 43, - "path": "node_modules/can-dom-events/can-dom-events.js" - }, - "body": "\n", - "description": "\nAdd an event listener for eventType to the target.\n", - "title": "addEventListener", - "signatures": [ - { - "code": "addEventListener( target, eventType, ...eventArgs )", - "description": "", - "params": [ - { - "types": [ - { - "type": "DomEventTarget" - } - ], - "name": "target", - "description": "The object to which to add the listener." - }, - { - "types": [ - { - "type": "String" - } - ], - "name": "eventType", - "description": "The event type with which to register." - }, - { - "types": [ - { - "type": "*" - } - ], - "name": "eventArgs", - "description": "The arguments which configure the associated event's behavior. This is usually a\nfunction event handler.\n" - } - ] - } - ], - "_curParam": { - "types": [ - { - "type": "*" - } - ], - "name": "eventArgs", - "description": "The arguments which configure the associated event's behavior. This is usually a\nfunction event handler.\n" - } - }, - "can-dom-events.removeEventListener": { - "type": "function", - "name": "can-dom-events.removeEventListener", - "parent": "can-dom-events.static", - "src": { - "line": 54, - "codeLine": 66, - "path": "node_modules/can-dom-events/can-dom-events.js" - }, - "body": "\n", - "description": "\nRemove an event listener for eventType from the target.\n", - "title": "removeEventListener", - "signatures": [ - { - "code": "removeEventListener( target, eventType, ...eventArgs )", - "description": "", - "params": [ - { - "types": [ - { - "type": "DomEventTarget" - } - ], - "name": "target", - "description": "The object from which to remove the listener." - }, - { - "types": [ - { - "type": "String" - } - ], - "name": "eventType", - "description": "The event type with which to unregister." - }, - { - "types": [ - { - "type": "*" - } - ], - "name": "eventArgs", - "description": "The arguments which configure the associated event's behavior. This is usually a\nfunction event handler.\n" - } - ] - } - ], - "_curParam": { - "types": [ - { - "type": "*" - } - ], - "name": "eventArgs", - "description": "The arguments which configure the associated event's behavior. This is usually a\nfunction event handler.\n" - } - }, - "can-dom-events.addDelegateListener": { - "type": "function", - "name": "can-dom-events.addDelegateListener", - "parent": "can-dom-events.static", - "src": { - "line": 77, - "codeLine": 97, - "path": "node_modules/can-dom-events/can-dom-events.js" - }, - "body": "\n", - "description": "\nAttach a handler for an event for all elements that match the selector,\nnow or in the future, based on a root element.\n", - "title": "addDelegateListener", - "signatures": [ - { - "code": "addDelegateListener( target, eventType, selector, handler )", - "description": "\n\n```js\n// Prevents all anchor elements from changing the page\ndomEvents.addDelegateListener(document.body,\"click\", \"a\", function(event){\n event.preventDefault();\n})\n```", - "params": [ - { - "types": [ - { - "type": "DomEventTarget" - } - ], - "name": "root", - "description": "The html element to listen to events that match selector within." + ], + "name": "element", + "description": "the control's element or the object \nspecified by the templated event handler (`\"{object}\"`).\n" }, { "types": [ @@ -2530,17 +3602,17 @@ "type": "String" } ], - "name": "eventType", - "description": "The event name to listen to." + "name": "eventName", + "description": "The event type.\n" }, { "types": [ { - "type": "String" + "type": "CSSSelectorString" } ], "name": "selector", - "description": "A selector to filter the elements that trigger the event." + "description": "The selector preceding the event in the binding used on the Control.\n" }, { "types": [ @@ -2553,98 +3625,62 @@ } ] }, - "params": [] + "params": [ + { + "types": [ + { + "type": "Object", + "options": [] + } + ], + "name": "element", + "description": "foo" + }, + { + "types": [ + { + "type": "Event" + } + ], + "name": "event", + "description": "bar\n" + } + ], + "context": { + "types": [ + { + "type": "can.Control" + } + ] + } } ], "name": "handler", - "description": "A function to execute at the time the event is triggered.\n" - } - ] - } - ], - "_curParam": { - "types": [ - { - "type": "function", - "returns": { - "types": [ - { - "type": "undefined" - } - ] - }, - "params": [] - } - ], - "name": "handler", - "description": "A function to execute at the time the event is triggered.\n" - } - }, - "can-dom-events.removeDelegateListener": { - "type": "function", - "name": "can-dom-events.removeDelegateListener", - "parent": "can-dom-events.static", - "src": { - "line": 100, - "codeLine": 122, - "path": "node_modules/can-dom-events/can-dom-events.js" - }, - "body": "\n", - "description": "\nRemove a handler for an event for all elements that match the selector.\n", - "title": "removeDelegateListener", - "signatures": [ - { - "code": "removeDelegateListener( target, eventType, selector, handler )", - "description": "\n\n```js\n// Prevents all anchor elements from changing the page\nfunction handler(event) {\n event.preventDefault();\n}\ndomEvents.addDelegateListener(document.body,\"click\", \"a\", handler);\n\ndomEvents.removeDelegateListener(document.body,\"click\", \"a\", handler);\n```", - "params": [ - { - "types": [ - { - "type": "DomEventTarget" - } - ], - "name": "root", - "description": "The html element to listen to events that match selector within." - }, - { - "types": [ - { - "type": "String" - } - ], - "name": "eventType", - "description": "The event name to listen to." - }, - { - "types": [ - { - "type": "String" - } - ], - "name": "selector", - "description": "A selector to filter the elements that trigger the event." + "description": "The callback function being bound.\n" }, { "types": [ { - "type": "function", - "returns": { - "types": [ - { - "type": "undefined" - } - ] - }, - "params": [] + "type": "can.Control" } ], - "name": "handler", - "description": "A function that was previously passed to `addDelegateListener`.\n" + "name": "control", + "description": "The Control the event is bound on.\n" } ] } ], + "name": "can.Control.processor", "_curParam": { + "types": [ + { + "type": "can.Control" + } + ], + "name": "control", + "description": "The Control the event is bound on.\n" + }, + "_curReturn": { "types": [ { "type": "function", @@ -2658,134 +3694,44 @@ "params": [] } ], - "name": "handler", - "description": "A function that was previously passed to `addDelegateListener`.\n" - } - }, - "can-dom-events.dispatch": { - "type": "function", - "name": "can-dom-events.dispatch", - "parent": "can-dom-events.static", - "src": { - "line": 126, - "codeLine": 139, - "path": "node_modules/can-dom-events/can-dom-events.js" - }, - "body": "\n", - "description": "\nCreate and dispatch a configured event on the target.\n", - "title": "dispatch", - "signatures": [ - { - "code": "dispatch( target, eventData [, bubbles ][, cancelable ] )", - "description": "", - "params": [ - { - "types": [ - { - "type": "DomEventTarget" - } - ], - "name": "target", - "description": "The object on which to dispatch the event." - }, - { - "types": [ - { - "type": "Object" - }, - { - "type": "String" - } - ], - "name": "eventData", - "description": "The data to be assigned to the event. If it is a string, that will be the event type." - }, - { - "types": [ - { - "type": "Boolean" - } - ], - "name": "bubbles", - "description": "Whether the event should bubble; defaults to true." - }, - { - "types": [ - { - "type": "Boolean" - } - ], - "name": "cancelable", - "description": "Whether the event can be cancelled; defaults to false." - } - ], - "returns": { - "types": [ - { - "type": "Boolean" - } - ], - "description": "notCancelled Whether the event dispatched without being cancelled.\n" - } - } - ], - "_curParam": { - "types": [ - { - "type": "Boolean" - } - ], - "name": "cancelable", - "description": "Whether the event can be cancelled; defaults to false." + "description": "A callback function that unbinds any event handlers bound within this processor.\n" }, - "_curReturn": { - "types": [ - { - "type": "Boolean" - } - ], - "description": "notCancelled Whether the event dispatched without being cancelled.\n" - } + "hide": true }, - "can-diff": { + "can-data-types": { "src": { - "path": "node_modules/can-diff/can-diff.md" + "path": "node_modules/can-data-types/can-data-types.md" }, - "body": "\n", - "description": "\nUtilities for comparing and applying differences between data structures.\n", + "body": "\n## Use\n\nThis package is used by [can-define] (and eventually [can-observe]) to define\ntypes. These types include a [can-reflect.getSchema] that enables them to be\nconverted to [can-query-logic] set types.\n\n```js\nimport {DefineMap, MaybeDate, MaybeString, MaybeNumber} from \"can\";\n\nconst Todo = DefineMap.extend({\n id: MaybeNumber,\n name: MaybeString,\n dueDate: MaybeDate\n});\n```\n\n", + "description": "A package of type objects that are used to test if a value is a member of the type and convert values to the type.\n\n", "type": "module", "title": "", "types": [ { "type": "Object", - "options": [], - "description": "\n\n `can-diff` exports an object that contains all of its module functions:\n\n ```js\n import {diff} from \"can-diff\";\n\n // Difference between two lists\n diff.list([\"a\",\"b\"], [\"a\",\"c\"])\n //-> [{type: \"splice\", index: 1, deleteCount: 1, insert: [\"c\"]}]\n\n // Difference between two objects\n diff.map({a: \"a\"},{a: \"A\"})\n //-> [{type: \"set\", key: \"a\", value: \"A\"}]\n\n // Diffs an object or array \"deeply\"\n diff.deep({inner: []}, {inner: ['a']});\n //-> [{\n // key: 'inner',\n // type: \"splice\",\n // index: 0,\n // deleteCount: 0,\n // insert: ['a']\n // }]\n\n\n var ramiya = new User({id: 21, name: \"Ramiya\"});\n\n var todo = new Todo({\n name: \"mow lawn\",\n assignedTo: [{id: 20, name: \"Justin\"}, ramiya]\n });\n\n // Updates `dest` with source using identity awareness\n diff.mergeDeep(todo, {\n id: 1,\n name: \"mow lawn\",\n complete: true,\n assignedTo: [{\n id: 21, name: \"Ramiya Meyer\"\n }]\n });\n\n ramiya //-> User({id: 21, name: \"Ramiya Meyer\"})\n\n\n var hobbies = new DefineList([\"dancin\",\"programmin\"]);\n var hobbiesObservable = value.fromValue(hobbies);\n\n // Emits patches from changes in a source observable\n var patcher = new Patcher(hobbies);\n\n canReflect.onPatches(patcher, console.log);\n ```\n" + "options": [] } ], - "name": "can-diff", - "parent": "can-js-utilities", + "name": "can-data-types", + "parent": "can-typed-data", "collection": "can-infrastructure", "package": { "author": { - "name": "DoneJS Core Team", + "name": "DoneJS Contributors", "email": "core@donejs.com", "url": "http://donejs.com" }, "bugs": { - "url": "https://github.com/canjs/can-diff/issues" + "url": "https://github.com/canjs/can-data-types/issues" }, "bundleDependencies": false, "dependencies": { - "can-key-tree": "^1.0.2", - "can-queues": "^1.0.1", - "can-reflect": "^1.14.1" + "can-namespace": "^1.0.0", + "can-reflect": "^1.16.1" }, "deprecated": false, - "description": "Diffing helpers for can-reflect", + "description": "Reusable special data types", "devDependencies": { - "can-define": "^2.1.0", - "can-key": "<2.0.0", - "can-simple-observable": "^2.0.4", "can-symbol": "^1.6.1", "jshint": "^2.9.1", "steal": "^2.2.1", @@ -2793,18 +3739,18 @@ "steal-tools": "^2.2.1", "testee": "^0.9.0" }, - "homepage": "http://canjs.com", + "homepage": "https://github.com/canjs/can-data-types#readme", "keywords": [ "canjs", "donejs", "donejs-plugin" ], "license": "MIT", - "main": "can-diff", - "name": "can-diff", + "main": "can-data-types", + "name": "can-data-types", "repository": { "type": "git", - "url": "git://github.com/canjs/can-diff.git" + "url": "git://github.com/canjs/can-data-types.git" }, "scripts": { "build": "node build.js", @@ -2819,201 +3765,150 @@ "testee": "testee test.html --browsers firefox" }, "steal": { - "main": "can-diff" + "main": "can-data-types", + "configDependencies": [ + "live-reload" + ], + "npmIgnore": [ + "testee", + "generator-donejs", + "donejs-cli", + "steal-tools" + ] }, - "version": "1.4.5" - } + "version": "1.2.1" + }, + "comment": " " }, - "can-event-dom-radiochange": { - "name": "can-event-dom-radiochange", - "type": "module", - "parent": "can-dom-utilities", + "can-deep-observable": { "src": { - "line": 61, - "codeLine": 89, - "path": "node_modules/can-event-dom-radiochange/can-event-dom-radiochange.js" + "path": "node_modules/can-deep-observable/can-deep-observable.md" }, - "body": "\n```js\nvar domEvents = require('can-dom-events');\nvar radioChange = require('can-event-dom-radiochange');\ndomEvents.addEvent(radioChange);\n\nvar target = document.createElement('input');\n\nfunction handler () {\n\tconsole.log('radiochange event fired');\n}\n\ndomEvents.addEventListener(target, 'radiochange', handler);\ndomEvents.removeEventListener(target, 'radiochange', handler);\n```\n\n", - "description": "\nA custom event for listening to changes of inputs with type \"radio\",\nwhich fires when a conflicting radio input changes. A \"conflicting\"\nradio button has the same \"name\" attribute and exists within in the\nsame form, or lack thereof. This event coordinates state bound to\nwhether a radio is checked. The \"change\" event does not fire for deselected\nradios. By using this event instead, deselected radios receive notification.\n", + "body": "\n## Use\n\n__DeepObservable__ is a type that turns an object, and nested objects, into [can-observable-object ObservableObjects] and [can-observable-array ObservableArrays].\n\nIt's most useful as a way to take plain objects which have no definable structure, but nevertheless need to be observable. Since you can't predefine these objects on [can-observable-object ObservableObjects], you can instead use DeepObservable as the type.\n\n```js\nimport { ObservableObject, DeepObservable, restModel } from \"can\";\n\nclass ServiceData extends ObservableObject {\n static props = {\n options: DeepObservable\n }\n}\n\nServiceData.connection = restModel({\n Map: ServiceData,\n url: \"/api/data/{id}\"\n});\n\nServiceData.get({ id: \"1\" }).then(data => {\n data.options.nested.props...\n});\n```\n\n", + "description": "Create observable objects where nested objects and arrays are also observable. \n\n
    \n\n\n
    \n\n", + "type": "module", "title": "", "types": [ { - "type": "events" + "type": "function", + "returns": { + "types": [ + { + "type": "undefined" + } + ] + }, + "params": [] } ], - "collection": "can-infrastructure", + "name": "can-deep-observable", + "parent": "can-observables", + "collection": "can-ecosystem", + "alias": "can.DeepObservable", "package": { "author": { - "name": "Chris Andrejewski", + "name": "DoneJS Contributors", "email": "core@donejs.com", - "url": "https://bitovi.com" + "url": "https://donejs.com/" }, "bugs": { - "url": "https://github.com/canjs/can-event-dom-radiochange/issues" + "url": "https://github.com/canjs/can-deep-observable/issues" }, "bundleDependencies": false, "dependencies": { - "can-dom-events": "<2.0.0", - "can-globals": "<2.0.0", - "can-namespace": "1.0.0" + "can-namespace": "^1.0.0", + "can-observable-array": "^1.0.0", + "can-observable-object": "^1.0.0", + "can-reflect": "^1.17.11", + "can-type": "^1.0.0" }, "deprecated": false, - "description": "Custom radiochange event", + "description": "[![Build Status](https://travis-ci.org/canjs/can-deep-observable.svg?branch=master)](https://travis-ci.org/canjs/can-deep-observable)", "devDependencies": { - "detect-cyclic-packages": "^1.1.0", - "fixpack": "^2.3.1", + "can-define": "^2.7.18", + "can-observation": "^4.1.3", "jshint": "^2.9.1", - "steal": "^2.2.1", - "steal-qunit": "^2.0.0", - "steal-tools": "^2.2.1", - "testee": "^0.9.0" + "steal": "^2.1.6", + "steal-qunit": "^1.0.1", + "steal-tools": "^2.0.9", + "testee": "^0.9.1" }, - "homepage": "https://canjs.com/doc/can-event-dom-radiochange.html", + "homepage": "https://github.com/canjs/can-deep-observable#readme", "keywords": [ "canjs", - "change", - "event", - "radio" + "donejs-plugin" ], "license": "MIT", - "main": "can-event-dom-radiochange", - "name": "can-event-dom-radiochange", + "main": "can-deep-observable.js", + "name": "can-deep-observable", "repository": { "type": "git", - "url": "git://github.com/canjs/can-event-dom-radiochange.git" + "url": "git://github.com/canjs/can-deep-observable.git" }, "scripts": { - "build": "node build.js", - "detect-cycle": "detect-cyclic-packages --ignore done-serve", - "install-canary": "npm install --no-shrinkwrap", - "install-locked": "npm install", "jshint": "jshint ./*.js --config", - "lint": "fixpack && npm run jshint", - "postversion": "git push --follow-tags", - "preversion": "npm test && npm run build", - "test": "npm run detect-cycle && npm run lint && npm run testee", - "testee": "testee test.html --browsers firefox" - }, - "steal": { - "main": "can-event-dom-radiochange", - "npmIgnore": [ - "testee", - "steal-tools" - ] + "postpublish": "git push --tags && git checkout master && git push", + "preversion": "npm test", + "release:major": "npm version major && npm publish", + "release:minor": "npm version minor && npm publish", + "release:patch": "npm version patch && npm publish", + "test": "npm run jshint && npm run testee", + "testee": "testee test.html --browsers firefox", + "version": "git commit -am \"Update version number\"" }, - "version": "2.2.1" - } - }, - "can-dom-mutate.static": { - "name": "can-dom-mutate.static", - "title": "methods", - "type": "group", - "parent": "can-dom-mutate", - "description": "", - "order": 0 - }, - "can-dom-mutate/modules": { - "name": "can-dom-mutate/modules", - "title": "modules", - "type": "group", - "parent": "can-dom-mutate", - "description": "", - "order": 1 - }, - "can-dom-mutate": { - "src": { - "path": "node_modules/can-dom-mutate/can-dom-mutate.md" + "version": "1.0.2" }, - "body": "\n## Use\n\n\n```js\nimport {domMutate, domMutateNode} from \"can\";\n\nvar element = document.createElement(\"div\");\n\nvar teardown = domMutate.onNodeInsertion(element, ()=>{\n\tconsole.log(\"element inserted!\");\n});\n\nsetTimeout(function(){\n\tdomMutateNode.appendChild.call(document.body, element);\n},1000);\n```\n
    \n\n", - "description": "Dispatch and listen for DOM mutations. ", - "type": "module", - "title": "", - "types": [ + "outline": { + "depth": 2 + }, + "templateRender": true, + "signatures": [ { - "type": "Object", - "options": [] - } - ], - "name": "can-dom-mutate", - "parent": "can-dom-utilities", - "collection": "can-infrastructure", - "package": { - "author": { - "name": "DoneJS Team", - "email": "core@donejs.com", - "url": "https://bitovi.com" - }, - "bugs": { - "url": "https://github.com/canjs/can-dom-mutate/issues" - }, - "bundleDependencies": false, - "dependencies": { - "can-globals": "^1.0.0", - "can-namespace": "1.0.0", - "can-reflect": "^1.17.6" - }, - "deprecated": false, - "description": "Dispatch and listen for DOM mutations", - "devDependencies": { - "can-dom-events": "^1.3.0", - "fixpack": "^2.3.1", - "jshint": "^2.9.1", - "steal": "^1.3.1", - "steal-qunit": "^2.0.0", - "steal-tools": "^1.2.0", - "testee": "^0.9.0" - }, - "homepage": "https://github.com/canjs/can-dom-mutate", - "keywords": [ - "canjs", - "mutation", - "mutationobserver", - "observer" - ], - "license": "MIT", - "main": "can-dom-mutate", - "name": "can-dom-mutate", - "repository": { - "type": "git", - "url": "git://github.com/canjs/can-dom-mutate.git" - }, - "scripts": { - "jshint": "jshint ./*.js ./test/*.js --config", - "lint": "fixpack && npm run jshint", - "postpublish": "git push --tags && git push", - "preversion": "npm test", - "release:major": "echo 'Cannot publish a major release from a legacy branch' && exit 1", - "release:minor": "npm version minor && npm publish --tag 1.x-legacy", - "release:patch": "npm version patch && npm publish --tag 1.x-legacy", - "release:pre": "npm version prerelease && npm publish --tag pre", - "test": "npm run lint && npm run testee", - "testee": "testee test.html --browsers firefox" - }, - "steal": { - "main": "can-dom-mutate" + "code": "canReflect.new(DeepObservable, data)", + "description": "\n\nCreates an observable object with `data`, where inner objects and arrays are converted to [can-observable-object] and [can-observable-array] types.\n\n```js\nimport { DeepObservable, Reflect as canReflect } from \"can\";\n\nlet obj = canReflect.new(DeepObservable, {\n inner: {\n prop: \"value\"\n }\n});\n\nobj.inner.on(\"prop\", (ev, newVal) => {\n console.log(newVal); // -> \"new value\"\n});\n\nobj.inner.prop = \"new value\";\n```", + "params": [ + { + "types": [ + { + "type": "Object", + "options": [] + } + ], + "name": "A", + "description": "plain object from which observable values will derive." + } + ], + "returns": { + "types": [ + { + "type": "can-deep-observable" + } + ], + "description": "A new `DeepObservable` object.\n" + } }, - "version": "1.3.9" - }, - "signatures": [ { - "code": "domMutate", - "description": "\n\n`can-dom-mutate` exports an object that lets you listen to changes\nin the DOM using the [MutationObserver](https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver)\nAPI.\n\n```js\nimport {domMutate} from \"can\";\n\ndomMutate\n// -> {\n// onAttributeChange( documentElement, callback ),\n// onInsertion( documentElement, callback ),\n// onRemoval( documentElement, callback ),\n// onNodeAttributeChange( node, callback ),\n// onNodeInsertion( node, callback ),\n// onNodeRemoval( node, callback )\n// }\n\n// listen to every attribute change within the document:\ndomMutate.onAttributeChange(document.documentElement, function(mutationRecord){\n mutationRecord.target //-> \n mutationRecord.attributeName //-> \"name\"\n mutationRecord.oldValue //-> \"Ramiya\"\n})\n```\n\nIf you want to support browsers that do not support the `MutationObserver` api, use\n[can-dom-mutate/node] to update the DOM. Every module within CanJS should do this:\n\n```js\nvar mutate = require('can-dom-mutate/node');\nvar el = document.createElement('div');\n\nmutate.appendChild.call(document.body, el);\n```\n", + "code": "prop: DeepObservable", + "description": "\n\nCreate a new property on [can-observable-object] that is a deep observable object.\n\n```js\nimport { ObservableObject, DeepObservable } from \"can\";\n\nclass Faves extends ObservableObject {\n static props = {\n config: DeepObservable\n };\n}\n\nlet faves = new Faves({\n config: {\n inner: {\n config: \"values\"\n }\n }\n});\n\nfaves.config.inner.on(\"config\", (ev, newVal) => {\n console.log(\"New value:\", newVal); // -> { enabled: true }\n});\n\nfaves.config.inner.config = { enabled: true };\n```", "params": [] } ], - "comment": " ", "codepen": [ [ "\"can\"", - "\"//unpkg.com/can@5/core.mjs\"" + "\"//unpkg.com/can@6/core.mjs\"" + ], + [ + "\"can/ecosystem\"", + "\"//unpkg.com/can@6/ecosystem.mjs\"" ], [ "\"can/everything\"", - "\"//unpkg.com/can@5/everything.mjs\"" + "\"//unpkg.com/can@6/everything.mjs\"" ], [ "\"can/demos/technology-overview/mock-url\"", - "\"//unpkg.com/mock-url@^5.0.0/mock-url.mjs\"" + "\"//unpkg.com/mock-url@^6.0.0/mock-url.mjs\"" ], [ "\"can/demos/technology-overview/route-mini-app-components\"", @@ -3031,103 +3926,202 @@ "`can/demos/technology-overview/page-${this.page}`", "`//unpkg.com/route-mini-app@^5.0.0/page-${this.page}.mjs`" ] - ] + ], + "_curReturn": { + "types": [ + { + "type": "can-deep-observable" + } + ], + "description": "A new `DeepObservable` object.\n" + }, + "comment": " " }, - "can-event-dom-enter.modules": { - "name": "can-event-dom-enter.modules", - "title": "modules", - "type": "group", - "parent": "can-event-dom-enter", - "description": "", - "order": 0 + "'htmlbool'": { + "type": "function", + "name": "'htmlbool'", + "params": [ + { + "name": "val", + "types": [ + { + "type": "*" + } + ] + } + ], + "parent": "node_modules/can-define/can-define.js", + "src": { + "line": 1270, + "codeLine": 1274, + "path": "node_modules/can-define/can-define.js" + }, + "body": " \n", + "description": "Implements HTML-style boolean logic for attribute strings, where\nany string, including \"\", is truthy.\n" }, - "can-event-dom-enter": { - "name": "can-event-dom-enter", + "can-define-connected-singleton": { + "src": { + "path": "node_modules/can-define-connected-singleton/can-define-connected-singleton.md" + }, + "body": "\nSingleton decorator for can-define/map/map\n\n## Overview\n\nThis function is used to extend a DefineMap constructor so that a single instance of persisted data is easily referenced, very much like a singleton. This is useful for situations where you only want access to a single shared instance of a class whose data is loaded from a services. The primary use case for this is for referencing a user's session in a client application.\n\n## Usage\n\n```js\nimport singleton from 'can-define-connected-singleton';\nimport DefineMap from 'can-define/map/map';\n\n// function wrapper (recommended)\nconst MyType = singleton(\n\tDefineMap.extend({ ... })\n);\n\n// or as a *legacy* decorator\n// SEE: https://github.com/loganfsmyth/babel-plugin-transform-decorators-legacy\nconst MyType = DefineMap.extend({ ... });\n```\n\nFor a practical example of usage refer to the [guides/data-managing-sessions Managing Sessions data guide] which uses a [can-connect] behavior that includes the functionality from this module.\n\n## How does it work\n\nOnce you have decorated your class, the class will have three new static properties:\n\n- **`MyType.current`** - the current value for the singleton\n- **`MyType.currentPromise`** - the promise which should resolve to the value for the singleton\n- **`MyType.saving`** - the instance of the singleton currently active as part of an ongoing save request\n\nThe first time you read either `current` or `currentPromise`, the value will be loaded by calling the static `get` method on your class. The `get` method should return a Promise, and this promise will be stored on the static `currentPromise` property of your class:\n\n```js\nconst MyType = singleton(\n DefineMap.extend({ ... })\n);\n\n// define the static \"get\" method \n// NOTE: the can-map behavior for can-connect does this for you\nMyType.get = function() {\n return Promise.resolve('the value');\n}\n\n// triggers a call to MyType.get()\nMyType.current; //-> initially undefined\n\nMyType.currentPromise.then(value => {\n MyType.current === value; //-> true\n});\n```\n\nIf your service requires you to pass parameters as part of loading the singleton, e.g logging in to retrieve a session model, your application should use the `save` method on an instance of your class at some point prior to use of `current` or `currentPromise`. The `save` method should return a Promise, and this promise will be stored on the static `currentPromise` property of the class. The instance being saved will be stored on the static `saving` property of the class for the duration of the request:\n\n```js\nconst MyType = singleton(\n DefineMap.extend({ \n // define the static \"get\" method \n // NOTE: the can/map behavior for can-connect does this for you\n get: function() {\n return Promise.resolve('the value');\n },\n ...\n }, {\n // define the instance \"save\" method \n // NOTE: the can/map behavior for can-connect does this for you\n save: function() {\n return new Promise((resolve, reject) => {\n setTimeout(() => resolve(this), 1000);\n }); \n }\n })\n);\n\n\nconst instance = new MyType({ username: 'nils', password: 'foobar' });\nconst promise = instance.save();\n\nMyType.current; //-> initially undefined, doesn't start a request since .save is ongoing \nMyType.saving === instance; //-> true\nMyType.currentPromise === promise; //-> .currentPromise is the is the ongoing save request \nMyType.currentPromise.then(value => {\n MyType.current === value; //-> true\n MyType.current === instance; //-> true\n MyType.saving; //-> undefined after the .save finished \n});\n```\n \n\n## Configuration options\n\nBy default, the singleton decorator uses the following options:\n\n```js\n{\n currentPropertyName: 'current',\n savingPropertyName: 'saving',\n fetchMethodName: 'get',\n createMethodName: 'save',\n destroyMethodName: 'destroy'\n}\n```\n\nYou can specify your own options using the following syntax:\n\n```js\nconst options = {\n currentPropertyName: 'foo',\n fetchMethodName: 'doFoo'\n};\n\n// as a function wrapper (recommended)\nconst MyType = singleton( options )(\n\tDefineMap.extend({ ... })\n);\n\n// or as a decorator\nconst MyType = DefineMap.extend({ ... });\n```\n\nUsing the above options, your class would be decorated with `foo` and `fooPromise` properties instead of `current` and `currentPromise`, respectively. Furthermore, the static `doFoo` method will be invoked instead of the `get` method for loading the singleton data.\n", + "description": "\n# can-define-connected-singleton\n", + "name": "can-define-connected-singleton", + "type": "page", + "singleton": [ + true, + "( options )" + ] + }, + "can-define-lazy-value": { "type": "module", - "parent": "can-dom-utilities", + "name": "can-define-lazy-value", + "parent": "can-js-utilities", "src": { - "line": 11, - "codeLine": 38, - "path": "node_modules/can-event-dom-enter/can-event-dom-enter.js" + "line": 1, + "codeLine": 42, + "path": "node_modules/can-define-lazy-value/define-lazy-value.js" }, - "body": "\n```js\nvar domEvents = require('can-dom-events');\nvar enterEvent = require('can-event-dom-enter');\n\ndomEvents.addEvent(enterEvent);\n\nvar input = document.createElement('input');\nfunction enterEventHandler() {\n\tconsole.log('enter key pressed');\n}\n\ndomEvents.addEventHandler(input, 'enter', enterEventHandler);\ndomEvents.dispatch(input, {\n type: 'keyup',\n keyCode: keyCode\n});\n```\n\n", - "description": "\nWatch for when enter keys are pressed on a DomEventTarget.\n", + "body": "", + "description": "", "title": "", "types": [ { - "type": "events" + "type": "function", + "returns": { + "types": [ + { + "type": "undefined" + } + ] + }, + "params": [] } ], "collection": "can-infrastructure", "package": { "author": { - "name": "Chris Andrejewski", - "email": "core@donejs.com", + "name": "Bitovi", + "email": "contact@bitovi.com", "url": "https://bitovi.com" }, "bugs": { - "url": "https://github.com/canjs/can-event-dom-enter/issues" + "url": "https://github.com/canjs/can-define-lazy-value/issues" }, "bundleDependencies": false, - "dependencies": { - "can-dom-events": "^1.0.0", - "can-namespace": "1.0.0" - }, + "dependencies": {}, "deprecated": false, - "description": "Custom enter event", + "description": "Define properties with lazy values using Object.defineProperty", "devDependencies": { - "detect-cyclic-packages": "^1.1.0", - "fixpack": "^2.3.1", "jshint": "^2.9.1", "steal": "^2.2.1", "steal-qunit": "^2.0.0", "steal-tools": "^2.2.1", "testee": "^0.9.0" }, - "homepage": "https://canjs.com/doc/can-event-dom-enter.html", + "homepage": "https://canjs.com", "keywords": [ "canjs", - "change", - "event", - "radio" + "donejs-plugin" ], "license": "MIT", - "main": "can-event-dom-enter", - "name": "can-event-dom-enter", + "main": "define-lazy-value", + "name": "can-define-lazy-value", "repository": { "type": "git", - "url": "git://github.com/canjs/can-event-dom-enter.git" + "url": "git://github.com/canjs/can-define-lazy-value.git" }, "scripts": { "build": "node build.js", - "detect-cycle": "detect-cyclic-packages --ignore done-serve", - "install-canary": "npm install --no-shrinkwrap", - "install-locked": "npm install", "jshint": "jshint ./*.js --config", - "lint": "fixpack && npm run jshint", - "postversion": "git push --follow-tags", + "postpublish": "git push --tags && git checkout master && git branch -D release && git push", "preversion": "npm test && npm run build", - "test": "npm run detect-cycle && npm run lint && npm run testee", - "testee": "testee test.html --browsers firefox" + "release:major": "npm version major && npm publish", + "release:minor": "npm version minor && npm publish", + "release:patch": "npm version patch && npm publish", + "release:pre": "npm version prerelease && npm publish --tag=pre", + "test": "npm run jshint && npm run testee", + "testee": "testee test.html --browsers firefox", + "version": "git commit -am \"Update version number\" && git checkout -b release && git add -f dist/" }, "steal": { - "main": "can-event-dom-enter", "npmIgnore": [ "testee", "steal-tools" ] }, - "version": "2.2.1" + "version": "1.1.1" + }, + "signatures": [ + { + "code": "defineLazyValue(obj, prop, fn, writable)", + "description": "\n\nUse Object.defineProperty to define properties whose values will be created lazily when they are first read.\n\n```js\nvar _id = 1;\nfunction getId() {\n return _id++;\n}\n\nfunction MyObj(name) {\n this.name = name;\n}\n\ndefineLazyValue(MyObj.prototype, 'id', getId);\n\nvar obj1 = new MyObj('obj1');\nvar obj2 = new MyObj('obj2');\n\nconsole.log( obj2 ); // -> { name: \"obj2\" }\nconsole.log( obj1 ); // -> { name: \"obj1\" }\n\n// the first `id` read will get id `1`\nconsole( obj2.id ); // -> 1\nconsole( obj1.id ); // -> 2\n\nconsole.log( obj2 ); // -> { name: \"obj2\", id: 1 }\nconsole.log( obj1 ); // -> { name: \"obj1\", id: 2 }\n\n```\n", + "params": [ + { + "types": [ + { + "type": "Object", + "options": [] + } + ], + "name": "object", + "description": "The object to add the property to." + }, + { + "types": [ + { + "type": "String" + } + ], + "name": "prop", + "description": "The name of the property." + }, + { + "types": [ + { + "type": "function", + "returns": { + "types": [ + { + "type": "undefined" + } + ] + }, + "params": [] + } + ], + "name": "fn", + "description": "A function to get the value the property should be set to." + }, + { + "types": [ + { + "type": "boolean" + } + ], + "name": "writable", + "description": "Whether the field should be writable (false by default).\n" + } + ] + } + ], + "_curParam": { + "types": [ + { + "type": "boolean" + } + ], + "name": "writable", + "description": "Whether the field should be writable (false by default).\n" } }, - "can-event-dom-enter/add-global/add-global": { + "can-define-realtime-rest-model": { "src": { - "path": "node_modules/can-event-dom-enter/add-global.md" + "path": "node_modules/can-define-realtime-rest-model/can-define-realtime-rest-model.md" }, - "body": "", - "description": " \nRegisters a global `enter` event, allowing listening to enter anywhere in your application.\n\n", + "body": "\n## Purpose\n\n`defineRealtimeRestModel` extends [can-define-rest-model] with two new features:\n\n- Automatic list management\n- Unified instances and lists across requests with list and instance stores.\n\n### Automatic list management\n\n`defineRealtimeRestModel` allows you to make changes to instances\nand have the lists in the page update themselves\nautomatically. This can remove a lot of boilerplate from your\napplication. For example, if you make a simple component that\ndisplays only completed todos sorted by name like:\n\n```html\n\n\n\n```\n\nIf other components are creating, updating, or destroying todos, this component\nwill update automatically. For example:\n\n- Creating a completed todo as follows will automatically insert the todo\n in the `` element's list sorted by its name:\n\n ```js\n new Todo({name: \"walk dog\", complete: true}).save();\n ```\n This works because [can-query-logic] is able to know that the query\n `{ filter: {complete: true}, sort: \"name\" }` doesn't contain data like\n `{name: \"walk dog\", complete: true}`.\n\n- Creating a todo with `complete: false` will __not__ update the ``'s list:\n ```js\n new Todo({name: \"walk dog\", complete: false}).save();\n ```\n This works because [can-query-logic] is able to know that the query\n `{ filter: {complete: true}, sort: \"name\" }` doesn't contain data like\n `{name: \"walk dog\", complete: false}`.\n\n- Updating a todo's `name` or `complete` value will move the todo\n in or out of the ``'s list and put it in the\n right position. For example, a todo that's not complete can be\n moved into the list like:\n\n ```js\n todo.complete = true;\n todo.save();\n ```\n- Destroying a todo will remove the todo from all lists:\n ```js\n todo.destroy();\n ```\n\nThe following code example uses `defineRealtimeRestModel` to create a list of todos that automatically updates itself when new todos are created.\n\n```html\n\n\n\n\n```\n
    \n\n### List and instance stores\n\nAdditionally, `defineRealtimeRestModel` unifies record and list instances. This means that if you\nrequest the same data twice, only one instance will be created\nand shared. For example, if a `` widget loads the `id=5` todo, and another `` widget loads the same data independently like:\n\n```html\n\n

    \n\n\n\n```\n
    \n\nIf the user changes the todo's name in the `` widget, the` `\nwidget will be automatically updated.\n\nFurthermore, if you wish to update the data in the page, you simply need to re-request the\ndata like:\n\n```js\n// Updates the id=5 todo instance\nTodo.get({id: 5})\n\n// Updates all incomplete todos\nTodo.getList({ filter: { complete: false } })\n```\n\n\n## Use\n\nUse `defineRealtimeRestModel` to build a connection to a restful service\nlayer. `defineRealtimeRestModel` builds on top of [can-define-rest-model]. Please\nread the _\"Use\"_ section of [can-define-rest-model] before reading this _\"Use\"_ section.\nThis _\"Use\"_ section details knowledge needed in addition to [can-define-rest-model]\nto use `defineRealtimeRestModel`, such as:\n\n- Configuring queryLogic\n- Updating the page from server-side events \n- Simulating server-side events with [can-fixture]\n\n### Configuring queryLogic\n\n`defineRealtimeRestModel` requires a properly\nconfigured [can-connect/base/base.queryLogic]. If your server supports\n`getList` parameters that match [can-query-logic/query can-query-logic's default query structure], then no configuration\nis likely necessary. The default `query` structure looks like:\n\n```js\nTodo.getList({\n // Selects only the todos that match.\n filter: {\n complete: {$in: [false, null]}\n },\n // Sort the results of the selection\n sort: \"-name\",\n // Selects a range of the sorted result\n page: {start: 0, end: 19}\n})\n```\n\nThis structures follows the [Fetching Data JSONAPI specification](http://jsonapi.org/format/#fetching).\n\nThere's a:\n\n- [filter](http://jsonapi.org/format/#fetching-filtering) property for filtering records,\n- [sort](http://jsonapi.org/format/#fetching-sorting) property for specifying the order to sort records, and\n- [page](http://jsonapi.org/format/#fetching-pagination) property that selects a range of the sorted result. _The range indexes are inclusive_. Example: `{page: 0, end: 9}` returns 10 records.\n\n> __NOTE__: [can-connect] does not follow the rest of the JSONAPI specification. Specifically\n> [can-connect] expects your server to send back JSON data in a format described in [can-define-rest-model].\n\nIf you control the service layer, we __encourage__ you to make it match the default\n[can-query-logic/query]. The default query structure also supports the following [can-query-logic/comparison-operators]: `$eq`, `$gt`, `$gte`, `$in`, `$lt`, `$lte`, `$ne`, `$nin`.\n\nFor more information on this `query` structure and how to configure a query logic\nto match your service layer, read\n[the configuration section of can-query-logic](./can-query-logic.html#Configuration).\n\n\n### Updating the page from server-side events \n\nIf your service layer can push events, you can call the connection's\n[can-connect/real-time/real-time.createInstance],\n[can-connect/real-time/real-time.updateInstance], and [can-connect/real-time/real-time.destroyInstance]\nto update the lists and instances on the page. For example, if you have a socket.io connection,\nyou can listen to events and call these methods on the `connection` as follows:\n\n```js\nimport io from 'steal-socket.io';\n\nconst todoConnection = defineRealtimeRestModel({\n Map: Todo,\n List: TodoList,\n url: \"/api/todos/{id}\"\n});\n\nsocket.on('todo created', function(todo){\n todoConnection.createInstance(todo);\n});\n\nsocket.on('todo updated', function(todo){\n todoConnection.updateInstance(todo);\n});\n\nsocket.on('todo removed', function(todo){\n todoConnection.destroyInstance(todo);\n});\n```\n\n### Simulating server-side events with can-fixture\n\n[can-fixture] does not allow you to simulate server-side events. However, this\ncan be done relatively easily by calling [can-connect/real-time/real-time.createInstance],\n[can-connect/real-time/real-time.updateInstance], or [can-connect/real-time/real-time.destroyInstance]\non your connection directly as follows:\n\n```js\ntest(\"widget response to server-side events\", function(assert){\n let todoList = new TodoListComponent();\n\n todoConnection.createInstance({\n id: 5,\n name: \"learn how to test\",\n complete: false\n }).then(function(){\n // check to see that the list has been updated\n assert.ok( /learn how to test/.test(todoList.element.innerHTML) );\n });\n});\n```\n\nWhile this works, it doesn't make sure the record's data is in the fixture\n[can-fixture.store]. The fixture store also will add a unique `id`\nproperty. To make sure the record is in the store, use `store.createInstance` on the store and\npass the result to `connection.createInstance` as follows:\n\n```js\ntest(\"widget response to server-side events\", function(assert){\n let todoList = new TodoListComponent();\n\n todoStore.createInstance({\n name: \"learn how to test\",\n complete: false\n }).then(function(record){\n return todoConnection.createInstance(record)\n }).then(function(){\n // check to see that the list has been updated\n assert.ok( /learn how to test/.test(todoList.element.innerHTML) );\n });\n});\n```\n\n", + "description": "Connect a type to a restful data source and automatically manage lists.\n\n", "type": "module", - "title": "can-event-dom-enter/add-global/add-global", + "title": "", "types": [ { "type": "function", @@ -3141,111 +4135,67 @@ "params": [] } ], - "name": "can-event-dom-enter/add-global/add-global", - "parent": "can-event-dom-enter", - "signatures": [ - { - "code": "unregister()", - "description": "\n\nImporting `can-event-dom-enter/add-global/add-global` registers the __enter__ event globally. Calling `unregister()` removes it from the global registry.\n\n```js\nimport unregister from 'can-event-dom-enter/add-global/add-global';\n\n// Later time\nunregister();\n```\n", - "params": [] - } - ] - }, - "can-fixture-socket.properties": { - "name": "can-fixture-socket.properties", - "title": "properties", - "type": "group", - "parent": "can-fixture-socket", - "description": "", - "order": 0 - }, - "can-fixture-socket.types": { - "name": "can-fixture-socket.types", - "title": "types", - "type": "group", - "parent": "can-fixture-socket", - "description": "", - "order": 0 - }, - "can-fixture-socket": { - "src": { - "path": "node_modules/can-fixture-socket/can-fixture-socket.md" - }, - "body": "\n## Use basics\n\nLets say we wanted to test a simple app that connects to `socket.io`, and\nonce connected, creates a message, and logs when the message is created.\n\nThat app could look like the following:\n\n```js\nconst socket = io();\nsocket.on( \"connect\", function() {\n\tsocket.emit( \"messages create\", { text: \"A new message\" } );\n} );\nsocket.on( \"message created\", function( data ) {\n\n\t// data.text === \"A new message\"\n\tconsole.log( \"Server sent out a new message we just created\", data );\n} );\n```\n\nTo test this, we'll first use [can-fixture-socket.Server can-fixture-socket.Server] to intercept the socket connection:\n\n```js\nimport io from \"socket.io-client\";\nimport fixtureSocket from \"can-fixture-socket\";\nconst mockServer = new fixtureSocket.Server( io );\n```\n\nNow we can mock the socket server by creating socket event listeners and emitting socket events:\n\n```js\nmockServer.on( \"messages create\", function( data ) {\n\tconsole.log( \"New message received\", data );\n\tmockServer.emit( \"message created\", data );\n} );\n```\n\nTo see this in action:\n\n
    \n\n\n### Acknowledgement callbacks\n\nWe also can use socket.io [acknowledgement callbacks](http://socket.io/docs/#sending-and-getting-data-(acknowledgements)):\n```js\nmockServer.on( \"users create\", function( user, ackCb ) {\n\tconsole.log( \"Simulating saving a new user to DB and return the new user id\", user );\n\n\tackCB( {\n\t\tid: Math.random()\n\t} );\n} );\n```\n\nClient code:\n\n```js\nconst socket = io();\nsocket.on( \"connect\", function() {\n\tsocket.emit( \"users create\", { name: \"Ilya\", likes: \"skiing\" }, function( data ) {\n\n\t\t// data is what server calls the acknowledgement callback\n\t\t// with (e.g. data.id is the new user id).\n\t\tconsole.log( data.id );\n\t} );\n} );\n```\n\n## Use with can-fixture.Store\n\nWith can-fixture [can-fixture.store] we can create a store of items and emulate a fully working CRUD service. Optionally, we can use [can-set.Algebra] to power our store filtering, pagination, and sorting abilities.\n\n```js\n// Import can-fixture that provides `store` method for creating a store:\nimport fixture from \"can-fixture\";\n\nimport canSet from \"can-set\";\n\n// Create a fixture store:\nconst messagesStore = fixture.store( [\n\t{ id: 1, title: \"One\" },\n\t{ id: 2, title: \"Two\" },\n\t{ id: 3, title: \"Three\" }\n], new canSet.Algebra( {} ) );\n```\n\nWe can mock the socket.io connection with the rich behavior of _fixture stores_ using the [can-fixture-socket.requestHandlerToListener] helper. `requestHandlerToListener`\nconverts a _fixture store request handler_ to a _socket.io event listener_.\n\n```js\nimport fixtureSocket from \"can-fixture-socket\";\nimport io from \"socket.io-client\";\nconst mockServer = new fixtureSocket.Server( io );\n\nmockServer.on( \"messages get\", fixtureSocket.requestHandlerToListener( messagesStore.getData ) );\n```\n\nOr we can use [can-fixture-socket.storeToListeners] helper to convert all CRUD _fixture store request handlers_ into _socket.io event listeners_:\n\n```js\nconst listeners = fixtureSocket.storeToListeners( messagesStore );\nmockServer.on( {\n\t\"messages remove\": listeners.destroyData,\n\t\"messages create\": listeners.createData,\n\t\"messages update\": listeners.updateData\n} );\n```\n\n## Use with FeathersJS\n\n[Feathers](http://feathersjs.com/) is a minimalist, service-oriented, real-time web framework for modern applications. It is a NodeJS framework built on top of Express. It allows you to build REST-ful services and works with three [providers](https://docs.feathersjs.com/providers/): standard HTTP communication, WebSockets and Primus.\n\nThe mocked server exposes [can-fixture-socket.Server.prototype.onFeathers] method to simulate [FeathersJS](http://feathersjs.com/) CRUD services.\n\nFor example, given the following FeathersJS client app:\n\n```js\nconst socket = io( \"http://api.my-feathers-server.com\" );\nconst app = feathers()\n\t.configure( hooks() )\n\t.configure( feathersSocketio( socket ) );\n\n// Create FeathersJS CRUD service for \"messages\" resource:\nconst messagesService = app.service( \"messages\" );\n```\n\nWe can simulate it with a [can-fixture.store] as follows:\n\n```js\nconst messagesStore = fixture.store( [\n\t{ id: 1, title: \"One\" },\n\t{ id: 2, title: \"Two\" },\n\t{ id: 3, title: \"Three\" }\n], new canSet.Algebra( {} ) );\n\nmockServer.onFeathersService( \"messages\", fixtureStore );\n```\n\nNow you can test your FeathersJS app:\n\n```js\nmessagesService.find( {} ).then( function( data ) {\n\tassert.equal( data.total, 3, \"find should receive 3 items\" );\n} );\nmessagesService.get( 1 ).then( function( data ) {\n\tassert.deepEqual( data, { id: 1, title: \"One\" }, \"get should receive an item\" );\n} );\nmessagesService.create( { title: \"Four\" } ).then( function( data ) {\n\tassert.equal( data.title, \"Four\", \"create should add an new item\" );\n} );\n```\n\n", - "description": "Simulate socket.io services. \n\n\n", - "type": "module", - "title": "", - "types": [ - { - "type": "Object", - "options": [], - "description": "\n\n`can-fixture-socket` intercepts socket.io messages and simulates socket.io server responses.\n\nThe `can-fixture-socket` module exports an object with:\n\n- [can-fixture-socket.Server], a constructor function which instance intercepts the socket.io connection;\n- [can-fixture-socket.requestHandlerToListener], a helper to convert XHR request handler into [can-fixture-socket.socket-event-listener];\n- [can-fixture-socket.storeToListeners], a helper to convert all [can-fixture/StoreType] request handlers into [can-fixture-socket.socket-event-listener].\n\nWith three simple steps you can test your real-time application that uses socket.io:\n\n 1. create a mock server that intercepts socket.io;\n 2. mock server behavior;\n 3. test your application.\n\n```js\nimport fixtureSocket from \"can-fixture-socket\";\n\n// Import socket-io client:\nimport io from \"socket.io-client\";\n\n// Create a mock server that intercepts socket.io:\nconst mockServer = new fixtureSocket.Server( io );\n\n// Mock server behavior\nmockServer.on( \"connection\", function() {\n\tmockServer.emit( \"notifications\", { test: \"OK\" } );\n} );\n\n// Client. Create socket.io connection:\nconst socket = io( \"http://localhost:8080/api\" );\n\n// Test your application:\nsocket.on( \"connect\", function() {\n\tassert.ok( true, \"socket connected\" );\n} );\n\nsocket.on( \"notifications\", function( data ) {\n\tassert.deepEqual( data, { test: \"OK\" }, \"received notifications message\" );\n} );\n```\n" - } - ], - "name": "can-fixture-socket", + "name": "can-define-realtime-rest-model", "parent": "can-data-modeling", - "collection": "can-ecosystem", + "collection": "can-legacy", "package": { "author": { - "name": "bitovi", - "email": "contact@bitovi.com", - "url": "bitovi.com" + "name": "DoneJS Core team", + "email": "core@donejs.com", + "url": "http://donejs.com" }, "bugs": { - "url": "https://github.com/canjs/can-fixture-socket/issues" + "url": "https://github.com/canjs/can-define-realtime-rest-model/issues" }, "bundleDependencies": false, "dependencies": { - "can-assign": "^1.2.0", - "can-fixture": "^3.0.0" + "can-connect": "^4.0.0", + "can-define": "^2.2.0", + "can-globals": "^1.0.1", + "can-namespace": "^1.0.0", + "can-query-logic": "<2.0.0", + "can-reflect": "^1.15.2" }, "deprecated": false, - "description": "Simulate socket connections", + "description": "Turn a map into a realtime rest model", "devDependencies": { - "@feathersjs/feathers": "^3.3.1", - "@feathersjs/socketio-client": "^1.2.1", - "can-set-legacy": "<2.0.0", - "detect-cyclic-packages": "^1.1.0", - "done-serve": "^1.2.0", - "donejs-cli": "^1.0.1", - "es6-promise-polyfill": "^1.2.0", - "generator-donejs": "^1.0.5", + "can-fixture": "^3.0.0", + "http-server": "^0.11.0", "jshint": "^2.9.1", - "object-assign": "^4.1.0", - "socket.io-client": "^2.2.0", - "steal": "^1.5.6", + "steal": "^2.1.14", "steal-qunit": "^2.0.0", - "steal-tools": "^1.1.2", + "steal-tools": "^2.0.11", + "test-saucelabs": "^0.0.6", "testee": "^0.9.0" }, - "homepage": "https://github.com/canjs/can-fixture-socket", + "homepage": "http://canjs.com", "keywords": [ - "Done", - "JS", - "Can", - "JS" + "canjs", + "donejs", + "donejs-plugin", + "model" ], - "main": "can-fixture-socket", - "name": "can-fixture-socket", + "license": "MIT", + "main": "can-define-realtime-rest-model", + "name": "can-define-realtime-rest-model", "repository": { "type": "git", - "url": "git://github.com/canjs/can-fixture-socket.git" + "url": "git://github.com/canjs/can-define-realtime-rest-model.git" }, "scripts": { - "detect-cycle": "detect-cyclic-packages --ignore done-serve", + "ci": "npm run test && node test-saucelabs.js", "develop": "done-serve --static --develop --port 8080", + "http-server": "http-server -p 3000 --silent", "jshint": "jshint ./*.js --config", "postpublish": "git push --tags && git push", "preversion": "npm test", "release:major": "npm version major && npm publish", "release:minor": "npm version minor && npm publish", "release:patch": "npm version patch && npm publish", - "release:pre": "npm version prerelease && npm publish --tag=pre", - "test": "npm run detect-cycle && npm run jshint && npm run testee", - "testee": "testee test/test.html --browsers firefox" + "test": "npm run jshint && npm run testee", + "testee": "testee test.html --browsers firefox" }, "steal": { - "main": "can-fixture-socket", "configDependencies": [ "live-reload" ], @@ -3256,75 +4206,186 @@ "steal-tools" ] }, - "version": "2.0.2" + "version": "2.0.0" + }, + "outline": { + "depth": 2 + }, + "signatures": [ + { + "code": "defineRealtimeRestModel(options)", + "description": "\n\n`defineRealtimeRestModel` is the base model layer that most CanJS applications should\nuse. It requires a properly configured [can-query-logic] which experimenters might\nfind cumbersome to configure. If you are experimenting with CanJS, or have a\nvery irregular service layer, [can-define-rest-model] might be a better fit. For\neveryone else, use `defineRealtimeRestModel` as it adds the following behaviors on top of [can-define-rest-model]:\n\n\n- [can-connect/constructor/store/store] - Unify instances and lists across requests.\n- [can-connect/real-time/real-time] - Add, remove, and move items between lists automatically.\n\n\n`defineRealtimeRestModel` is useful even if you are not building a realtime\napplication. It allows you to make changes to instances\nand have the lists in the page update themselves\nautomatically. This is detailed in the [Purpose](#Purpose) section below.\n\nIf your service layer matches what `defineRealtimeRestModel` expects, configuring `defineRealtimeRestModel` is very simple. For example, the following extends a `Todo` type with the ability to connect to a restful service layer:\n\n```js\nimport {Todo, todoFixture} from \"//unpkg.com/can-demo-models@5\";\nimport {defineRealtimeRestModel} from \"can\";\n\n// Creates a mock backend with 5 todos\ntodoFixture(5);\n\nTodo.connection = defineRealtimeRestModel({\n Map: Todo,\n List: Todo.List,\n url: \"/api/todos/{id}\"\n});\n\n// Prints out all todo names\n\nTodo.getList().then(todos => {\n todos.forEach(todo => {\n console.log(todo.name);\n })\n})\n```\n
    \n\n", + "params": [ + { + "types": [ + { + "type": "Object", + "options": [] + } + ], + "name": "options", + "description": "Configuration options supported by all the mixed-in behaviors:\n\n- [can-connect/can/map/map._Map] - The map type constructor function used to create\n instances of the raw record data retrieved from the server.\n The type will also be decorated\n with the following methods:\n - [can-connect/can/map/map.getList]\n - [can-connect/can/map/map.get]\n - [can-connect/can/map/map.prototype.save]\n - [can-connect/can/map/map.prototype.destroy]\n - [can-connect/can/map/map.prototype.isSaving]\n - [can-connect/can/map/map.prototype.isDestroying]\n - [can-connect/can/map/map.prototype.isNew]\n\n- [can-connect/can/map/map._List] - The list type constructor function used to create\n a list of instances of the raw record data retrieved from the server. _\n- [can-connect/data/url/url.url] - Configure the URLs used to create, retrieve, update and\n delete data. It can be configured with a single url like:\n\n ```js\n url: \"/services/todos/{_id}\"\n ```\n\n Or an object that configures how to create, retrieve, update and delete individually:\n\n ```js\n url: {\n getListData: \"GET /api/todos/find\",\n getData: \"GET /api/todo/get/{id}\",\n createData: \"POST /api/todo/create\",\n updateData: \"POST /api/todo/update?id={id}\",\n destroyData: \"POST /api/todo/delete?id={id}\"\n }\n ```\n- [can-connect/data/url/url.ajax] - Specify a method to use to make requests; [can-ajax] is used by default, but jQuery's `.ajax` method can be passed.\n- [can-connect/data/parse/parse.parseInstanceProp] - Specify the property to find the data that represents an instance item.\n- [can-connect/data/parse/parse.parseInstanceData] - Returns the properties that should be used to\n [can-connect/constructor/constructor.hydrateInstance make an instance]\n given the results of [can-connect/connection.getData], [can-connect/connection.createData],\n [can-connect/connection.updateData],\n and [can-connect/connection.destroyData].\n- [can-connect/data/parse/parse.parseListProp] Specify the property to find the list data within a `getList` response.\n- [can-connect/data/parse/parse.parseListData] Return the correctly formatted data for a `getList` response.\n- [can-connect/base/base.queryLogic] - Specify the identity properties of the\n type. This is built automatically from the `Map` if [can-define/map/map] is used.\n" + } + ], + "returns": { + "types": [ + { + "type": "connection" + } + ], + "description": "A connection that is the combination of the options and all the behaviors\nthat `defineRealtimeRestModel` adds.\n" + } + }, + { + "code": "defineRealtimeRestModel(url)", + "description": "\n\nCreate a connection with just a url. Use this if you do not need to pass in any other `options` to configure the connection.\n\nFor example, the following creates a `Todo` type with the ability to connect to a restful service layer:\n\n```js\nimport {todoFixture} from \"//unpkg.com/can-demo-models@5\";\nimport {defineRealtimeRestModel} from \"can\";\n\n// Creates a mock backend with 5 todos\ntodoFixture(5);\n\nconst Todo = defineRealtimeRestModel(\"/api/todos/{id}\").Map;\n\n// Prints out all todo names\n\nTodo.getList().then(todos => {\n todos.forEach(todo => {\n console.log(todo.name);\n })\n})\n```\n
    \n\n", + "params": [ + { + "types": [ + { + "type": "String" + } + ], + "name": "url", + "description": "The [can-connect/data/url/url.url] used to create, retrieve, update and\n delete data.\n" + } + ], + "returns": { + "types": [ + { + "type": "connection" + } + ], + "description": "A connection that is the combination of the options and all the behaviors\nthat `defineRealtimeRestModel` adds. The `connection` includes a `Map` property which is the type\nconstructor function used to create instances of the raw record data retrieved from the server.\n\n" + } + } + ], + "codepen": [ + [ + "\"can\"", + "\"//unpkg.com/can@6/core.mjs\"" + ], + [ + "\"can/ecosystem\"", + "\"//unpkg.com/can@6/ecosystem.mjs\"" + ], + [ + "\"can/everything\"", + "\"//unpkg.com/can@6/everything.mjs\"" + ], + [ + "\"can/demos/technology-overview/mock-url\"", + "\"//unpkg.com/mock-url@^6.0.0/mock-url.mjs\"" + ], + [ + "\"can/demos/technology-overview/route-mini-app-components\"", + "\"//unpkg.com/route-mini-app@^5.0.0/components.mjs\"" + ], + [ + "return steal.import(", + "return import(" + ], + [ + "\"can/demos/technology-overview/page-login\"", + "\"//unpkg.com/route-mini-app@^5.0.0/page-login.mjs\"" + ], + [ + "`can/demos/technology-overview/page-${this.page}`", + "`//unpkg.com/route-mini-app@^5.0.0/page-${this.page}.mjs`" + ] + ], + "_curReturn": { + "types": [ + { + "type": "connection" + } + ], + "description": "A connection that is the combination of the options and all the behaviors\nthat `defineRealtimeRestModel` adds. The `connection` includes a `Map` property which is the type\nconstructor function used to create instances of the raw record data retrieved from the server.\n\n" + }, + "_curParam": { + "types": [ + { + "type": "String" + } + ], + "name": "url", + "description": "The [can-connect/data/url/url.url] used to create, retrieve, update and\n delete data.\n" }, "comment": " " }, - "can-event-queue": { + "can-define-rest-model": { "src": { - "line": 1, - "codeLine": 19, - "path": "node_modules/can-event-queue/can-event-queue.js" + "path": "node_modules/can-define-rest-model/can-define-rest-model.md" }, + "body": "\n\n## Use\n\nUse `defineRestModel` to build a simple connection to a restful service\nlayer. To use `defineRestModel`, you:\n\n- Define data types to connect to the service layer\n- Configure the connection to the service layer\n- Use the types to manipulate service data\n\n`defineRestModel` is the most\nbasic built-in CanJS model layer. Check out [can-define-realtime-rest-model] for models that\nare able to:\n\n- Add and remove data from lists automatically\n- Unify instances across requests\n\n### Define data types\n\nThe first step in creating a model is to define the types that will be used\nto hold and manipulate data on the server. The following defines:\n\n- a `Todo` type to represent an individual todo's data\n- ` TodoList` type to represent a list of todos\n\n```js\nimport {DefineMap, DefineList, defineRestModel} from \"can\";\n\nconst Todo = DefineMap.extend(\"Todo\",{\n id: {type: \"number\", identity: true},\n name: \"string\",\n complete: \"boolean\",\n createdAt: \"date\",\n toggle(){\n this.complete = !this.complete;\n }\n})\n\nTodo.List = DefineList.extend(\"TodoList\",{\n \"#\": Todo,\n get completeCount(){\n return this.filter({complete: true}).length;\n }\n});\n```\n
    \n\nNotice that properties and methods are defined on the types. While any\nof CanJS's map-types can be used to create a model, [can-define/map/map] currently\nis the easiest to configure.\n\n#### Nested data type or data types with relationships\n\nSometimes your data might include nested data and/or related data. For example, if you\nget `todo` 5's data at `/api/todos/5` and it returns a nested `assignedTo` as follows:\n\n```js\n{\n id: 5,\n name: \"mow lawn\",\n complete: false,\n assignedTo: {\n id: 28,\n userName: \"Justin Meyer\"\n }\n}\n```\n\nYou typically want to define that nested value as another type like:\n\n```js\nconst User = DefineMap.extend(\"User\",{\n id: \"number\",\n userName: \"string\"\n});\n\nconst Todo = DefineMap.extend(\"Todo\",{\n id: {type: \"number\", identity: true},\n name: \"string\",\n complete: \"boolean\",\n assignedTo: User,\n toggle(){\n this.complete = !this.complete;\n }\n});\n```\n\nCheck out the [can-connect/can/ref/ref] behavior for additional relationship features.\n\nIf you are using [can-define/map/map] and your server might add properties that can't be defined\nbeforehand, make sure to unseal your todo type:\n\n```js\nconst Todo = DefineMap.extend(\"Todo\",\n{ \n seal: false\n},\n{\n id: {type: \"number\", identity: true},\n name: \"string\",\n complete: \"boolean\",\n toggle(){\n this.complete = !this.complete;\n }\n});\n```\n\nOften with document-based data structures, it's nice to have a reference to the \"root\"\ndata object on all child objects. For example, `todo` data might have a list of subtasks, each\nwith their own name and complete status:\n\n```js\n{\n id: 5,\n name: \"mow lawn\",\n complete: false,\n subtasks: [\n {name: \"get gas\", complete: true},\n {name: \"sharpen blades\", complete: false}\n ]\n}\n```\n\nIt can be nice to have the individual subtasks have a reference to their parent `todo`. For example, this\nmakes updating the subtask easier. The following makes it so calling a `subtask`'s `.save()` actually\ncalls it's `todo`'s `.save()` method:\n\n```js\nimport {DefineMap, DefineList, defineRestModel} from \"//unpkg.com/can@5/core.mjs\";\nimport {todoFixture} from \"//unpkg.com/can-demo-models@5\";\n\n// Model subtask\nconst Subtask = DefineMap.extend(\"Subtask\",{\n name: \"string\",\n complete: \"boolean\",\n // parentTodo should not be serialized\n parentTodo: {serialize: false, type: \"any\"},\n // a save utility that actually saves the parent todo\n save(){\n this.parentTodo.save();\n }\n});\n\n// Model a list of subtasks to add the `parentTodo` to all subtasks\nSubtask.List = DefineList.extend(\"Subtasks\",{\n // Defines the items in the subtasks list\n \"#\": {\n Type: Subtask,\n // If subtasks are added, set their parentTodo\n added(subtasks){\n if(this.parentTodo) {\n subtasks.forEach((subtask) => {\n subtask.parentTodo = this.parentTodo;\n })\n }\n return subtasks;\n },\n // If subtasks are removed, remove their parentTodo\n removed(subtasks) {\n subtasks.forEach((subtask) => {\n subtask.parentTodo = null;\n })\n }\n },\n // If parentTodo is set, update all the subtasks' parentTodo\n parentTodo: {\n set(parentTodo){\n this.forEach(function(subtask){\n subtask.parentTodo = parentTodo;\n });\n return parentTodo;\n },\n serialize: false\n }\n});\n\nconst Todo = DefineMap.extend(\"Todo\",{\n id: {type: \"number\", identity: true},\n name: \"string\",\n complete: \"boolean\",\n // Make it so when subtasks is set, it sets\n // the parentTodo reference:\n subtasks: {\n Type: Subtask.List,\n set(subtasks){\n subtasks.parentTodo = this;\n return subtasks;\n }\n },\n toggle(){\n this.complete = !this.complete;\n }\n});\n\nTodo.List = DefineList.extend(\"TodoList\",{\n \"#\": Todo,\n});\n\n// Sets up a can-fixture as the backend\ntodoFixture(0);\n\n// Creates a defineRestModel\nTodo.connection = defineRestModel({\n Map: Todo,\n List: Todo.List,\n url: \"/api/todos/{id}\"\n});\n\n// Creates a new todo with one subtask\nlet myTodo = new Todo({\n name: \"learn canjs\", completed: false,\n subtasks: [{name: \"learn js\", completed: false}]\n});\n\n// Modifies and saves the subtask (thus saving the entire todo)\nmyTodo.subtasks[0].completed = true;\nmyTodo.subtasks[0].save();\n\n// Reads the newly saved todo from the backend and prints it's completed status\nTodo.getList().then(todos => console.log(todos[0].subtasks[0].completed));\n```\n
    \n
    \n\n\n#### The identity property\n\nIf you're specifying the identity property on nested data types, `defineRestModel` will be able to\nintelligently merge data. For example, say a `Todo` and its nested `User` type are defined as follows:\n\n```js\nconst User = DefineMap.extend(\"User\",{\n id: \"number\",\n name: \"string\"\n});\n\nconst Todo = DefineMap.extend(\"Todo\",{\n id: {type: \"number\", identity: true},\n name: \"string\",\n complete: \"boolean\",\n assignedTo: [User]\n});\n```\n\nIf a todo like the following:\n\n```js\nlet justin = new User({id: 20, name: \"Justin\"}),\n ramiya = new User({id: 21, name: \"Ramiya\"});\n\nlet todo = new Todo({\n id: 1,\n name: \"mow lawn\",\n complete: false,\n assignedTo: [justin, ramiya]\n});\n```\n\nis updated with data like:\n\n```js\n{\n id: 1,\n name: \"mow lawn\",\n complete: true,\n assignedTo: [{\n id: 21, name: \"Ramiya Meyer\"\n }]\n}\n```\n\n__Without__ specifying the identity property of `User`, the `justin` instance's `id` and `name` will be updated, __not__ the `ramiya` instance's like you might expect:\n\n```js\njustin.id //-> 21\njustin.name //-> \"Ramiya Meyer\"\n```\n\nHowever, if the `User` object's `id` property is specified with an `identity: true` flag as follows:\n\n```js\nconst User = DefineMap.extend(\"User\",{\n id: {type: \"number\", identity: true},\n name: \"string\"\n});\n```\n
    \n\nWhen the update happens, the `ramiya` instance will be updated correctly:\n\n```js\nramiya.id //-> 21\nramiya.name //-> \"Ramiya Meyer\"\n```\n\n\n### Configure the connection\n\nOnce you have your types defined, the next step is to configure\nyour connection to make requests to your service layer and create\nthese types.\n\nIf your service layer matches what CanJS expects, this configuration\nmight be as simple as the following:\n\n```js\nTodo.connection = defineRestModel({\n Map: Todo,\n List: Todo.List,\n url: \"/api/todos/{id}\"\n});\n```\n\nThis configuration assumes the following:\n\n - `GET /api/todos` is used to retrieve a list of todos. It returns a JSON response like:\n ```js\n {\n data: [\n { id: 5, name: \"mow lawn\", complete: false },\n ...\n ],\n totalCount: 20\n }\n ```\n Note that an object is returned with a `data` array. The array contains the data\n that will be used to create instances of the `Todo` type. Other properties on the object\n (ex: `totalCount`) will be added to the list type. The data above produces:\n\n ```js\n todos instanceof Todo.List //-> true\n todos.totalCount //-> 20\n todos[0] instanceof Todo //-> true\n todos[0].id //-> 5\n ```\n- `GET /api/todos/5` is used to retrieve a single todo. It returns a JSON response like:\n ```js\n { id: 5, name: \"mow lawn\", complete: false }\n ```\n Note that the object returned contains the values that will be used to create a `Todo` instance.\n- `POST /api/todos` is used to create a single todo record. It should take a JSON request body of\n the properties on a todo record like:\n ```js\n { name: \"do dishes\", complete: false }\n ```\n The server should return a JSON response with the identity properties and any other values that\n should be included on the object:\n ```js\n { id: 6, name: \"do dishes\", complete: false, createdAt: \"2018-04-18\" }\n ```\n- `PUT /api/todos/6` is used to update a todo record. It should take a `JSON` request body of\n the properties of the todo record (with the exception of the identity keys) like:\n ```js\n { name: \"do dishes\", complete: true, createdAt: \"2018-04-18\" }\n ```\n The server should return a JSON response with the full record:\n ```js\n { id: 6, name: \"do dishes\", complete: true, createdAt: \"2018-04-18\" }\n ```\n- `DELETE /api/todos/6` is used to delete a todo record. The server should return the record data:\n ```js\n { id: 6, name: \"do dishes\", complete: true, createdAt: \"2018-04-18\" }\n ```\n or an empty successful response.\n\n\nIf your service layer doesn't match what CanJS expects, then you can configure\neither how the request is made or how the response is parsed.\n\nThe `url` option can be configured with individual urls used to create, retrieve, update\nand delete data:\n\n```js\nTodo.connection = defineRestModel({\n Map: Todo,\n List: Todo.List,\n url: {\n getListData: \"GET /api/todos/find\",\n getData: \"GET /api/todo/get/{id}\",\n createData: \"POST /api/todo/create\",\n updateData: \"POST /api/todo/update?id={id}\",\n destroyData: \"POST /api/todo/delete?id={id}\"\n }\n});\n```\n\nYou can also supply functions to retrieve the data yourself and return a promise that\nresolves to the expected data format. The following makes `getListData` use\n`fetch` to request JSON data:\n\n```js\nimport { param, defineRestModel } from \"can\";\n\nTodo.connection = defineRestModel({\n Map: Todo,\n List: Todo.List,\n url: {\n getListData: function(query) {\n return fetch(\"/api/todos/find?\"+param(query)).then(function(response){\n return response.json();\n })\n },\n getData: \"GET /api/todo/get/{id}\",\n createData: \"POST /api/todo/create\",\n updateData: \"POST /api/todo/update?id={id}\",\n destroyData: \"POST /api/todo/delete?id={id}\"\n }\n});\n```\n\nIf the response data doesn't match the expected format, you can either fix it in\nfunctions like `getListData` above or use\n[can-connect/data/parse/parse.parseInstanceProp], [can-connect/data/parse/parse.parseListProp],\n[can-connect/data/parse/parse.parseInstanceData] or [can-connect/data/parse/parse.parseListData]\nto fix the formatting. For example, if `GET /api/todos` returned data like:\n\n```js\n{\n todos: [\n { id: 5, name: \"mow lawn\", complete: false },\n ...\n ],\n totalCount: 20\n}\n```\n\nYou could correct this with [can-connect/data/parse/parse.parseListProp] like:\n\n```js\nTodo.connection = defineRestModel({\n Map: Todo,\n List: Todo.List,\n url: \"/api/todos/{id}\",\n parseListProp: \"todos\"\n});\n```\n\n\n\n### Manipulate service data\n\nThe below code allows one to retrieve, create, update, and destroy instances using\nmethods on `Todo` and instances of `Todo`:\n\n```js\nimport {Todo, todoFixture} from \"//unpkg.com/can-demo-models@5\";\nimport {defineRestModel} from \"can\";\n\n// Creates a mock backend with 5 todos\ntodoFixture(5);\n\nTodo.connection = defineRestModel({\n Map: Todo,\n List: Todo.List,\n url: \"/api/todos/{id}\"\n});\n\n// get a list of todos\nTodo.getList({filter: {complete: true}}) //-> Promise\n\n// get a single todo\nTodo.get({id: 4}) //-> Promise\n\n// create a todo and persist it to the server:\nlet todo = new Todo({name: \"learn canjs\", complete: false})\ntodo.save() //-> Promise\n\n// update the todo and persist changes to the server:\ntodo.complete = true;\ntodo.save() //-> Promise\n\n// prints out all complete todos including the new one\nTodo.getList({filter: {complete: true}})\n .then(todos => todos.forEach(todo => console.log(todo.name)))\n\n// delete the todo on the server\ntodo.destroy() //-> Promise\n```\n
    \n\n`defineRestModel` also mixes in methods that let you know if the\nobject is being saved, destroyed, or has already been created:\n\n- [can-connect/can/map/map.prototype.isSaving]\n- [can-connect/can/map/map.prototype.isDestroying]\n- [can-connect/can/map/map.prototype.isNew]\n\n```js\ntodo.isSaving() //-> Boolean\n\ntodo.isDestroying() //-> Boolean\n\ntodo.isNew() //-> Boolean\n```\n\nThese methods are observable, so they can be read in a template and the template will automatically\nupdate:\n\n```js\n\n```\n\n`defineRestModel` also makes the type and instances of the type emit events when items\nare created, updated or destroyed:\n\n```js\nTodo.on(\"created\", function(ev, newTodo) {\n console.log(\"Todo created event\");\n});\n\nlet todo = new Todo({name: \"mow lawn\"});\ntodo.on(\"created\", function(){\n console.log(\"todo created event\");\n})\n\ntodo.save()\n //-> logs \"todo created event\"\n // logs \"Todo created event\"\n```\n\n", + "description": "\nConnect a type to a restful service layer.\n", "type": "module", - "body": "", - "description": "Mixin observable behavior to your types. \n", - "title": "can-event-queue", + "title": "", "types": [ { - "type": "undefined", - "description": "\n\nThe `can-event-queue` package contains modules that mixin\ncommon observable methods and symbols onto objects\nand functions. The following are the included modules:\n\n- [can-event-queue/value/value] - Mixins for single-value observables like [can-observation].\n- [can-event-queue/map/map] - Mixins for key-value observables like [can-define].\n- [can-event-queue/type/type] - Mixins on constructor functions.\n" + "type": "function", + "returns": { + "types": [ + { + "type": "undefined" + } + ] + }, + "params": [] } ], - "name": "can-event-queue", - "parent": "can-observables", - "collection": "can-infrastructure", + "name": "can-define-rest-model", + "parent": "can-data-modeling", + "collection": "can-legacy", "package": { "author": { - "name": "DoneJS", + "name": "DoneJS Core Team", "email": "core@donejs.com", - "url": "http://canjs.com" + "url": "http://donejs.com" }, "bugs": { - "url": "https://github.com/canjs/can-event-queue/issues" + "url": "https://github.com/canjs/can-define-rest-model/issues" }, "bundleDependencies": false, "dependencies": { - "can-define-lazy-value": "^1.0.1", - "can-dom-events": "^1.0.0", - "can-key-tree": "^1.1.0", - "can-log": "^1.0.0", - "can-queues": "^1.0.0", - "can-reflect": "^1.10.2", - "can-symbol": "^1.2.0" + "can-connect": "^4.0.0", + "can-define": "^2.2.0", + "can-globals": "^1.0.1", + "can-namespace": "^1.0.0", + "can-query-logic": "<2.0.0", + "can-reflect": "^1.15.2" }, "deprecated": false, - "description": "A event mixin that uses queues to dispatch handlers", + "description": "Connect a map to a rest connection", "devDependencies": { - "done-serve": "^3.3.1", - "donejs-cli": "^3.1.1", - "generator-donejs": "^3.3.0", + "can-fixture": "^3.0.0", + "http-server": "^0.11.0", "jshint": "^2.9.1", "steal": "^2.2.1", "steal-qunit": "^2.0.0", "steal-tools": "^2.2.1", + "test-saucelabs": "^0.0.6", "testee": "^0.9.0" }, - "homepage": "https://github.com/canjs/can-event-queue#readme", + "homepage": "http://canjs.com", "keywords": [ - "canjs" - ], - "license": "MIT", - "main": "./can-event-queue.js", - "name": "can-event-queue", + "canjs", + "donejs", + "donejs-plugin" + ], + "license": "MIT", + "main": "can-define-rest-model", + "name": "can-define-rest-model", "repository": { "type": "git", - "url": "git://github.com/canjs/can-event-queue.git" + "url": "git://github.com/canjs/can-define-rest-model.git" }, "scripts": { "build": "node build.js", + "ci": "npm run test && node test-saucelabs.js", "develop": "done-serve --static --develop --port 8080", - "jshint": "jshint ./*.js map/**/*.js type/*.js value/*.js --config", + "http-server": "http-server -p 3000 --silent", + "jshint": "jshint ./*.js --config", "postpublish": "git push --tags && git checkout master && git branch -D release && git push", "preversion": "npm test && npm run build", "release:major": "npm version major && npm publish", @@ -3340,71 +4401,127 @@ "generator-donejs", "donejs-cli", "steal-tools" - ], - "plugins": [ - "steal-less", - "steal-stache" ] }, - "version": "1.1.6" - } - }, - "can-global": { - "body": "", - "description": "", - "type": "module", - "title": "can-global", - "types": [ + "version": "2.0.0" + }, + "outline": { + "depth": 2 + }, + "signatures": [ { - "type": "function", + "code": "defineRestModel(options)", + "description": "\n\n`defineRestModel` extends the provided `options.Map` type\nwith the ability to connect to a restful service layer. For example,\nthe following extends a `Todo` type\nwith the ability to connect to a restful service layer:\n\n```js\nimport {Todo, todoFixture} from \"//unpkg.com/can-demo-models@5\";\nimport {defineRestModel} from \"can\";\n\n// Creates a mock backend with 5 todos\ntodoFixture(5);\n\nTodo.connection = defineRestModel({\n Map: Todo,\n List: Todo.List,\n url: \"/api/todos/{id}\"\n});\n\n// Prints out all todo names\nTodo.getList().then(todos => {\n todos.forEach(todo => {\n console.log(todo.name);\n })\n})\n```\n
    \n\n\n`defineRestModel` mixes in the following behaviors:\n\n- [can-connect/constructor/constructor]\n- [can-connect/can/map/map]\n- [can-connect/data/parse/parse]\n- [can-connect/data/url/url]\n- [can-connect/base/base]\n", + "params": [ + { + "types": [ + { + "type": "Object", + "options": [] + } + ], + "name": "options", + "description": "Configuration options supported by all the mixed-in behaviors:\n\n- [can-connect/can/map/map._Map] - The map type constructor function used to create\n instances of the raw record data retrieved from the server.\n The type will also be decorated\n with the following methods:\n - [can-connect/can/map/map.getList]\n - [can-connect/can/map/map.get]\n - [can-connect/can/map/map.prototype.save]\n - [can-connect/can/map/map.prototype.destroy]\n - [can-connect/can/map/map.prototype.isSaving]\n - [can-connect/can/map/map.prototype.isDestroying]\n - [can-connect/can/map/map.prototype.isNew]\n\n- [can-connect/can/map/map._List] - The list type constructor function used to create\n a list of instances of the raw record data retrieved from the server. _\n- [can-connect/data/url/url.url] - Configure the URLs used to create, retrieve, update and\n delete data. It can be configured with a single url like:\n\n ```js\n url: \"/api/todos/{id}\"\n ```\n\n Or an object that configures how to create, retrieve, update and delete individually:\n\n ```js\n url: {\n getListData: \"GET /api/todos/find\",\n getData: \"GET /api/todo/get/{id}\",\n createData: \"POST /api/todo/create\",\n updateData: \"POST /api/todo/update?id={id}\",\n destroyData: \"POST /api/todo/delete?id={id}\"\n }\n ```\n- [can-connect/data/url/url.ajax] - Specify a method to use to make requests; [can-ajax] is used by default, but jQuery's `.ajax` method can be passed.\n- [can-connect/data/parse/parse.parseInstanceProp] - Specify the property to find the data that represents an instance item.\n- [can-connect/data/parse/parse.parseInstanceData] - Returns the properties that should be used to\n [can-connect/constructor/constructor.hydrateInstance make an instance]\n given the results of [can-connect/connection.getData], [can-connect/connection.createData],\n [can-connect/connection.updateData],\n and [can-connect/connection.destroyData].\n- [can-connect/data/parse/parse.parseListProp] Specify the property to find the list data within a `getList` response.\n- [can-connect/data/parse/parse.parseListData] Return the correctly formatted data for a `getList` response.\n- [can-connect/base/base.queryLogic] - Specify the identity properties of the\n type. This is built automatically from the `Map` if [can-define/map/map] is used.\n" + } + ], "returns": { "types": [ { - "type": "undefined" + "type": "connection" } - ] - }, - "params": [] - } - ], - "name": "can-global", - "parent": "can-infrastructure", - "signatures": [ + ], + "description": "Returns a connection object.\n" + } + }, { - "code": "GLOBAL()", - "description": "\n\nReturns the global that this environment provides. It will be one of:\n\n* **Browser**: `window`\n* **Web Worker**: `self`\n* **Node.js**: `global`\n\n```js\nvar GLOBAL = require(\"can-global\");\n\nvar g = GLOBAL();\n\n// In a browser\nconsole.log(g === window); // -> true\n```\n", - "params": [], + "code": "defineRestModel(url)", + "description": "\n\nCreate a connection with just a url. Use this if you do not need to pass in any other `options` to configure the connection.\n\nFor example, the following creates a `Todo` type with the ability to connect to a restful service layer:\n\n```js\nimport {todoFixture} from \"//unpkg.com/can-demo-models@5\";\nimport {defineRestModel} from \"can\";\n\n// Creates a mock backend with 5 todos\ntodoFixture(5);\n\nconst Todo = defineRestModel(\"/api/todos/{id}\").Map;\n\n// Prints out all todo names\nTodo.getList().then(todos => {\n todos.forEach(todo => {\n console.log(todo.name);\n })\n})\n```\n
    \n\n", + "params": [ + { + "types": [ + { + "type": "String" + } + ], + "name": "url", + "description": "The [can-connect/data/url/url.url] used to create, retrieve, update and\n delete data.\n" + } + ], "returns": { "types": [ { - "type": "Object", - "options": [] + "type": "connection" } ], - "description": "The global object for this JavaScript environment.\n" + "description": "A connection that is the combination of the options and all the behaviors\nthat `defineRestModel` adds. The `connection` includes a `Map` property which is the type\nconstructor function used to create instances of the raw record data retrieved from the server.\n" } } ], + "codepen": [ + [ + "\"can\"", + "\"//unpkg.com/can@6/core.mjs\"" + ], + [ + "\"can/ecosystem\"", + "\"//unpkg.com/can@6/ecosystem.mjs\"" + ], + [ + "\"can/everything\"", + "\"//unpkg.com/can@6/everything.mjs\"" + ], + [ + "\"can/demos/technology-overview/mock-url\"", + "\"//unpkg.com/mock-url@^6.0.0/mock-url.mjs\"" + ], + [ + "\"can/demos/technology-overview/route-mini-app-components\"", + "\"//unpkg.com/route-mini-app@^5.0.0/components.mjs\"" + ], + [ + "return steal.import(", + "return import(" + ], + [ + "\"can/demos/technology-overview/page-login\"", + "\"//unpkg.com/route-mini-app@^5.0.0/page-login.mjs\"" + ], + [ + "`can/demos/technology-overview/page-${this.page}`", + "`//unpkg.com/route-mini-app@^5.0.0/page-${this.page}.mjs`" + ] + ], "_curReturn": { "types": [ { - "type": "Object", - "options": [] + "type": "connection" } ], - "description": "The global object for this JavaScript environment.\n" - } + "description": "A connection that is the combination of the options and all the behaviors\nthat `defineRestModel` adds. The `connection` includes a `Map` property which is the type\nconstructor function used to create instances of the raw record data retrieved from the server.\n" + }, + "_curParam": { + "types": [ + { + "type": "String" + } + ], + "name": "url", + "description": "The [can-connect/data/url/url.url] used to create, retrieve, update and\n delete data.\n" + }, + "comment": " " }, - "can-fragment": { + "can-deparam": { + "name": "can-deparam", + "type": "module", + "parent": "can-routing", "src": { - "line": 7, - "codeLine": 43, - "path": "node_modules/can-fragment/can-fragment.js" + "line": 3, + "codeLine": 39, + "path": "node_modules/can-deparam/can-deparam.js" }, - "type": "module", - "body": "\n\n## Use\n\nContentArrays can be used to combine multiple HTMLElements into a single document fragment. For example:\n\n var fragment = require(\"can-fragment\");\n\n var p = document.createElement(\"p\");\n p.innerHTML = \"Welcome to CanJS\";\n var contentArray = [\"

    Hi There

    \", p];\n var fragment = fragment( contentArray )\n\n`fragment` will be a documentFragment with the following elements:\n\n

    Hi There

    \n

    Welcome to CanJS

    \n\n \n", - "description": "\nConvert a String, HTMLElement, documentFragment, contentArray, or object with a `can.toDOM` symbol into a documentFragment.\n", - "title": "", + "body": "\n## Try it\n\nUse this JS Bin to play around with this package:\n\ncan-deparam on jsbin.com\n\n\n", + "description": "Deserialize a query string into an array or object. ", + "title": "can-deparam", "types": [ { "type": "function", @@ -3418,51 +4535,45 @@ "params": [] } ], - "name": "can-fragment", - "parent": "can-dom-utilities", "collection": "can-infrastructure", "package": { "author": { - "name": "donejs core team", - "email": "core@donejs.com", - "url": "http://donejs.com" + "name": "Bitovi", + "email": "contact@bitovi.com", + "url": "https://www.bitovi.com/" }, "bugs": { - "url": "https://github.com/canjs/can-fragment/issues" + "url": "https://github.com/canjs/can-deparam/issues" }, "bundleDependencies": false, "dependencies": { - "can-child-nodes": "^1.0.0", - "can-globals": "^1.0.1", - "can-namespace": "^1.0.0", - "can-reflect": "^1.16.1", - "can-symbol": "^1.6.1" + "can-namespace": "1.0.0" }, "deprecated": false, - "description": "Create a fragment from lots of stuff", + "description": "Deserialize a query string into an array or object.", "devDependencies": { - "can-vdom": "^4.0.1", + "can-string-to-any": "^1.0.1", + "detect-cyclic-packages": "^1.1.0", "jshint": "^2.9.1", "steal": "^2.2.1", "steal-qunit": "^2.0.0", "steal-tools": "^2.2.1", "testee": "^0.9.0" }, - "homepage": "http://canjs", + "homepage": "https://canjs.com/doc/can-deparam.html", "keywords": [ "canjs", - "donejs", - "donejs-plugin" + "query string" ], - "license": "MIT", - "main": "can-fragment", - "name": "can-fragment", + "main": "can-deparam", + "name": "can-deparam", "repository": { "type": "git", - "url": "git://github.com/canjs/can-fragment.git" + "url": "git://github.com/canjs/can-deparam.git" }, "scripts": { "build": "node build.js", + "detect-cycle": "detect-cyclic-packages --ignore done-serve", "develop": "done-serve --static --develop --port 8080", "jshint": "jshint ./*.js --config", "postpublish": "git push --tags && git checkout master && git branch -D release && git push", @@ -3470,7 +4581,7 @@ "release:major": "npm version major && npm publish", "release:minor": "npm version minor && npm publish", "release:patch": "npm version patch && npm publish", - "test": "npm run jshint && npm run testee", + "test": "npm run detect-cycle && npm run jshint && npm run testee", "testee": "testee test.html --browsers firefox", "version": "git commit -am \"Update version number\" && git checkout -b release && git add -f dist/" }, @@ -3485,194 +4596,121 @@ "steal-tools" ] }, - "version": "1.3.1" + "version": "1.2.2" }, "signatures": [ { - "code": "fragment(item, doc)", + "code": "deparam(params)", "description": "\n", "params": [ { "types": [ { "type": "String" - }, - { - "type": "HTMLElement" - }, - { - "type": "documentFragment" - }, - { - "type": "contentArray" } ], - "name": "item", - "description": "" + "name": "params", + "description": "A form-urlencoded string of key-value pairs." }, { "types": [ { - "type": "Document" + "type": "function", + "returns": { + "types": [ + { + "type": "undefined" + } + ] + }, + "params": [] } ], - "name": "doc", - "description": "an optional DOM document in which to build the fragment\n" + "optional": true, + "name": "valueDeserializer", + "description": "A function that decodes the string values. For example, using\n[can-string-to-any] will convert `\"null\"` to `null` like:\n\n ```js\n import stringToAny from \"can-string-to-any\";\n deparam(\"value=null\", stringToAny) //-> {value: null}\n ```" } ], "returns": { "types": [ { - "type": "documentFragment" + "type": "Object", + "options": [] } ], - "description": "\n" + "description": "The params formatted into an object\n\nTakes a string of name value pairs and returns a Object literal that represents those params.\n\n```js\nvar deparam = require(\"can-deparam\");\n\nconsole.log(JSON.stringify(deparam(\"?foo=bar&number=1234\"))); // -> '{\"foo\" : \"bar\", \"number\": 1234}'\nconsole.log(JSON.stringify(deparam(\"#foo[]=bar&foo[]=baz\"))); // -> '{\"foo\" : [\"bar\", \"baz\"]}'\nconsole.log(JSON.stringify(deparam(\"foo=bar%20%26%20baz\"))); // -> '{\"foo\" : \"bar & baz\"}'\n```" } } ], "_curParam": { "types": [ { - "type": "Document" - } - ], - "name": "doc", - "description": "an optional DOM document in which to build the fragment\n" - }, - "_curReturn": { - "types": [ - { - "type": "documentFragment" - } - ], - "description": "\n" - }, - "comment": " " - }, - "can-util/js/import/import": { - "type": "module", - "name": "can-util/js/import/import", - "parent": "can-util/js", - "src": { - "line": 6, - "codeLine": 24, - "path": "node_modules/can-util/js/import/import.js" - }, - "body": "", - "description": "", - "title": "import", - "types": [ - { - "type": "function", - "returns": { - "types": [ - { - "type": "undefined" - } - ] - }, - "params": [] - } - ], - "signatures": [ - { - "code": "importModule(moduleName, parentName)", - "description": "\n\n```js\nvar importModule = require(\"can-util/js/import/import\");\n\nimportModule(\"foo.stache\").then(function(){\n // module was imported\n});\n```\n", - "params": [ - { + "type": "function", + "returns": { "types": [ { - "type": "String" + "type": "undefined" } - ], - "name": "moduleName", - "description": "The module to be imported." + ] }, - { - "types": [ - { - "type": "String" - } - ], - "optional": true, - "name": "parentName", - "description": "A parent module that will be used as a reference for resolving relative module imports." - } - ], - "returns": { - "types": [ - { - "type": "Promise" - } - ], - "description": "A Promise that will resolve when the module has been imported.\n" - } - } - ], - "_curParam": { - "types": [ - { - "type": "String" + "params": [] } ], "optional": true, - "name": "parentName", - "description": "A parent module that will be used as a reference for resolving relative module imports." + "name": "valueDeserializer", + "description": "A function that decodes the string values. For example, using\n[can-string-to-any] will convert `\"null\"` to `null` like:\n\n ```js\n import stringToAny from \"can-string-to-any\";\n deparam(\"value=null\", stringToAny) //-> {value: null}\n ```" }, "_curReturn": { "types": [ { - "type": "Promise" + "type": "Object", + "options": [] } ], - "description": "A Promise that will resolve when the module has been imported.\n" - } - }, - "can-importer": { - "src": { - "path": "node_modules/can-import-module/can-import-module.md" + "description": "The params formatted into an object\n\nTakes a string of name value pairs and returns a Object literal that represents those params.\n\n```js\nvar deparam = require(\"can-deparam\");\n\nconsole.log(JSON.stringify(deparam(\"?foo=bar&number=1234\"))); // -> '{\"foo\" : \"bar\", \"number\": 1234}'\nconsole.log(JSON.stringify(deparam(\"#foo[]=bar&foo[]=baz\"))); // -> '{\"foo\" : [\"bar\", \"baz\"]}'\nconsole.log(JSON.stringify(deparam(\"foo=bar%20%26%20baz\"))); // -> '{\"foo\" : \"bar & baz\"}'\n```" }, - "body": "\n\n\n", - "description": "\n# can-importer\n", - "name": "can-importer", - "type": "page" + "comment": " " }, - "can-key": { + "can-diff": { "src": { - "path": "node_modules/can-key/can-key.md" + "path": "node_modules/can-diff/can-diff.md" }, - "body": "", - "description": "Utilities that read and write nested properties on objects and arrays. \n", + "body": "\n", + "description": "\nUtilities for comparing and applying differences between data structures.\n", "type": "module", "title": "", "types": [ { "type": "Object", "options": [], - "description": "\n\n `can-key` exports an object that contains all of its module functions:\n\n ```js\n import key from \"can-key\";\n\n var task = {\n name: \"learn can-key\",\n owner: {\n name: {first: \"Justin\", last: \"Meyer\"}\n }\n }\n\n // delete a nested key\n key.delete(task, \"owner.name.first\");\n\n // get a nested key\n key.get(task, \"owner.name.last\") //-> \"Meyer\"\n\n // set a nested key\n key.set(task, \"owner.name.first\", \"Bohdi\");\n\n // replace templated parts of a string with values\n key.replaceWith(\"{owner.name.first} {owner.name.last}\", task) //-> \"Bohdi Meyer\"\n\n // move values from one part of an object to another\n key.transform(obj, {\n \"owner.name\": \"user.name\"\n })\n\n // call a function for each key read\n key.walk(task, \"user.name.first\", function(keyInfo){ ... })\n ```\n" + "description": "\n\n `can-diff` exports an object that contains all of its module functions:\n\n ```js\n import {diff} from \"can-diff\";\n\n // Difference between two lists\n diff.list([\"a\",\"b\"], [\"a\",\"c\"])\n //-> [{type: \"splice\", index: 1, deleteCount: 1, insert: [\"c\"]}]\n\n // Difference between two objects\n diff.map({a: \"a\"},{a: \"A\"})\n //-> [{type: \"set\", key: \"a\", value: \"A\"}]\n\n // Diffs an object or array \"deeply\"\n diff.deep({inner: []}, {inner: ['a']});\n //-> [{\n // key: 'inner',\n // type: \"splice\",\n // index: 0,\n // deleteCount: 0,\n // insert: ['a']\n // }]\n\n\n var ramiya = new User({id: 21, name: \"Ramiya\"});\n\n var todo = new Todo({\n name: \"mow lawn\",\n assignedTo: [{id: 20, name: \"Justin\"}, ramiya]\n });\n\n // Updates `dest` with source using identity awareness\n diff.mergeDeep(todo, {\n id: 1,\n name: \"mow lawn\",\n complete: true,\n assignedTo: [{\n id: 21, name: \"Ramiya Meyer\"\n }]\n });\n\n ramiya //-> User({id: 21, name: \"Ramiya Meyer\"})\n\n\n var hobbies = new DefineList([\"dancin\",\"programmin\"]);\n var hobbiesObservable = value.fromValue(hobbies);\n\n // Emits patches from changes in a source observable\n var patcher = new Patcher(hobbies);\n\n canReflect.onPatches(patcher, console.log);\n ```\n" } ], - "name": "can-key", + "name": "can-diff", "parent": "can-js-utilities", "collection": "can-infrastructure", "package": { "author": { - "name": "DoneJS", + "name": "DoneJS Core Team", "email": "core@donejs.com", - "url": "donejs.com" + "url": "http://donejs.com" }, "bugs": { - "url": "https://github.com/canjs/can-key/issues" + "url": "https://github.com/canjs/can-diff/issues" }, "bundleDependencies": false, "dependencies": { - "can-namespace": "^1.0.0", - "can-reflect": "^1.13.3", - "can-symbol": "^1.0.0" + "can-key-tree": "^1.0.2", + "can-queues": "^1.0.1", + "can-reflect": "^1.14.1" }, "deprecated": false, - "description": "Read nested key values", + "description": "Diffing helpers for can-reflect", "devDependencies": { + "can-define": "^2.1.0", + "can-key": "<2.0.0", + "can-simple-observable": "^2.0.4", + "can-symbol": "^1.6.1", "jshint": "^2.9.1", "steal": "^2.2.1", "steal-qunit": "^2.0.0", @@ -3682,77 +4720,59 @@ "homepage": "http://canjs.com", "keywords": [ "canjs", + "donejs", "donejs-plugin" ], "license": "MIT", - "main": "can-key", - "name": "can-key", + "main": "can-diff", + "name": "can-diff", "repository": { "type": "git", - "url": "git://github.com/canjs/can-key.git" + "url": "git://github.com/canjs/can-diff.git" }, "scripts": { "build": "node build.js", "develop": "done-serve --static --develop --port 8080", "jshint": "jshint ./*.js --config", - "postpublish": "git push --tags && git checkout master && git branch -D release && git push", - "preversion": "npm test && npm run build", + "postpublish": "git push --tags && git push", + "preversion": "npm test", "release:major": "npm version major && npm publish", "release:minor": "npm version minor && npm publish", "release:patch": "npm version patch && npm publish", "test": "npm run jshint && npm run testee", - "testee": "testee test.html --browsers firefox", - "version": "git commit -am \"Update version number\" && git checkout -b release && git add -f dist/" + "testee": "testee test.html --browsers firefox" }, "steal": { - "main": "can-key", - "configDependencies": [ - "live-reload" - ], - "npmIgnore": [ - "testee", - "generator-donejs", - "donejs-cli", - "steal-tools" - ], - "plugins": [ - "steal-less", - "steal-stache" - ] + "main": "can-diff" }, - "version": "1.2.1" + "version": "1.5.0" } }, - "can-join-uris": { + "can-dom-events.addEvent": { + "type": "function", + "name": "can-dom-events.addEvent", + "parent": "can-dom-events.static", "src": { - "path": "node_modules/can-join-uris/can-join-uris.md" + "line": 11, + "codeLine": 27, + "path": "node_modules/can-dom-events/can-dom-events.js" }, - "body": "", - "description": "Join together a URI path to a base. ", - "type": "module", - "title": "", - "types": [ - { - "type": "Object", - "options": [] - } - ], - "name": "can-join-uris", - "parent": "can-js-utilities", - "collection": "can-infrastructure", + "body": "\n", + "description": "\nAdd a custom event to the global event registry.\n", + "title": "addEvent", "signatures": [ { - "code": "joinURIs(base, href)", - "description": "\n\nProvides a convenient way to join together URIs handling relative paths.\n\n```js\nimport joinURIs from \"can-join-uris\";\n\nconst base = \"http://example.com/some/long/path\";\nconst href = \"../../images/foo.png\";\n\nconst res = joinURIs( base, href );\n\nconsole.log( res ); // -> http://example.com/images/foo.png\n```\n", + "code": "addEvent( event [, eventType ] )", + "description": "\n\n```js\nvar removeReturnEvent = domEvents.addEvent(enterEvent, \"return\");\n```\n", "params": [ { "types": [ { - "type": "String" + "type": "can-dom-events/EventDefinition" } ], - "name": "base", - "description": "" + "name": "event", + "description": "The custom event definition." }, { "types": [ @@ -3760,17 +4780,25 @@ "type": "String" } ], - "name": "href", - "description": "" + "name": "eventType", + "description": "The event type to associated with the custom event." } ], "returns": { "types": [ { - "type": "String" + "type": "function", + "returns": { + "types": [ + { + "type": "undefined" + } + ] + }, + "params": [] } ], - "description": "The result of joining the two parts.\n" + "description": "The callback to remove the custom event from the registry.\n" } } ], @@ -3780,626 +4808,472 @@ "type": "String" } ], - "name": "href", - "description": "" + "name": "eventType", + "description": "The event type to associated with the custom event." }, "_curReturn": { "types": [ { - "type": "String" + "type": "function", + "returns": { + "types": [ + { + "type": "undefined" + } + ] + }, + "params": [] } ], - "description": "The result of joining the two parts.\n" + "description": "The callback to remove the custom event from the registry.\n" } }, - "can-list": { + "can-dom-events.addEventListener": { + "type": "function", + "name": "can-dom-events.addEventListener", + "parent": "can-dom-events.static", "src": { - "path": "node_modules/can-list/docs/list.md" + "line": 31, + "codeLine": 43, + "path": "node_modules/can-dom-events/can-dom-events.js" }, - "body": "\n\nUse for observable array-like objects.\n\n\n## Use\n\n`List` is used to observe changes to an Array. `List` extends `[can-map]`, so all the\nways that you're used to working with Maps also work here.\n\nUse [can-list::attr attr] to read and write properties of a list:\n\n var hobbies = new List([\"JS\",\"Party Rocking\"])\n hobbies.attr(0) //-> \"JS\"\n hobbies.attr(\"length\") //-> 2\n\n hobbies.attr(0,\"JavaScript\")\n\n hobbies.attr() //-> [\"JavaScript\",\"Party Rocking\"]\n\nJust as you shouldn't set properties of an Map directly, you shouldn't change elements\nof a List directly. Always use `attr` to set the elements of a List, or use [can-list::push push],\n[can-list::pop pop], [can-list::shift shift], [can-list::unshift unshift], or [can-list::splice splice].\n\nHere is a tour through the forms of `List`'s `attr` that parallels the one found under [can-map.prototype.attr attr]:\n\n```\nvar people = new List(['Alex', 'Bill']);\n\n// set an element:\npeople.attr(0, 'Adam');\npeople[0] = 'Adam'; // don't do this!\n\n// get an element:\npeople.attr(0); // 'Adam'\npeople[0]; // 'Adam'\n\n// get all elements:\npeople.attr(); // ['Adam', 'Bill']\n\n// extend the array:\npeople.attr(4, 'Charlie');\npeople.attr(); // ['Adam', 'Bill', undefined, undefined, 'Charlie']\n\n// merge the elements:\npeople.attr(['Alice', 'Bob', 'Eve']);\npeople.attr(); // ['Alice', 'Bob', 'Eve', undefined, 'Charlie']\n```\n\n## Listening to changes\n\nAs with `Map`s, the real power of observable arrays comes from being able to\nreact to changes in the member elements of the array. Lists emit five types of events:\n\n- the _change_ event fires on every change to a List.\n- the _set_ event is fired when an element is set.\n- the _add_ event is fired when an element is added to the List.\n- the _remove_ event is fired when an element is removed from the List.\n- the _length_ event is fired when the length of the List changes.\n\nThis example presents a brief concrete survey of the times these events are fired:\n\n```\nvar list = new List(['Alice', 'Bob', 'Eve']);\n\nlist.bind('change', function() { console.log('An element changed.'); });\nlist.bind('set', function() { console.log('An element was set.'); });\nlist.bind('add', function() { console.log('An element was added.'); });\nlist.bind('remove', function() {\n console.log('An element was removed.');\n});\nlist.bind('length', function() {\n console.log('The length of the list changed.');\n});\n\nlist.attr(0, 'Alexis'); // 'An element changed.'\n // 'An element was set.'\n\nlist.attr(3, 'Xerxes'); // 'An element changed.'\n // 'An element was added.'\n // 'The length of the list was changed.'\n\nlist.attr(['Adam', 'Bill']); // 'An element changed.'\n // 'An element was set.'\n // 'An element was changed.'\n // 'An element was set.'\n\nlist.pop(); // 'An element changed.'\n // 'An element was removed.'\n // 'The length of the list was changed.'\n```\n\nMore information about binding to these events can be found under [can-list::attr attr].\n\n", - "description": "\n", - "name": "can-list", - "type": "module", - "types": [ + "body": "\n", + "description": "\nAdd an event listener for eventType to the target.\n", + "title": "addEventListener", + "signatures": [ { - "type": "constructor" + "code": "addEventListener( target, eventType, ...eventArgs )", + "description": "", + "params": [ + { + "types": [ + { + "type": "DomEventTarget" + } + ], + "name": "target", + "description": "The object to which to add the listener." + }, + { + "types": [ + { + "type": "String" + } + ], + "name": "eventType", + "description": "The event type with which to register." + }, + { + "types": [ + { + "type": "*" + } + ], + "name": "eventArgs", + "description": "The arguments which configure the associated event's behavior. This is usually a\nfunction event handler.\n" + } + ] } ], - "inherits": "can", - "download": "can/list", - "test": "can/list/test.html", - "parent": "can-observables", - "collection": "can-legacy", - "release": "2.0", - "package": { - "author": { - "name": "Bitovi", - "email": "contact@bitovi.com", - "url": "http://bitovi.com" - }, - "bugs": { - "url": "https://github.com/canjs/can-list/issues" - }, - "bundleDependencies": false, - "dependencies": { - "can-assign": "^1.1.1", - "can-cid": "^1.1.2", - "can-compute": "^4.0.0", - "can-construct": "^3.2.1", - "can-event-queue": "<2.0.0", - "can-map": "^4.0.0", - "can-namespace": "^1.0.0", - "can-observation": "^4.0.0", - "can-observation-recorder": "<2.0.0", - "can-queues": "<2.0.0", - "can-reflect": "^1.7.2", - "can-simple-observable": "^2.0.0", - "can-stache-key": "^1.0.0", - "can-symbol": "^1.4.1", - "can-types": "^1.1.0" - }, - "deprecated": false, - "description": "Observable lists", - "devDependencies": { - "detect-cyclic-packages": "^1.1.0", - "jshint": "^2.9.1", - "steal": "^1.2.9", - "steal-qunit": "^2.0.0", - "steal-tools": "^1.1.2", - "testee": "^0.9.0" - }, - "homepage": "http://canjs.com", - "keywords": [ - "canjs", - "canjs-plugin", - "donejs" + "_curParam": { + "types": [ + { + "type": "*" + } ], - "main": "can-list", - "name": "can-list", - "repository": { - "type": "git", - "url": "git://github.com/canjs/can-list.git" - }, - "scripts": { - "detect-cycle": "detect-cyclic-packages --ignore done-serve", - "jshint": "jshint ./*.js --config", - "postpublish": "git push --tags && git push", - "preversion": "npm test", - "release:major": "npm version major && npm publish", - "release:minor": "npm version minor && npm publish", - "release:patch": "npm version patch && npm publish", - "release:pre": "npm version prerelease && npm publish --tag pre", - "test": "npm run detect-cycle && npm run jshint && npm run testee", - "testee": "testee test/test.html --browsers firefox" - }, - "system": { - "configDependencies": [ - "live-reload" - ], - "npmAlgorithm": "flat" - }, - "version": "4.2.2" + "name": "eventArgs", + "description": "The arguments which configure the associated event's behavior. This is usually a\nfunction event handler.\n" + } + }, + "can-dom-events.removeEventListener": { + "type": "function", + "name": "can-dom-events.removeEventListener", + "parent": "can-dom-events.static", + "src": { + "line": 54, + "codeLine": 66, + "path": "node_modules/can-dom-events/can-dom-events.js" }, - "link": "../docco/list/list.html docco", + "body": "\n", + "description": "\nRemove an event listener for eventType from the target.\n", + "title": "removeEventListener", "signatures": [ { - "code": "new List([array])", - "description": "\n\nCreate an observable array-like object.\n", + "code": "removeEventListener( target, eventType, ...eventArgs )", + "description": "", "params": [ { "types": [ { - "type": "Array", - "options": [] + "type": "DomEventTarget" } ], - "optional": true, - "name": "array", - "description": "Items to seed the List with.\n" - } - ], - "returns": { - "types": [ - { - "type": "can-list" - } - ], - "description": "An instance of `List` with the elements from _array_.\n" - } - }, - { - "code": "new List(deferred)", - "description": "\n", - "params": [ + "name": "target", + "description": "The object from which to remove the listener." + }, { "types": [ { - "type": "can.Deferred" + "type": "String" } ], - "name": "deferred", - "description": "A deferred that resolves to an\narray. When the deferred resolves, its values will be added to the list.\n" + "name": "eventType", + "description": "The event type with which to unregister." + }, + { + "types": [ + { + "type": "*" + } + ], + "name": "eventArgs", + "description": "The arguments which configure the associated event's behavior. This is usually a\nfunction event handler.\n" } - ], - "returns": { - "types": [ - { - "type": "can-list" - } - ], - "description": "An initially empty `List`. \n\n" - } + ] } ], - "_curReturn": { - "types": [ - { - "type": "can-list" - } - ], - "description": "An initially empty `List`. \n\n" - }, "_curParam": { "types": [ { - "type": "can.Deferred" + "type": "*" } ], - "name": "deferred", - "description": "A deferred that resolves to an\narray. When the deferred resolves, its values will be added to the list.\n" - }, - "comment": " " + "name": "eventArgs", + "description": "The arguments which configure the associated event's behavior. This is usually a\nfunction event handler.\n" + } }, - "can-connect/data/localstorage-cache/localstorage-cache.name": { + "can-dom-events.addDelegateListener": { + "type": "function", + "name": "can-dom-events.addDelegateListener", + "parent": "can-dom-events.static", "src": { - "line": 66, - "codeLine": 88, - "path": "node_modules/can-local-store/can-local-store.js" + "line": 77, + "codeLine": 97, + "path": "node_modules/can-dom-events/can-dom-events.js" }, - "type": "property", - "body": "\n\n## Use\n\n```\nvar cacheConnection = connect([\"data-localstorage-cache\"],{\n name: \"todos\"\n});\n```\n\t \n", - "description": "\nSpecify a name to use when saving data in localstorage.\n", - "types": [ - { - "type": "String", - "description": "This name is used to find and save data in\nlocalstorage. Instances are saved in `{name}/instance/{id}`\nand sets are saved in `{name}/set/{set}`.\n" - } - ], - "title": "name", - "name": "can-connect/data/localstorage-cache/localstorage-cache.name", - "parent": "can-connect/data/localstorage-cache/localstorage-cache.identifiers", - "comment": " " - }, - "can-connect/data/localstorage-cache/localstorage-cache.clear": { "body": "\n", - "description": "\nResets the memory cache so it contains nothing.\n", - "title": "clear", - "name": "can-connect/data/localstorage-cache/localstorage-cache.clear", - "type": "function", - "parent": "can-connect/data/localstorage-cache/localstorage-cache.data-methods", - "signatures": [ - { - "code": "connection.clear()", - "description": "\n\n\t ", - "params": [] - } - ] - }, - "can-connect/data/localstorage-cache/localstorage-cache.getSets": { - "body": "\n\n## Use\n\n```\nconnection.getSets() //-> Promise( [{type: \"completed\"},{user: 5}] )\n```\n\n\t \n", - "description": "\nReturns the sets contained within the cache.\n", - "title": "getSets", - "name": "can-connect/data/localstorage-cache/localstorage-cache.getSets", - "type": "function", - "parent": "can-connect/data/localstorage-cache/localstorage-cache.data-methods", + "description": "\nAttach a handler for an event for all elements that match the selector,\nnow or in the future, based on a root element.\n", + "title": "addDelegateListener", "signatures": [ { - "code": "connection.getSets(set)", - "description": "\n\n Returns the sets added by [can-connect/data/localstorage-cache/localstorage-cache.updateListData].\n", - "params": [], - "returns": { - "types": [ - { - "type": "Promise", - "template": [ - { + "code": "addDelegateListener( target, eventType, selector, handler )", + "description": "\n\n```js\n// Prevents all anchor elements from changing the page\ndomEvents.addDelegateListener(document.body,\"click\", \"a\", function(event){\n event.preventDefault();\n})\n```", + "params": [ + { + "types": [ + { + "type": "DomEventTarget" + } + ], + "name": "root", + "description": "The html element to listen to events that match selector within." + }, + { + "types": [ + { + "type": "String" + } + ], + "name": "eventType", + "description": "The event name to listen to." + }, + { + "types": [ + { + "type": "String" + } + ], + "name": "selector", + "description": "A selector to filter the elements that trigger the event." + }, + { + "types": [ + { + "type": "function", + "returns": { "types": [ { - "type": "Array", - "template": [ - { - "types": [ - { - "type": "Set" - } - ] - } - ] + "type": "undefined" } ] - } - ] - } - ], - "description": "A promise that resolves to the list of sets.\n" - } + }, + "params": [] + } + ], + "name": "handler", + "description": "A function to execute at the time the event is triggered.\n" + } + ] } ], - "_curReturn": { + "_curParam": { "types": [ { - "type": "Promise", - "template": [ - { - "types": [ - { - "type": "Array", - "template": [ - { - "types": [ - { - "type": "Set" - } - ] - } - ] - } - ] - } - ] + "type": "function", + "returns": { + "types": [ + { + "type": "undefined" + } + ] + }, + "params": [] } ], - "description": "A promise that resolves to the list of sets.\n" - }, - "comment": " " + "name": "handler", + "description": "A function to execute at the time the event is triggered.\n" + } }, - "can-connect/data/localstorage-cache/localstorage-cache.getListData": { - "body": "\n", - "description": "\nGets a set of data from localstorage.\n", - "title": "getListData", - "name": "can-connect/data/localstorage-cache/localstorage-cache.getListData", + "can-dom-events.removeDelegateListener": { "type": "function", - "parent": "can-connect/data/localstorage-cache/localstorage-cache.data-methods", + "name": "can-dom-events.removeDelegateListener", + "parent": "can-dom-events.static", + "src": { + "line": 100, + "codeLine": 122, + "path": "node_modules/can-dom-events/can-dom-events.js" + }, + "body": "\n", + "description": "\nRemove a handler for an event for all elements that match the selector.\n", + "title": "removeDelegateListener", "signatures": [ { - "code": "connection.getListData(set)", - "description": "\n\n Goes through each set add by [can-connect/data/memory-cache.updateListData]. If\n `set` is a subset, uses [can-connect/base/base.queryLogic] to get the data for the requested `set`.\n", + "code": "removeDelegateListener( target, eventType, selector, handler )", + "description": "\n\n```js\n// Prevents all anchor elements from changing the page\nfunction handler(event) {\n event.preventDefault();\n}\ndomEvents.addDelegateListener(document.body,\"click\", \"a\", handler);\n\ndomEvents.removeDelegateListener(document.body,\"click\", \"a\", handler);\n```", "params": [ { "types": [ { - "type": "can-query-logic/query" + "type": "DomEventTarget" } ], - "name": "query", - "description": "An object that represents the data to load.\n" - } - ], - "returns": { - "types": [ - { - "type": "Promise", - "template": [ - { + "name": "root", + "description": "The html element to listen to events that match selector within." + }, + { + "types": [ + { + "type": "String" + } + ], + "name": "eventType", + "description": "The event name to listen to." + }, + { + "types": [ + { + "type": "String" + } + ], + "name": "selector", + "description": "A selector to filter the elements that trigger the event." + }, + { + "types": [ + { + "type": "function", + "returns": { "types": [ { - "type": "can-connect.listData" + "type": "undefined" } ] - } - ] - } - ], - "description": "A promise that resolves if `set` is a subset of\nsome data added by [can-connect/data/memory-cache.updateListData]. If it is not,\nthe promise is rejected.\n\t " - } + }, + "params": [] + } + ], + "name": "handler", + "description": "A function that was previously passed to `addDelegateListener`.\n" + } + ] } ], "_curParam": { "types": [ { - "type": "can-query-logic/query" - } - ], - "name": "query", - "description": "An object that represents the data to load.\n" - }, - "_curReturn": { - "types": [ - { - "type": "Promise", - "template": [ - { - "types": [ - { - "type": "can-connect.listData" - } - ] - } - ] + "type": "function", + "returns": { + "types": [ + { + "type": "undefined" + } + ] + }, + "params": [] } ], - "description": "A promise that resolves if `set` is a subset of\nsome data added by [can-connect/data/memory-cache.updateListData]. If it is not,\nthe promise is rejected.\n\t " + "name": "handler", + "description": "A function that was previously passed to `addDelegateListener`.\n" } }, - "can-connect/data/localstorage-cache.getListDataSync": { - "body": "\n\t \n", - "description": "\nSynchronously gets a set of data from localstorage.\n", - "title": "getListDataSync", - "name": "can-connect/data/localstorage-cache.getListDataSync", + "can-dom-events.dispatch": { "type": "function", - "parent": "can-connect/data/localstorage-cache.data-methods", - "signatures": [ - { - "code": "connection.getListDataSync(set)", - "description": "", - "params": [] - } - ], - "hide": true - }, - "can-connect/data/localstorage-cache/localstorage-cache.getData": { + "name": "can-dom-events.dispatch", + "parent": "can-dom-events.static", + "src": { + "line": 126, + "codeLine": 139, + "path": "node_modules/can-dom-events/can-dom-events.js" + }, "body": "\n", - "description": "\nGet an instance's data from localstorage.\n", - "title": "getData", - "name": "can-connect/data/localstorage-cache/localstorage-cache.getData", - "type": "function", - "parent": "can-connect/data/localstorage-cache/localstorage-cache.data-methods", + "description": "\nCreate and dispatch a configured event on the target.\n", + "title": "dispatch", "signatures": [ { - "code": "connection.getData(params)", - "description": "\n\n Looks in localstorage for the requested instance.\n", + "code": "dispatch( target, eventData [, bubbles ][, cancelable ] )", + "description": "", "params": [ { "types": [ { - "type": "Object", - "options": [] + "type": "DomEventTarget" } ], - "name": "params", - "description": "An object that should have the [conenction.id] of the element\nbeing retrieved.\n" + "name": "target", + "description": "The object on which to dispatch the event." + }, + { + "types": [ + { + "type": "Object" + }, + { + "type": "String" + } + ], + "name": "eventData", + "description": "The data to be assigned to the event. If it is a string, that will be the event type." + }, + { + "types": [ + { + "type": "Boolean" + } + ], + "name": "bubbles", + "description": "Whether the event should bubble; defaults to true." + }, + { + "types": [ + { + "type": "Boolean" + } + ], + "name": "cancelable", + "description": "Whether the event can be cancelled; defaults to false." } ], "returns": { "types": [ { - "type": "Promise" + "type": "Boolean" } ], - "description": "A promise that resolves to the item if the memory cache has this item.\nIf localstorage does not have this item, it rejects the promise.\n\t " + "description": "notCancelled Whether the event dispatched without being cancelled.\n" } } ], "_curParam": { "types": [ { - "type": "Object", - "options": [] + "type": "Boolean" } ], - "name": "params", - "description": "An object that should have the [conenction.id] of the element\nbeing retrieved.\n" + "name": "cancelable", + "description": "Whether the event can be cancelled; defaults to false." }, "_curReturn": { "types": [ { - "type": "Promise" + "type": "Boolean" } ], - "description": "A promise that resolves to the item if the memory cache has this item.\nIf localstorage does not have this item, it rejects the promise.\n\t " + "description": "notCancelled Whether the event dispatched without being cancelled.\n" } }, - "can-connect/data/localstorage-cache/localstorage-cache.updateListData": { - "body": "\n", - "description": "\nSaves a set of data in the cache.\n", - "title": "updateListData", - "name": "can-connect/data/localstorage-cache/localstorage-cache.updateListData", + "can-dom-mutate.dispatchNodeInsertion": { "type": "function", - "parent": "can-connect/data/localstorage-cache/localstorage-cache.data-methods", + "name": "can-dom-mutate.dispatchNodeInsertion", + "parent": "can-dom-mutate.static", + "src": { + "line": 436, + "codeLine": 446, + "path": "node_modules/can-dom-mutate/can-dom-mutate.js" + }, + "body": "\n", + "description": "\nDispatch an insertion mutation on the given node.\n", + "title": "dispatchNodeInsertion", + "hide": true, "signatures": [ { - "code": "connection.updateListData(listData, set)", - "description": "\n\n Tries to merge this set of data with any other saved sets of data. If\n unable to merge this data, saves the set by itself.\n", + "code": "dispatchNodeInsertion( node [, callback ] )", + "description": "", "params": [ { "types": [ { - "type": "can-connect.listData" + "type": "Node" } ], - "name": "listData", - "description": "" - }, - { - "types": [ - { - "type": "can-query-logic/query" - } - ], - "name": "query", - "description": "" + "name": "node", + "description": "The node on which to dispatch an insertion mutation.\n" } - ], - "returns": { - "types": [ - { - "type": "Promise" - } - ], - "description": "Promise resolves if and when the data has been successfully saved.\n\t " - } + ] } ], "_curParam": { "types": [ { - "type": "can-query-logic/query" - } - ], - "name": "query", - "description": "" - }, - "_curReturn": { - "types": [ - { - "type": "Promise" + "type": "Node" } ], - "description": "Promise resolves if and when the data has been successfully saved.\n\t " + "name": "node", + "description": "The node on which to dispatch an insertion mutation.\n" } }, - "can-connect/data/localstorage-cache/localstorage-cache.createData": { - "body": "\n", - "description": "\nCalled when an instance is created and should be added to cache.\n", - "title": "createData", - "name": "can-connect/data/localstorage-cache/localstorage-cache.createData", - "type": "function", - "parent": "can-connect/data/localstorage-cache/localstorage-cache.data-methods", - "signatures": [ - { - "code": "connection.createData(props)", - "description": "\n\n Adds `props` to the stored list of instances. Then, goes\n through every set and adds props the sets it belongs to.\n\t ", - "params": [] - } - ] - }, - "can-connect/data/localstorage-cache/localstorage-cache.updateData": { - "body": "\n", - "description": "\nCalled when an instance is updated.\n", - "title": "updateData", - "name": "can-connect/data/localstorage-cache/localstorage-cache.updateData", + "can-dom-mutate.dispatchNodeRemoval": { "type": "function", - "parent": "can-connect/data/localstorage-cache/localstorage-cache.data-methods", - "signatures": [ - { - "code": "connection.updateData(props)", - "description": "\n\n Overwrites the stored instance with the new props. Then, goes\n through every set and adds or removes the instance if it belongs or not.\n\t ", - "params": [] - } - ] - }, - "can-connect/data/localstorage-cache/localstorage-cache.destroyData": { + "name": "can-dom-mutate.dispatchNodeRemoval", + "parent": "can-dom-mutate.static", "src": { - "line": 213, - "codeLine": 227, - "path": "node_modules/can-local-store/can-local-store.js" + "line": 464, + "codeLine": 475, + "path": "node_modules/can-dom-mutate/can-dom-mutate.js" }, - "type": "function", "body": "\n", - "description": "\nCalled when an instance should be removed from the cache.\n", - "title": "destroyData", - "name": "can-connect/data/localstorage-cache/localstorage-cache.destroyData", - "parent": "can-connect/data/localstorage-cache/localstorage-cache.data-methods", - "signatures": [ - { - "code": "connection.destroyData(props)", - "description": "\n\n Goes through each set of data and removes any data that matches\n `props`'s [can-connect/base/base.id]. Finally removes this from the instance store.\n\t ", - "params": [] - } - ] - }, - "can-local-store.data-methods": { - "name": "can-local-store.data-methods", - "title": "data methods", - "type": "group", - "parent": "can-local-store", - "description": "", - "order": 0 - }, - "can-local-store": { - "src": { - "path": "node_modules/can-local-store/can-local-store.md" - }, - "body": "\n\n## Use\n\n`can-local-store` is used as a store of query-able data. It can either be used on its own or\nas part of a [can-connect] cache connection.\n\n### Standalone use\n\nTo use `localStore`, first create one with a `queryLogic` instance:\n\n```js\nimport localStore from \"can-local-store\";\nimport QueryLogic from \"can-query-logic\";\n\n// Create a store\nvar todosStore = localStore({\n queryLogic: new QueryLogic({\n identity: [\"id\"]\n })\n});\n```\n\nThen populate the store with data:\n\n```js\ntodosStore.updateListData([\n {id: 1, name: \"dishes\", points: 2},\n {id: 2, name: \"lawn\", points: 8},\n {id: 3, name: \"trash\", points: 1},\n {id: 4, name: \"car wash\", points: 5},\n]);\n```\n\nThen you can query the store for data:\n\n```js\ntodosStore.getListData({\n filter: {points: {$gt: 1}},\n sort: \"name\",\n page: {start: 0, end: 1}\n})\n//-> {\n// data: [\n// {id: 4, name: \"car wash\", points: 5},\n// {id: 1, name: \"dishes\", points: 2}],\n// count: 3\n// }\n```\n\n### Use with connection\n\n\n`can-local-store` is often used with a caching strategy like [can-connect/fall-through-cache/fall-through-cache] or\n[can-connect/cache-requests/cache-requests] as their\n`cacheConnection`. The following gives an example of using it with the\n`connectFallThroughCache`:\n\n```js\nimport {\n DefineMap,\n QueryLogic,\n localStore,\n connectFallThroughCache,\n connectCanMap,\n connectRest,\n connectConstructor,\n connect\n} from \"can\";\n\n// Define a type\nconst Todo = DefineMap.extend(\"Todo\",{\n id: {identity: true, type:\"number\"},\n name: \"string\",\n complete: \"boolean\"\n});\n\n// Create a store\nvar todosStore = localStore({\n queryLogic: new QueryLogic(Todo),\n name: \"todos\"\n});\n\nvar todoConnection = connect([\n connectRest,\n connectMap,\n connectFallThroughCache,\n connectConstructor\n],\n{\n url: \"/services/todos\",\n cacheConnection: todosStore\n});\n```\n\n\n## Caching localStorage reads\n\nIf your data set is large, you might want to avoid reading and parsing localStorage on every\naccess to the local store. To avoid this, you can turn on `cacheLocalStorageReads` like:\n\n\n```js\nvar todosStore = localStore({\n queryLogic: new QueryLogic({\n identity: [\"id\"]\n }),\n name: \"todos\",\n cacheLocalStorageReads: true\n});\n```\n\n", - "description": "\nCreate, update, delete and query data saved in localStorage.\n", - "type": "module", - "title": "can-local-store", - "name": "can-local-store", - "parent": "can-data-modeling", - "collection": "can-infrastructure", - "package": { - "author": { - "name": "Core DoneJS Team", - "email": "core@donejs.com", - "url": "http://donejs.com" - }, - "bugs": { - "url": "https://github.com/canjs/can-local-store/issues" - }, - "bundleDependencies": false, - "dependencies": { - "can-diff": "<2.0.0", - "can-memory-store": "<2.0.0", - "can-namespace": "^1.0.0", - "can-query-logic": "<2.0.0", - "can-reflect": "^1.13.4", - "can-sort-object": "^1.0.1" - }, - "deprecated": false, - "description": "A localStorage database for the client", - "devDependencies": { - "can-set-legacy": "<2.0.0", - "jshint": "^2.9.1", - "steal": "^2.2.1", - "steal-qunit": "^2.0.0", - "steal-tools": "^2.2.1", - "testee": "^0.9.0" - }, - "homepage": "http://canjs.com", - "keywords": [ - "canjs", - "donejs", - "donejs-plugin" - ], - "license": "MIT", - "main": "can-local-store", - "name": "can-local-store", - "repository": { - "type": "git", - "url": "git://github.com/canjs/can-local-store.git" - }, - "scripts": { - "build": "node build.js", - "develop": "done-serve --static --develop --port 8080", - "jshint": "jshint ./*.js --config", - "postpublish": "git push --tags && git checkout master && git branch -D release && git push", - "preversion": "npm test && npm run build", - "release:major": "npm version major && npm publish", - "release:minor": "npm version minor && npm publish", - "release:patch": "npm version patch && npm publish", - "test": "npm run jshint && npm run testee", - "testee": "testee test.html --browsers firefox", - "version": "git commit -am \"Update version number\" && git checkout -b release && git add -f dist/" - }, - "steal": { - "main": "can-local-store", - "configDependencies": [ - "live-reload" - ], - "npmIgnore": [ - "testee", - "generator-donejs", - "donejs-cli", - "steal-tools" - ] - }, - "version": "1.0.1" - }, + "description": "\nDispatch a removal mutation on the given node.\n", + "title": "dispatchNodeRemoval", + "hide": true, "signatures": [ { - "code": "localStore( baseConnection )", - "description": "\n\nCreate a database-like store of a single data type. For example:\n\n```js\nimport localStore from \"can-local-store\";\nimport QueryLogic from \"can-query-logic\";\n\n// Create a store\nvar todosStore = localStore({\n queryLogic: new QueryLogic({\n identity: [\"id\"]\n }),\n name: \"todos\"\n});\n\n// Add a list of data to the store\ntodosStore.updateListData(...);\n// Get a list of data from the store\ntodosStore.getListData(...)\n// Create a record in the store\ntodosStore.createData(...)\n// Get a record in the store\ntodosStore.getData(...)\n// Update a record in the store\ntodosStore.updateData(...)\n// Remove a record from the store\ntodosStore.destroyData(...)\n// Clear all records from the store\ntodosStore.clear()\n// Get the queries that are currently stored\ntodosStore.getQueries()\n```\n", + "code": "dispatchNodeRemoval( node [, callback ] )", + "description": "", "params": [ { "types": [ { - "type": "Object", - "options": [] + "type": "Node" } ], - "optional": true, - "name": "baseConnection", - "description": "A base [can-connect] connection or a settings object. `baseConnection`\n must have:\n - a `queryLogic` property that references a [can-query-logic] instance. The `can-query-logic`\n instance is used to determine the behavior of [can-local-store.getListData].\n - a unique `name` property used as a key to store data in localStorage.\n\n It can optionally have:\n - a `cacheLocalStorageReads` property. When set to `true`, prevents reading from localStorage and parsing the result on\n every read.\n" + "name": "node", + "description": "The node on which to dispatch a removal mutation." + }, + { + "types": [ + { + "type": "function", + "returns": { + "types": [ + { + "type": "undefined" + } + ] + }, + "params": [] + } + ], + "name": "callback", + "description": "The optional callback called after the mutation is dispatched.\n" } ] } @@ -4407,57 +5281,65 @@ "_curParam": { "types": [ { - "type": "Object", - "options": [] + "type": "function", + "returns": { + "types": [ + { + "type": "undefined" + } + ] + }, + "params": [] } ], - "optional": true, - "name": "baseConnection", - "description": "A base [can-connect] connection or a settings object. `baseConnection`\n must have:\n - a `queryLogic` property that references a [can-query-logic] instance. The `can-query-logic`\n instance is used to determine the behavior of [can-local-store.getListData].\n - a unique `name` property used as a key to store data in localStorage.\n\n It can optionally have:\n - a `cacheLocalStorageReads` property. When set to `true`, prevents reading from localStorage and parsing the result on\n every read.\n" - }, - "comment": " " - }, - "can-log": { - "body": "\n", - "description": "\nUtilities for logging to the console.\n", - "type": "module", - "title": "log", - "types": [ - { - "type": "Object", - "options": [] - } - ], - "name": "can-log", - "parent": "can-js-utilities", - "collection": "can-infrastructure", - "hide": true + "name": "callback", + "description": "The optional callback called after the mutation is dispatched.\n" + } }, - "can-log.warn": { + "can-dom-mutate.dispatchNodeAttributeChange": { "type": "function", - "name": "can-log.warn", - "parent": "can-log", + "name": "can-dom-mutate.dispatchNodeAttributeChange", + "parent": "can-dom-mutate.static", "src": { - "line": 14, - "codeLine": 30, - "path": "node_modules/can-log/can-log.js" + "line": 492, + "codeLine": 511, + "path": "node_modules/can-dom-mutate/can-dom-mutate.js" }, - "body": "", - "description": " \nAdds a warning message to the console.\n\n```\nvar canLog = require(\"can-log\");\n\ncanLog.warn(\"something evil\");\n```\n\n", - "title": "warn", + "body": "\n", + "description": "\nDispatch an attribute change mutation on the given node.\n", + "title": "dispatchNodeAttributeChange", + "hide": true, "signatures": [ { - "code": "canLog.warn(msg)", - "description": "", + "code": "dispatchNodeAttributeChange( node, attributeName, oldValue [, callback ] )", + "description": "\n\n```\ninput.setAttribute(\"value\", \"newValue\")\ndomMutate.dispatchNodeAttributeChange(input, \"value\",\"oldValue\")\n```\n\n", "params": [ + { + "types": [ + { + "type": "Node" + } + ], + "name": "target", + "description": "The node on which to dispatch an attribute change mutation." + }, { "types": [ { "type": "String" } ], - "name": "msg", - "description": "the message to be logged.\n" + "name": "attributeName", + "description": "The attribute name whose value has changed." + }, + { + "types": [ + { + "type": "String" + } + ], + "name": "oldValue", + "description": "The attribute value before the change.\n" } ] } @@ -4468,943 +5350,817 @@ "type": "String" } ], - "name": "msg", - "description": "the message to be logged.\n" + "name": "oldValue", + "description": "The attribute value before the change.\n" } }, - "can-log.log": { + "can-dom-mutate.onNodeConnected": { + "name": "can-dom-mutate.onNodeConnected", "type": "function", - "name": "can-log.log", - "parent": "can-log", + "parent": "can-dom-mutate.static", "src": { - "line": 41, - "codeLine": 57, - "path": "node_modules/can-log/can-log.js" + "line": 522, + "codeLine": 533, + "path": "node_modules/can-dom-mutate/can-dom-mutate.js" }, - "body": "", - "description": " Adds a message to the console.\n\n```\nvar canLog = require(\"can-log\");\n\ncanLog.log(\"hi\");\n```\n\n", - "title": "log", - "hide": true, + "body": "\n", + "description": "\nListen for insertion mutations on the given node.\n", + "title": "onNodeConnected", "signatures": [ { - "code": "canLog.log(msg)", + "code": "onNodeConnected( node, callback )", "description": "", "params": [ { "types": [ { - "type": "String" + "type": "Node" } ], - "name": "msg", - "description": "the message\n" + "name": "node", + "description": "The node on which to listen for insertion mutations." + }, + { + "types": [ + { + "type": "function", + "returns": { + "types": [ + { + "type": "undefined" + } + ] + }, + "params": [] + } + ], + "name": "callback", + "description": "The callback called when an insertion mutation is dispatched." } - ] + ], + "returns": { + "types": [ + { + "type": "function", + "returns": { + "types": [ + { + "type": "undefined" + } + ] + }, + "params": [] + } + ], + "description": "The callback to remove the mutation listener.\n" + } } ], "_curParam": { "types": [ { - "type": "String" + "type": "function", + "returns": { + "types": [ + { + "type": "undefined" + } + ] + }, + "params": [] } ], - "name": "msg", - "description": "the message\n" + "name": "callback", + "description": "The callback called when an insertion mutation is dispatched." + }, + "_curReturn": { + "types": [ + { + "type": "function", + "returns": { + "types": [ + { + "type": "undefined" + } + ] + }, + "params": [] + } + ], + "description": "The callback to remove the mutation listener.\n" } }, - "can-log.error": { + "can-dom-mutate.onNodeDisconnected": { + "name": "can-dom-mutate.onNodeDisconnected", "type": "function", - "name": "can-log.error", - "parent": "can-log", + "parent": "can-dom-mutate.static", "src": { - "line": 66, - "codeLine": 82, - "path": "node_modules/can-log/can-log.js" + "line": 539, + "codeLine": 550, + "path": "node_modules/can-dom-mutate/can-dom-mutate.js" }, - "body": "", - "description": " Adds an error message to the console.\n\n```\nvar canLog = require(\"can-log\");\n\ncanLog.error(new Error(\"Oh no!\"));\n```\n\n", - "title": "error", - "hide": true, + "body": "\n", + "description": "\nListen for removal mutations on the given node.\n", + "title": "onNodeDisconnected", "signatures": [ { - "code": "canLog.error(err)", + "code": "onNodeDisconnected( node, callback )", "description": "", "params": [ { "types": [ { - "type": "String" - }, + "type": "Node" + } + ], + "name": "node", + "description": "The node on which to listen for removal mutations." + }, + { + "types": [ { - "type": "Error" + "type": "function", + "returns": { + "types": [ + { + "type": "undefined" + } + ] + }, + "params": [] } ], - "name": "err", - "description": "The error to be logged.\n" + "name": "callback", + "description": "The callback called when a removal mutation is dispatched." } - ] + ], + "returns": { + "types": [ + { + "type": "function", + "returns": { + "types": [ + { + "type": "undefined" + } + ] + }, + "params": [] + } + ], + "description": "The callback to remove the mutation listener.\n" + } } ], "_curParam": { "types": [ { - "type": "String" - }, + "type": "function", + "returns": { + "types": [ + { + "type": "undefined" + } + ] + }, + "params": [] + } + ], + "name": "callback", + "description": "The callback called when a removal mutation is dispatched." + }, + "_curReturn": { + "types": [ { - "type": "Error" + "type": "function", + "returns": { + "types": [ + { + "type": "undefined" + } + ] + }, + "params": [] } ], - "name": "err", - "description": "The error to be logged.\n" + "description": "The callback to remove the mutation listener.\n" } }, - "can-make-map": { - "type": "module", - "name": "can-make-map", - "parent": "can-js-utilities", + "can-dom-mutate.onNodeAttributeChange": { + "name": "can-dom-mutate.onNodeAttributeChange", + "type": "function", + "parent": "can-dom-mutate.static", "src": { - "line": 1, - "codeLine": 13, - "path": "node_modules/can-make-map/can-make-map.js" + "line": 556, + "codeLine": 567, + "path": "node_modules/can-dom-mutate/can-dom-mutate.js" }, - "body": "", - "description": "Convert a comma-separated string into a plain JavaScript object. ", - "title": "can-make-map", - "types": [ + "body": "\n", + "description": "\nListen for attribute change mutations on the given node.\n", + "title": "onNodeAttributeChange", + "signatures": [ { - "type": "function", + "code": "onNodeAttributeChange( node, callback )", + "description": "", + "params": [ + { + "types": [ + { + "type": "Node" + } + ], + "name": "node", + "description": "The node on which to listen for attribute change mutations." + }, + { + "types": [ + { + "type": "function", + "returns": { + "types": [ + { + "type": "undefined" + } + ] + }, + "params": [] + } + ], + "name": "callback", + "description": "The callback called when an attribute change mutation is dispatched." + } + ], "returns": { "types": [ { - "type": "undefined" - } - ] - }, - "params": [] - } - ], - "collection": "can-infrastructure", - "package": { - "author": { - "name": "Bitovi", - "email": "contact@bitovi.com", - "url": "https://www.bitovi.com/" - }, - "bugs": { - "url": "https://github.com/canjs/can-make-map/issues" - }, - "bundleDependencies": false, - "dependencies": {}, - "deprecated": false, - "description": "Convert a comma-separated string into a plain JavaScript object.", - "devDependencies": { - "detect-cyclic-packages": "^1.1.0", - "done-serve": "^3.3.1", - "donejs-cli": "^3.1.1", - "generator-donejs": "^3.3.0", - "jshint": "^2.9.1", - "steal": "^2.2.1", - "steal-qunit": "^2.0.0", - "steal-tools": "^2.2.1", - "testee": "^0.9.0" - }, - "homepage": "https://canjs.com/", - "keywords": [ - "canjs", - "make", - "map", - "convert", - "string" + "type": "function", + "returns": { + "types": [ + { + "type": "undefined" + } + ] + }, + "params": [] + } + ], + "description": "The callback to remove the mutation listener.\n" + } + } + ], + "_curParam": { + "types": [ + { + "type": "function", + "returns": { + "types": [ + { + "type": "undefined" + } + ] + }, + "params": [] + } ], - "main": "dist/cjs/can-make-map", - "name": "can-make-map", - "repository": { - "type": "git", - "url": "git://github.com/canjs/can-make-map.git" - }, - "scripts": { - "build": "node build.js", - "detect-cycle": "detect-cyclic-packages --ignore done-serve", - "develop": "done-serve --static --develop --port 8080", - "jshint": "jshint ./*.js --config", - "postpublish": "git push --tags && git checkout master && git branch -D release && git push", - "preversion": "npm test && npm run build", - "release:major": "npm version major && npm publish", - "release:minor": "npm version minor && npm publish", - "release:patch": "npm version patch && npm publish", - "test": "npm run detect-cycle && npm run jshint && npm run testee", - "testee": "testee test.html --browsers firefox", - "version": "git commit -am \"Update version number\" && git checkout -b release && git add -f dist/" - }, - "steal": { - "main": "can-make-map", - "configDependencies": [ - "live-reload" - ], - "npmIgnore": [ - "testee", - "generator-donejs", - "donejs-cli", - "steal-tools" - ] - }, - "version": "1.2.1" + "name": "callback", + "description": "The callback called when an attribute change mutation is dispatched." + }, + "_curReturn": { + "types": [ + { + "type": "function", + "returns": { + "types": [ + { + "type": "undefined" + } + ] + }, + "params": [] + } + ], + "description": "The callback to remove the mutation listener.\n" + } + }, + "can-dom-mutate.onDisconnected": { + "name": "can-dom-mutate.onDisconnected", + "type": "function", + "parent": "can-dom-mutate.static", + "src": { + "line": 569, + "codeLine": 580, + "path": "node_modules/can-dom-mutate/can-dom-mutate.js" }, + "body": "\n", + "description": "\nListen for removal mutations on any node within the documentElement.\n", + "title": "onDisconnected", "signatures": [ { - "code": "makeMap( string )", + "code": "onDisconnected( documentElement, callback )", "description": "", "params": [ { "types": [ { - "type": "String" + "type": "Node" } ], - "name": "string", - "description": "A comma separated list of values" + "name": "documentElement", + "description": "The documentElement on which to listen for removal mutations." + }, + { + "types": [ + { + "type": "function", + "returns": { + "types": [ + { + "type": "undefined" + } + ] + }, + "params": [] + } + ], + "name": "callback", + "description": "The callback called when a removal mutation is dispatched." } ], "returns": { "types": [ { - "type": "Object", - "options": [] + "type": "function", + "returns": { + "types": [ + { + "type": "undefined" + } + ] + }, + "params": [] } ], - "description": "A JavaScript object with the same keys as the passed-in comma-separated values\n\nmakeMap takes a comma-separated string (can-list, NodeList, etc.) and converts it to a JavaScript object\n" + "description": "The callback to remove the mutation listener.\n" } } ], "_curParam": { "types": [ { - "type": "String" + "type": "function", + "returns": { + "types": [ + { + "type": "undefined" + } + ] + }, + "params": [] } ], - "name": "string", - "description": "A comma separated list of values" + "name": "callback", + "description": "The callback called when a removal mutation is dispatched." }, "_curReturn": { "types": [ { - "type": "Object", - "options": [] + "type": "function", + "returns": { + "types": [ + { + "type": "undefined" + } + ] + }, + "params": [] } ], - "description": "A JavaScript object with the same keys as the passed-in comma-separated values\n\nmakeMap takes a comma-separated string (can-list, NodeList, etc.) and converts it to a JavaScript object\n" + "description": "The callback to remove the mutation listener.\n" } }, - "can-map-compat": { + "can-dom-mutate.onConnected": { + "name": "can-dom-mutate.onConnected", + "type": "function", + "parent": "can-dom-mutate.static", "src": { - "path": "node_modules/can-map-compat/can-map-compat.md" + "line": 586, + "codeLine": 597, + "path": "node_modules/can-dom-mutate/can-dom-mutate.js" }, - "body": "", - "description": "", - "type": "module", - "title": "", - "types": [ + "body": "\n", + "description": "\nListen for insertion mutations on any node within the documentElement.\n", + "title": "onConnected", + "signatures": [ { - "type": "function", + "code": "onConnected( documentElement, callback )", + "description": "", + "params": [ + { + "types": [ + { + "type": "Node" + } + ], + "name": "documentElement", + "description": "The documentElement on which to listen for removal mutations." + }, + { + "types": [ + { + "type": "function", + "returns": { + "types": [ + { + "type": "undefined" + } + ] + }, + "params": [] + } + ], + "name": "callback", + "description": "The callback called when a insertion mutation is dispatched." + } + ], "returns": { "types": [ { - "type": "undefined" + "type": "function", + "returns": { + "types": [ + { + "type": "undefined" + } + ] + }, + "params": [] } - ] - }, - "params": [] + ], + "description": "The callback to remove the mutation listener.\n" + } } ], - "name": "can-map-compat", - "parent": "can-observables", - "collection": "can-ecosystem", - "package": { - "author": { - "name": "DoneJS Contributors", - "email": "team@donejs.com", - "url": "https://donejs.com/" - }, - "bugs": { - "url": "https://github.com/canjs/can-map-compat/issues" - }, - "bundleDependencies": false, - "dependencies": { - "can-key": "^1.2.0", - "can-log": "^1.0.0", - "can-reflect": "^1.17.4" - }, - "deprecated": false, - "description": "Makes observables compatible with can-map", - "devDependencies": { - "can-define": "^1.5.6", - "can-observe": "^2.2.0", - "jshint": "^2.9.1", - "steal": "^2.0.0", - "steal-qunit": "^2.0.0", - "testee": "^0.9.1" - }, - "homepage": "https://canjs.com/", - "keywords": [ - "canjs", - "donejs-plugin", - "can-map", - "can-define" + "_curParam": { + "types": [ + { + "type": "function", + "returns": { + "types": [ + { + "type": "undefined" + } + ] + }, + "params": [] + } ], - "license": "MIT", - "main": "can-map-compat.js", - "name": "can-map-compat", - "repository": { - "type": "git", - "url": "git://github.com/canjs/can-map-compat.git" - }, - "scripts": { - "jshint": "jshint ./*.js --config", - "postpublish": "git push --tags && git push", - "preversion": "npm test", - "release:major": "npm version major && npm publish", - "release:minor": "npm version minor && npm publish", - "release:patch": "npm version patch && npm publish", - "test": "npm run jshint && npm run testee", - "testee": "testee test.html --browsers firefox", - "version": "git commit -am \"Update version number\"" - }, - "version": "1.1.1" + "name": "callback", + "description": "The callback called when a insertion mutation is dispatched." + }, + "_curReturn": { + "types": [ + { + "type": "function", + "returns": { + "types": [ + { + "type": "undefined" + } + ] + }, + "params": [] + } + ], + "description": "The callback to remove the mutation listener.\n" + } + }, + "can-dom-mutate.onAttributeChange": { + "name": "can-dom-mutate.onAttributeChange", + "type": "function", + "parent": "can-dom-mutate.static", + "src": { + "line": 603, + "codeLine": 614, + "path": "node_modules/can-dom-mutate/can-dom-mutate.js" }, + "body": "\n", + "description": "\nListen for attribute change mutations on any node within the documentElement.\n", + "title": "onAttributeChange", "signatures": [ { - "code": "makeMapCompat(Type)", - "description": "\n\nMakes an observable type, such as [can-define/map/map] or an [can-observe.Object ObserveObject] compatible with the [can-map] APIs such as [can-map.prototype.attr] and [can-map.prototype.removeAttr].\n\n```js\nimport makeMapCompat from \"can-map-compat\";\nimport DefineMap from \"can-define/map/map\";\n\nvar MyMap = makeMapCompat(DefineMap.extend({\n count: {\n type: \"number\",\n default: 0\n }\n}));\n\nvar map = new MyMap({ count: 0 });\n\nmap.attr(\"count\", 1);\nconsole.log(map.attr(\"count\")); // -> 1\n\n\nmap.removeAttr(\"count\");\nconsole.log(map.attr(\"count\")); // -> undefined\n```\n", + "code": "onAttributeChange( documentElement, callback )", + "description": "", "params": [ { "types": [ { - "type": "Object", - "options": [] + "type": "Node" } ], - "name": "Type", - "description": "The __Type__ to make compatible with [can-map]." + "name": "documentElement", + "description": "The documentElement on which to listen for removal mutations." + }, + { + "types": [ + { + "type": "function", + "returns": { + "types": [ + { + "type": "undefined" + } + ] + }, + "params": [] + } + ], + "name": "callback", + "description": "The callback called when an attribute change mutation is dispatched." } ], "returns": { "types": [ { - "type": "Object", - "options": [] + "type": "function", + "returns": { + "types": [ + { + "type": "undefined" + } + ] + }, + "params": [] } ], - "description": "The Type, with the can-map methods added.\n" + "description": "The callback to remove the mutation listener.\n" } } ], "_curParam": { "types": [ { - "type": "Object", - "options": [] + "type": "function", + "returns": { + "types": [ + { + "type": "undefined" + } + ] + }, + "params": [] } ], - "name": "Type", - "description": "The __Type__ to make compatible with [can-map]." + "name": "callback", + "description": "The callback called when an attribute change mutation is dispatched." }, "_curReturn": { "types": [ { - "type": "Object", - "options": [] + "type": "function", + "returns": { + "types": [ + { + "type": "undefined" + } + ] + }, + "params": [] } ], - "description": "The Type, with the can-map methods added.\n" + "description": "The callback to remove the mutation listener.\n" } }, - "can-map": { + "can-dom-mutate.static": { + "name": "can-dom-mutate.static", + "title": "methods", + "type": "group", + "parent": "can-dom-mutate", + "description": "", + "order": 0 + }, + "can-dom-mutate/modules": { + "name": "can-dom-mutate/modules", + "title": "modules", + "type": "group", + "parent": "can-dom-mutate", + "description": "", + "order": 1 + }, + "can-dom-mutate": { "src": { - "path": "node_modules/can-map/docs/map.md" + "path": "node_modules/can-dom-mutate/can-dom-mutate.md" }, - "body": "\n## Use\n\nWatch this video to see an example of creating an ATM machine using can.Map:\n\n\n\n\n`Map` provides a way for you to listen for and keep track of changes\nto objects. When you use the getters and setters provided by `Map`,\nevents are fired that you can react to. `Map` also has support for\nworking with deep properties. Observable arrays are also available with\n`[can-list]`, which is based on `Map`.\n\n## Working with Observes\n\nTo create an Observe, use `new Map([props])`. This will return a\ncopy of `props` that emits events when its properties are changed with\n`[can-map.prototype.attr attr]`.\n\nYou can read the values of properties on Observes directly, but you should\nnever set them directly. You can also read property values using `attr`.\n\n\n var aName = {a: 'Alexis'},\n map = new can.Map(aName);\n\n // Observes are copies of data:\n aName === map; // false\n\n // reading from an Observe:\n map.attr(); // {a: 'Alexis'}\n map.a; // 'Alexis'\n map.attr('a'); // 'Alexis'\n\n // setting an Observe's property:\n map.attr('a', 'Alice');\n map.a; // Alice\n\n // removing an Observe's property;\n map.removeAttr('a');\n map.attr(); // {}\n\n // Don't do this!\n map.a = 'Adam'; // wrong!\n\n\nFind out more about manipulating properties of a map under\n[can.Map.prototype.attr attr] and [can.Map.prototype.removeAttr removeAttr].\n\n## Listening to changes\n\nThe real power of maps comes from being able to react to\nproperties being added, set, and removed. Maps emit events when\nproperties are changed that you can bind to.\n\n`Map` has two types of events that fire due to changes on a map:\n- the _change_ event fires on every change to a map.\n- an event named after the property name fires on every change to that property.\n\n\n var o = new Map({});\n o.bind('change', function(ev, attr, how, newVal, oldVal) {\n console.log('Something on o changed.');\n });\n o.bind('a', function(ev, newVal, oldVal) {\n console.log('a was changed.');\n });\n\n o.attr('a', 'Alexis'); // 'Something on o changed.'\n // 'a was changed.'\n o.attr({\n 'a': 'Alice', // 'Something on o changed.' (for a's change)\n 'b': 'Bob' // 'Something on o changed.' (for b's change)\n }); // 'a was changed.'\n\n o.removeAttr('a'); // 'Something on o changed.'\n // 'a was changed.'\n\n\nFor more detail on how to use these events, see [can.Map.prototype.bind bind] and\n[can.Map.prototype.unbind unbind]. There is also a plugin called [can.Map.delegate]\nthat makes binding to specific types of events easier:\n\n\n var o = new Map({});\n o.delegate('a', 'add', function(ev, newVal, oldVal) {\n console.log('a was added.');\n });\n o.delegate('a', 'set', function(ev, newVal, oldVal) {\n console.log('a was set.');\n });\n o.delegate('a', 'remove', function(ev, newVal, oldVal) {\n console.log('a was removed.');\n });\n o.delegate('a', 'change', function(ev, newVal, oldVal) {\n console.log('a was changed.');\n });\n\n o.attr('a', 'Alexis'); // 'a was added.'\n // 'a was changed.'\n\n o.attr('a', 'Alice'); // 'a was set.'\n // 'a was changed.'\n\n o.removeAttr('a'); // 'a was removed.'\n // 'a was changed.'\n\n## Object.prototype.watch\n\nDue to a method available on the base Object prototype called \"watch\", refrain from\nusing properties with the same name on Gecko based browsers as there will be a\ncollision. [Source](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/watch)\n\n", - "description": "Create observable objects. \n", - "name": "can-map", + "body": "\n## Use\n\n\n```js\nimport {domMutate, domMutateNode} from \"can\";\n\nvar element = document.createElement(\"div\");\n\nvar teardown = domMutate.onNodeConnected(element, ()=>{\n\tconsole.log(\"element inserted!\");\n});\n\nsetTimeout(function(){\n\tdomMutateNode.appendChild.call(document.body, element);\n},1000);\n```\n
    \n\n", + "description": "Dispatch and listen for DOM mutations. ", "type": "module", + "title": "", "types": [ { - "type": "constructor" + "type": "Object", + "options": [] } ], - "inherits": "can", - "parent": "can-observables", - "collection": "can-legacy", - "test": "can/map/test.html", - "plugin": "can/map", - "release": "2.0", - "link": "../docco/map/map.html docco", + "name": "can-dom-mutate", + "parent": "can-dom-utilities", + "collection": "can-infrastructure", "package": { "author": { - "name": "Bitovi", - "email": "contact@bitovi.com", - "url": "http://bitovi.com" + "name": "DoneJS Team", + "email": "core@donejs.com", + "url": "https://bitovi.com" }, "bugs": { - "url": "https://github.com/canjs/can-map/issues" + "url": "https://github.com/canjs/can-dom-mutate/issues" }, "bundleDependencies": false, "dependencies": { - "can-assign": "^1.0.0", - "can-cid": "^1.1.2", - "can-compute": "^4.0.0", - "can-construct": "^3.5.4", - "can-event-queue": "^1.0.0", - "can-log": "^1.0.0", - "can-namespace": "^1.0.0", - "can-observation-recorder": "^1.0.2", - "can-queues": "^1.0.0", - "can-reflect": "^1.7.2", - "can-simple-observable": "^2.0.0", - "can-single-reference": "^1.0.0", - "can-stache-key": "^1.0.0", - "can-symbol": "^1.4.1", - "can-types": "^1.1.0" + "can-globals": "^1.0.0", + "can-namespace": "1.0.0", + "can-reflect": "^1.17.6", + "can-symbol": "^1.6.4" }, "deprecated": false, - "description": "Observable Objects", + "description": "Dispatch and listen for DOM mutations", "devDependencies": { - "can-observation": "^4.0.0", - "can-reflect-tests": "^0.3.1", - "can-simple-observable": "^2.0.0", - "can-test-helpers": "^1.1.4", - "detect-cyclic-packages": "^1.1.0", + "can-dom-events": "^1.3.0", + "can-simple-dom": "^1.6.2", + "can-vdom": "^4.4.1", + "fixpack": "^2.3.1", "jshint": "^2.9.1", - "steal": "^2.1.3", + "steal": "^2.0.0", "steal-qunit": "^2.0.0", - "steal-tools": "^2.0.4", + "steal-tools": "^1.2.0", "testee": "^0.9.0" }, - "homepage": "http://canjs.com", + "homepage": "https://github.com/canjs/can-dom-mutate", "keywords": [ "canjs", - "canjs-plugin", - "donejs" + "mutation", + "mutationobserver", + "observer" ], - "main": "can-map", - "name": "can-map", + "license": "MIT", + "main": "can-dom-mutate", + "name": "can-dom-mutate", "repository": { "type": "git", - "url": "git://github.com/canjs/can-map.git" + "url": "git://github.com/canjs/can-dom-mutate.git" }, "scripts": { - "detect-cycle": "detect-cyclic-packages --ignore done-serve", - "develop": "done-serve --static --develop --port 8080", - "jshint": "jshint ./*.js --config", + "jshint": "jshint ./*.js ./test/*.js --config", + "lint": "fixpack && npm run jshint", "postpublish": "git push --tags && git push", "preversion": "npm test", "release:major": "npm version major && npm publish", "release:minor": "npm version minor && npm publish", "release:patch": "npm version patch && npm publish", "release:pre": "npm version prerelease && npm publish --tag pre", - "test": "npm run detect-cycle && npm run jshint && npm run testee", - "testee": "testee test/test.html --browsers firefox" + "test": "npm run lint && npm run testee", + "testee": "testee test.html --browsers firefox" }, "steal": { - "configDependencies": [ - "live-reload" - ] + "main": "can-dom-mutate" }, - "version": "4.3.8" + "version": "2.0.8" }, "signatures": [ { - "code": "new Map([props])", - "description": "\n\nCreates a new instance of can.Map.\n", - "params": [ - { - "types": [ - { - "type": "Object", - "options": [] - } - ], - "optional": true, - "name": "props", - "description": "Properties and values to seed the Observe with." - } - ], - "returns": { - "types": [ - { - "type": "can.Map" - } - ], - "description": "An instance of `can.Map` with the properties from _props_.\n" - } - }, - { - "code": "Map.extend([name,] [staticProperties,] instanceProperties)", - "description": "\n\nCreates a new extended constructor function.\n\n", + "code": "domMutate", + "description": "\n\n`can-dom-mutate` exports an object that lets you listen to changes\nin the DOM using the [MutationObserver](https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver)\nAPI.\n\n```js\nimport {domMutate} from \"can\";\n\ndomMutate\n// -> {\n// onAttributeChange( documentElement, callback ),\n// onConnected( documentElement, callback ),\n// onDisconnected( documentElement, callback ),\n// onNodeAttributeChange( node, callback ),\n// onNodeConnected( node, callback ),\n// onNodeDisconnected( node, callback )\n// }\n\n// listen to every attribute change within the document:\ndomMutate.onAttributeChange(document.documentElement, function(mutationRecord){\n mutationRecord.target //-> \n mutationRecord.attributeName //-> \"name\"\n mutationRecord.oldValue //-> \"Ramiya\"\n})\n```\n\nIf you want to support browsers that do not support the `MutationObserver` api, use\n[can-dom-mutate/node] to update the DOM. Every module within CanJS should do this:\n\n```js\nvar mutate = require('can-dom-mutate/node');\nvar el = document.createElement('div');\n\nmutate.appendChild.call(document.body, el);\n```\n", "params": [] } ], - "_curReturn": { - "types": [ - { - "type": "can.Map" - } - ], - "description": "An instance of `can.Map` with the properties from _props_.\n" - }, - "comment": " " - }, - "can-make-rest": { - "src": { - "path": "node_modules/can-make-rest/can-make-rest.md" - }, - "body": "\nMake restful urls and methods from a resource\n\n", - "description": "\n# can-make-rest\n", - "name": "can-make-rest", - "type": "page", - "hide": true - }, - "can-memory-store.getQueries": { - "body": "\n\n## Use\n\n```js\nconnection.getSets() //-> Promise( [{type: \"completed\"},{user: 5}] )\n```\n\n\t \n", - "description": "\nReturns the queries contained within the cache.\n", - "title": "getQueries", - "name": "can-memory-store.getQueries", - "type": "function", - "parent": "can-memory-store.data-methods", - "signatures": [ - { - "code": "connection.getQueries()", - "description": "\n\n Returns the queries added by [can-memory-store.updateListData].\n", - "params": [], - "returns": { - "types": [ - { - "type": "Promise", - "template": [ - { - "types": [ - { - "type": "Array", - "template": [ - { - "types": [ - { - "type": "can-query-logic/query" - } - ] - } - ] - } - ] - } - ] - } - ], - "description": "A promise that resolves to the list of queries.\n" - } - } - ], - "_curReturn": { - "types": [ - { - "type": "Promise", - "template": [ - { - "types": [ - { - "type": "Array", - "template": [ - { - "types": [ - { - "type": "can-query-logic/query" - } - ] - } - ] - } - ] - } - ] - } + "comment": " ", + "codepen": [ + [ + "\"can\"", + "\"//unpkg.com/can@6/core.mjs\"" ], - "description": "A promise that resolves to the list of queries.\n" - }, - "comment": " " - }, - "can-memory-store.clear": { - "body": "\n", - "description": "\nResets the memory store so it contains nothing.\n", - "title": "clear", - "name": "can-memory-store.clear", - "type": "function", - "parent": "can-memory-store.data-methods", - "signatures": [ - { - "code": "connection.clear()", - "description": "\n\n Removes all instances and lists being stored in memory.\n\n ```js\n memoryStore({queryLogic: new QueryLogic()});\n\n cacheConnection.updateInstance({id: 5, name: \"justin\"});\n\n cacheConnection.getData({id: 5}).then(function(data){\n data //-> {id: 5, name: \"justin\"}\n cacheConnection.clear();\n cacheConnection.getData({id: 5}).catch(function(err){\n err -> {message: \"no data\", error: 404}\n });\n });\n ```\n\n\t ", - "params": [] - } - ] - }, - "can-memory-store.getListData": { - "body": "\n", - "description": "\nGets a list of data from the memory store.\n", - "title": "getListData", - "name": "can-memory-store.getListData", - "type": "function", - "parent": "can-memory-store.data-methods", - "signatures": [ - { - "code": "connection.getListData(query)", - "description": "\n\n Goes through each query add by [can-memory-store.updateListData]. If\n `query` is a subset, uses [can-connect/base/base.queryLogic] to get the data for the requested `query`.\n", - "params": [ - { - "types": [ - { - "type": "can-query-logic/query" - } - ], - "name": "query", - "description": "An object that represents the data to load.\n" - } - ], - "returns": { - "types": [ - { - "type": "Promise", - "template": [ - { - "types": [ - { - "type": "can-connect.listData" - } - ] - } - ] - } - ], - "description": "A promise that resolves if `query` is a subset of\nsome data added by [can-memory-store.updateListData]. If it is not,\nthe promise is rejected.\n\t " - } - } - ], - "_curParam": { - "types": [ - { - "type": "can-query-logic/query" - } + [ + "\"can/ecosystem\"", + "\"//unpkg.com/can@6/ecosystem.mjs\"" ], - "name": "query", - "description": "An object that represents the data to load.\n" - }, - "_curReturn": { - "types": [ - { - "type": "Promise", - "template": [ - { - "types": [ - { - "type": "can-connect.listData" - } - ] - } - ] - } + [ + "\"can/everything\"", + "\"//unpkg.com/can@6/everything.mjs\"" ], - "description": "A promise that resolves if `query` is a subset of\nsome data added by [can-memory-store.updateListData]. If it is not,\nthe promise is rejected.\n\t " - } - }, - "can-connect/data/memory-cache.getListDataSync": { - "body": "\n\t \n", - "description": "\nSynchronously gets a query of data from the memory cache.\n", - "title": "getListDataSync", - "name": "can-connect/data/memory-cache.getListDataSync", - "type": "function", - "parent": "can-connect/data/memory-cache.data-methods", - "signatures": [ - { - "code": "connection.getListDataSync(query)", - "description": "", - "params": [] - } - ], - "hide": true - }, - "can-memory-store.updateListData": { - "body": "\n", - "description": "\nSaves a query of data in the cache.\n", - "title": "updateListData", - "name": "can-memory-store.updateListData", - "type": "function", - "parent": "can-memory-store.data-methods", - "signatures": [ - { - "code": "connection.updateListData(listData, query)", - "description": "\n\n Tries to merge this query of data with any other saved queries of data. If\n unable to merge this data, saves the query by itself.\n", - "params": [ - { - "types": [ - { - "type": "can-connect.listData" - } - ], - "name": "listData", - "description": "The data that belongs to `query`." - }, - { - "types": [ - { - "type": "can-query-logic/query" - } - ], - "name": "query", - "description": "The query `listData` belongs to." - } - ], - "returns": { - "types": [ - { - "type": "Promise" - } - ], - "description": "Promise resolves if and when the data has been successfully saved.\n\t " - } - } - ], - "_curParam": { - "types": [ - { - "type": "can-query-logic/query" - } + [ + "\"can/demos/technology-overview/mock-url\"", + "\"//unpkg.com/mock-url@^6.0.0/mock-url.mjs\"" ], - "name": "query", - "description": "The query `listData` belongs to." - }, - "_curReturn": { - "types": [ - { - "type": "Promise" - } + [ + "\"can/demos/technology-overview/route-mini-app-components\"", + "\"//unpkg.com/route-mini-app@^5.0.0/components.mjs\"" ], - "description": "Promise resolves if and when the data has been successfully saved.\n\t " - } - }, - "can-memory-store.getData": { - "body": "\n", - "description": "\nGet an instance's data from the memory cache.\n", - "title": "getData", - "name": "can-memory-store.getData", - "type": "function", - "parent": "can-memory-store.data-methods", - "signatures": [ - { - "code": "connection.getData(params)", - "description": "\n\n Looks in the instance store for the requested instance.\n", - "params": [ - { - "types": [ - { - "type": "Object", - "options": [] - } - ], - "name": "params", - "description": "An object that should have the [conenction.id] of the element\nbeing retrieved.\n" - } - ], - "returns": { - "types": [ - { - "type": "Promise" - } - ], - "description": "A promise that resolves to the item if the memory cache has this item.\nIf the memory cache does not have this item, it rejects the promise.\n\t " - } - } - ], - "_curParam": { - "types": [ - { - "type": "Object", - "options": [] - } + [ + "return steal.import(", + "return import(" ], - "name": "params", - "description": "An object that should have the [conenction.id] of the element\nbeing retrieved.\n" - }, - "_curReturn": { - "types": [ - { - "type": "Promise" - } + [ + "\"can/demos/technology-overview/page-login\"", + "\"//unpkg.com/route-mini-app@^5.0.0/page-login.mjs\"" ], - "description": "A promise that resolves to the item if the memory cache has this item.\nIf the memory cache does not have this item, it rejects the promise.\n\t " - } - }, - "can-memory-store.createData": { - "body": "\n", - "description": "\nCalled when an instance is created and should be added to cache.\n", - "title": "createData", - "name": "can-memory-store.createData", - "type": "function", - "parent": "can-memory-store.data-methods", - "signatures": [ - { - "code": "connection.createData(record)", - "description": "\n\n Adds `record` to the stored list of instances. Then, goes\n through every query and adds record the queries it belongs to.\n\t ", - "params": [] - } - ] - }, - "can-memory-store.updateData": { - "body": "\n", - "description": "\nCalled when an instance is updated.\n", - "title": "updateData", - "name": "can-memory-store.updateData", - "type": "function", - "parent": "can-memory-store.data-methods", - "signatures": [ - { - "code": "connection.updateData(record)", - "description": "\n\n Overwrites the stored instance with the new record. Then, goes\n through every query and adds or removes the instance if it belongs or not.\n\t ", - "params": [] - } - ] - }, - "can-memory-store.destroyData": { - "src": { - "line": 188, - "codeLine": 202, - "path": "node_modules/can-memory-store/can-memory-store.js" - }, - "type": "function", - "body": "\n", - "description": "\nCalled when an instance should be removed from the cache.\n", - "title": "destroyData", - "name": "can-memory-store.destroyData", - "parent": "can-memory-store.data-methods", - "signatures": [ - { - "code": "connection.destroyData(record)", - "description": "\n\n Goes through each query of data and removes any data that matches\n `record`'s [can-connect/base/base.id]. Finally removes this from the instance store.\n\t ", - "params": [] - } + [ + "`can/demos/technology-overview/page-${this.page}`", + "`//unpkg.com/route-mini-app@^5.0.0/page-${this.page}.mjs`" + ] ] }, - "can-memory-store.data-methods": { - "name": "can-memory-store.data-methods", - "title": "data methods", + "can-event-dom-enter.modules": { + "name": "can-event-dom-enter.modules", + "title": "modules", "type": "group", - "parent": "can-memory-store", + "parent": "can-event-dom-enter", "description": "", "order": 0 }, - "can-memory-store": { + "can-event-dom-enter": { + "name": "can-event-dom-enter", + "type": "module", + "parent": "can-dom-utilities", "src": { - "path": "node_modules/can-memory-store/can-memory-store.md" + "line": 11, + "codeLine": 38, + "path": "node_modules/can-event-dom-enter/can-event-dom-enter.js" }, - "body": "\n\n## Use\n\n`can-memory-store` is used as a store of query-able data. It can either be used on its own or\nas part of a [can-connect] cache connection.\n\n### Standalone use\n\nTo use `memoryStore`, first create one with a `queryLogic` instance:\n\n```js\nimport memoryStore from \"can-memory-store\";\nimport QueryLogic from \"can-query-logic\";\n\n// Create a store\nvar todosStore = memoryStore({\n queryLogic: new QueryLogic({\n identity: [\"id\"]\n })\n});\n```\n\nThen populate the store with data:\n\n```js\ntodosStore.updateListData([\n {id: 1, name: \"dishes\", points: 2},\n {id: 2, name: \"lawn\", points: 8},\n {id: 3, name: \"trash\", points: 1},\n {id: 4, name: \"car wash\", points: 5},\n]);\n```\n\nThen you can query the store for data:\n\n```js\ntodosStore.getListData({\n filter: {points: {$gt: 1}},\n sort: \"name\",\n page: {start: 0, end: 1}\n})\n//-> {\n// data: [\n// {id: 4, name: \"car wash\", points: 5},\n// {id: 1, name: \"dishes\", points: 2}],\n// count: 3\n// }\n```\n\n### Use with connection\n\n\n`can-memory-store` is often used with a caching strategy like [can-connect/fall-through-cache/fall-through-cache] or\n[can-connect/cache-requests/cache-requests] as their\n`cacheConnection`. The following gives an example of using it with the\n`connectFallThroughCache`:\n\n```js\nimport {\n DefineMap,\n QueryLogic,\n memoryStore,\n connectFallThroughCache,\n connectCanMap,\n connectRest,\n connectConstructor,\n connect\n} from \"can\";\n\n// Define a type\nconst Todo = DefineMap.extend(\"Todo\",{\n id: {identity: true, type:\"number\"},\n name: \"string\",\n complete: \"boolean\"\n});\n\n// Create a store\nvar todosStore = memoryStore({\n queryLogic: new QueryLogic(Todo)\n});\n\nvar todoConnection = connect([\n connectRest,\n connectMap,\n connectFallThroughCache,\n connectConstructor\n],\n{\n url: \"/services/todos\",\n cacheConnection: todosStore\n});\n```\n\n", - "description": "\nCreate, update, delete and query data saved in memory.\n", - "type": "module", - "title": "can-memory-store", - "name": "can-memory-store", - "parent": "can-data-modeling", + "body": "\n```js\nvar domEvents = require('can-dom-events');\nvar enterEvent = require('can-event-dom-enter');\n\ndomEvents.addEvent(enterEvent);\n\nvar input = document.createElement('input');\nfunction enterEventHandler() {\n\tconsole.log('enter key pressed');\n}\n\ndomEvents.addEventHandler(input, 'enter', enterEventHandler);\ndomEvents.dispatch(input, {\n type: 'keyup',\n keyCode: keyCode\n});\n```\n\n", + "description": "\nWatch for when enter keys are pressed on a DomEventTarget.\n", + "title": "", + "types": [ + { + "type": "events" + } + ], "collection": "can-infrastructure", "package": { "author": { - "name": "DoneJS Core Team", + "name": "Chris Andrejewski", "email": "core@donejs.com", - "url": "http://donejs.com" + "url": "https://bitovi.com" }, "bugs": { - "url": "https://github.com/canjs/can-memory-store/issues" + "url": "https://github.com/canjs/can-event-dom-enter/issues" }, "bundleDependencies": false, "dependencies": { - "can-diff": "<2.0.0", - "can-namespace": "^1.0.0", - "can-query-logic": "<2.0.0", - "can-reflect": "^1.13.4", - "can-sort-object": "^1.0.1" + "can-dom-events": "^1.0.0", + "can-namespace": "1.0.0" }, "deprecated": false, - "description": "A memory store with mongo-db like queries", + "description": "Custom enter event", "devDependencies": { - "can-set-legacy": "<2.0.0", - "detect-cyclic-packages": "^1.1.1", + "detect-cyclic-packages": "^1.1.0", + "fixpack": "^2.3.1", "jshint": "^2.9.1", "steal": "^2.2.1", "steal-qunit": "^2.0.0", "steal-tools": "^2.2.1", "testee": "^0.9.0" }, - "homepage": "http://canjs.com", + "homepage": "https://canjs.com/doc/can-event-dom-enter.html", "keywords": [ - "DoneJS", - "donejs-plugin" + "canjs", + "change", + "event", + "radio" ], "license": "MIT", - "main": "can-memory-store", - "name": "can-memory-store", + "main": "can-event-dom-enter", + "name": "can-event-dom-enter", "repository": { "type": "git", - "url": "git://github.com/canjs/can-memory-store.git" + "url": "git://github.com/canjs/can-event-dom-enter.git" }, "scripts": { "build": "node build.js", - "detect-cycle": "detect-cyclic-packages", - "develop": "done-serve --static --develop --port 8080", + "detect-cycle": "detect-cyclic-packages --ignore done-serve", + "install-canary": "npm install --no-shrinkwrap", + "install-locked": "npm install", "jshint": "jshint ./*.js --config", - "postpublish": "git push --tags && git push", - "preversion": "npm test", - "release:major": "npm version major && npm publish", - "release:minor": "npm version minor && npm publish", - "release:patch": "npm version patch && npm publish", - "test": "npm run detect-cycle && npm run jshint && npm run testee", - "testee": "DEBUG=testee:* testee test.html --browsers firefox" + "lint": "fixpack && npm run jshint", + "postversion": "git push --follow-tags", + "preversion": "npm test && npm run build", + "test": "npm run detect-cycle && npm run lint && npm run testee", + "testee": "testee test.html --browsers firefox" }, - "version": "1.0.2" - }, - "signatures": [ - { - "code": "memoryStore( baseConnection )", - "description": "\n\nCreate a database-like store of a single data type. For example:\n\n```js\nimport memoryStore from \"can-memory-store\";\nimport QueryLogic from \"can-query-logic\";\n\n// Create a store\nvar todosStore = memoryStore({\n queryLogic: new QueryLogic({\n identity: [\"id\"]\n })\n});\n\n// Add a list of data to the store\ntodosStore.updateListData(...);\n// Get a list of data from the store\ntodosStore.getListData(...)\n// Create a record in the store\ntodosStore.createData(...)\n// Get a record in the store\ntodosStore.getData(...)\n// Update a record in the store\ntodosStore.updateData(...)\n// Remove a record from the store\ntodosStore.destroyData(...)\n// Clear all records from the store\ntodosStore.clear()\n// Get the queries that are currently stored\ntodosStore.getQueries()\n```\n", - "params": [ - { - "types": [ - { - "type": "Object", - "options": [] - } - ], - "optional": true, - "name": "baseConnection", - "description": "A base [can-connect] connection or a settings object. `baseConnection`\n must have a `queryLogic` property that references a [can-query-logic] instance. The `can-query-logic`\n instance is used to determine the behavior of [can-memory-store.getListData].\n\n" - } + "steal": { + "main": "can-event-dom-enter", + "npmIgnore": [ + "testee", + "steal-tools" ] - } - ], - "_curParam": { - "types": [ - { - "type": "Object", - "options": [] - } - ], - "optional": true, - "name": "baseConnection", - "description": "A base [can-connect] connection or a settings object. `baseConnection`\n must have a `queryLogic` property that references a [can-query-logic] instance. The `can-query-logic`\n instance is used to determine the behavior of [can-memory-store.getListData].\n\n" - }, - "comment": " " + }, + "version": "2.2.1" + } }, - "can-param": { + "can-event-dom-enter/add-global/add-global": { "src": { - "path": "node_modules/can-param/can-param.md" + "path": "node_modules/can-event-dom-enter/add-global.md" }, - "body": "\n## Try it\n\nUse this JS Bin to play around with this package:\n\ncan-param on jsbin.com\n\n\n", - "description": "Serialize an object or array into a query string. \n", - "type": "module", - "title": "can-param", + "body": "", + "description": " \nRegisters a global `enter` event, allowing listening to enter anywhere in your application.\n\n", + "type": "module", + "title": "can-event-dom-enter/add-global/add-global", "types": [ { "type": "function", @@ -5418,1123 +6174,735 @@ "params": [] } ], - "name": "can-param", - "parent": "can-routing", + "name": "can-event-dom-enter/add-global/add-global", + "parent": "can-event-dom-enter", + "signatures": [ + { + "code": "unregister()", + "description": "\n\nImporting `can-event-dom-enter/add-global/add-global` registers the __enter__ event globally. Calling `unregister()` removes it from the global registry.\n\n```js\nimport unregister from 'can-event-dom-enter/add-global/add-global';\n\n// Later time\nunregister();\n```\n", + "params": [] + } + ] + }, + "can-event-dom-radiochange": { + "name": "can-event-dom-radiochange", + "type": "module", + "parent": "can-dom-utilities", + "src": { + "line": 61, + "codeLine": 89, + "path": "node_modules/can-event-dom-radiochange/can-event-dom-radiochange.js" + }, + "body": "\n```js\nvar domEvents = require('can-dom-events');\nvar radioChange = require('can-event-dom-radiochange');\ndomEvents.addEvent(radioChange);\n\nvar target = document.createElement('input');\n\nfunction handler () {\n\tconsole.log('radiochange event fired');\n}\n\ndomEvents.addEventListener(target, 'radiochange', handler);\ndomEvents.removeEventListener(target, 'radiochange', handler);\n```\n\n", + "description": "\nA custom event for listening to changes of inputs with type \"radio\",\nwhich fires when a conflicting radio input changes. A \"conflicting\"\nradio button has the same \"name\" attribute and exists within in the\nsame form, or lack thereof. This event coordinates state bound to\nwhether a radio is checked. The \"change\" event does not fire for deselected\nradios. By using this event instead, deselected radios receive notification.\n", + "title": "", + "types": [ + { + "type": "events" + } + ], "collection": "can-infrastructure", "package": { "author": { - "name": "Bitovi", - "email": "contact@bitovi.com", - "url": "https://www.bitovi.com/" + "name": "Chris Andrejewski", + "email": "core@donejs.com", + "url": "https://bitovi.com" }, "bugs": { - "url": "https://github.com/canjs/can-param/issues" + "url": "https://github.com/canjs/can-event-dom-radiochange/issues" }, "bundleDependencies": false, "dependencies": { + "can-dom-events": "<2.0.0", + "can-globals": "<2.0.0", "can-namespace": "1.0.0" }, "deprecated": false, - "description": "Serialize an array or object into a query string.", + "description": "Custom radiochange event", "devDependencies": { "detect-cyclic-packages": "^1.1.0", + "fixpack": "^2.3.1", "jshint": "^2.9.1", "steal": "^2.2.1", "steal-qunit": "^2.0.0", "steal-tools": "^2.2.1", "testee": "^0.9.0" }, - "homepage": "https://canjs.com/doc/can-param.html", + "homepage": "https://canjs.com/doc/can-event-dom-radiochange.html", "keywords": [ "canjs", - "parameter", - "query string" + "change", + "event", + "radio" ], - "main": "can-param", - "name": "can-param", + "license": "MIT", + "main": "can-event-dom-radiochange", + "name": "can-event-dom-radiochange", "repository": { "type": "git", - "url": "git://github.com/canjs/can-param.git" + "url": "git://github.com/canjs/can-event-dom-radiochange.git" }, "scripts": { "build": "node build.js", "detect-cycle": "detect-cyclic-packages --ignore done-serve", - "develop": "done-serve --static --develop --port 8080", + "install-canary": "npm install --no-shrinkwrap", + "install-locked": "npm install", "jshint": "jshint ./*.js --config", - "postpublish": "git push --tags && git checkout master && git branch -D release && git push", + "lint": "fixpack && npm run jshint", + "postversion": "git push --follow-tags", "preversion": "npm test && npm run build", - "release:major": "npm version major && npm publish", - "release:minor": "npm version minor && npm publish", - "release:patch": "npm version patch && npm publish", - "test": "npm run detect-cycle && npm run jshint && npm run testee", - "testee": "testee test.html --browsers firefox", - "version": "git commit -am \"Update version number\" && git checkout -b release && git add -f dist/" + "test": "npm run detect-cycle && npm run lint && npm run testee", + "testee": "testee test.html --browsers firefox" }, "steal": { - "configDependencies": [ - "live-reload" - ], + "main": "can-event-dom-radiochange", "npmIgnore": [ "testee", - "generator-donejs", - "donejs-cli", "steal-tools" ] }, - "version": "1.1.2" - }, - "signatures": [ - { - "code": "param(object)", - "description": "\n\nSerializes an object or array into a query string useful for making Ajax requests. `param` handles nested objects and arrays. It uses `encodeURIComponent` to\nescape values and keys.\n\n```js\nimport param from \"can-param\";\n\nparam( { foo: \"bar\" } ); //-> \"foo=bar\"\nparam( { foo: [ \"bar\", \"baz\" ] } ); //-> \"foo[]=bar&foo[]=baz\"\nparam( { foo: { bar: \"baz\" } } ); //-> \"foo[bar]=baz\"\nparam( { foo: \"bar & baz\" } ); //-> \"foo=bar+%26+baz\"\n```\n\nThis is exported as `param` on [can-namespace].\n", - "params": [ - { - "types": [ - { - "type": "Object", - "options": [] - } - ], - "name": "object", - "description": "An object or array. " - } - ], - "returns": { - "types": [ - { - "type": "String" - } - ], - "description": "The params formatted into a form-encoded string.\n" - } - } - ], - "_curParam": { - "types": [ - { - "type": "Object", - "options": [] - } - ], - "name": "object", - "description": "An object or array. " - }, - "_curReturn": { - "types": [ - { - "type": "String" - } - ], - "description": "The params formatted into a form-encoded string.\n" - }, - "comment": " " + "version": "2.2.1" + } }, - "can-parse-uri": { - "name": "can-parse-uri", - "type": "module", - "parent": "can-js-utilities", + "can-event-queue": { "src": { "line": 1, - "codeLine": 31, - "path": "node_modules/can-parse-uri/can-parse-uri.js" + "codeLine": 19, + "path": "node_modules/can-event-queue/can-event-queue.js" }, + "type": "module", "body": "", - "description": "", - "title": "can-parse-uri", + "description": "Mixin observable behavior to your types. \n", + "title": "can-event-queue", "types": [ { - "type": "function", - "returns": { - "types": [ - { - "type": "undefined" - } - ] - }, - "params": [] + "type": "undefined", + "description": "\n\nThe `can-event-queue` package contains modules that mixin\ncommon observable methods and symbols onto objects\nand functions. The following are the included modules:\n\n- [can-event-queue/value/value] - Mixins for single-value observables like [can-observation].\n- [can-event-queue/map/map] - Mixins for key-value observables like [can-define].\n- [can-event-queue/type/type] - Mixins on constructor functions.\n" } ], + "name": "can-event-queue", + "parent": "can-observables", "collection": "can-infrastructure", "package": { "author": { - "name": "Bitovi", - "email": "contact@bitovi.com", - "url": "https://www.bitovi.com/" + "name": "DoneJS", + "email": "core@donejs.com", + "url": "http://canjs.com" }, "bugs": { - "url": "https://github.com/canjs/can-parse-uri/issues" + "url": "https://github.com/canjs/can-event-queue/issues" }, "bundleDependencies": false, "dependencies": { - "can-namespace": "^1.0.0" + "can-define-lazy-value": "^1.0.1", + "can-dom-events": "^1.0.0", + "can-key-tree": "^1.1.0", + "can-log": "^1.0.0", + "can-queues": "^1.0.0", + "can-reflect": "^1.10.2", + "can-symbol": "^1.2.0" }, "deprecated": false, - "description": "Parse a URI into its components.", + "description": "A event mixin that uses queues to dispatch handlers", "devDependencies": { - "detect-cyclic-packages": "^1.1.0", + "done-serve": "^3.3.1", + "donejs-cli": "^3.1.1", + "generator-donejs": "^3.3.0", "jshint": "^2.9.1", "steal": "^2.2.1", "steal-qunit": "^2.0.0", "steal-tools": "^2.2.1", "testee": "^0.9.0" }, - "homepage": "https://canjs.com/", + "homepage": "https://github.com/canjs/can-event-queue#readme", "keywords": [ - "canjs", - "parse", - "uri" + "canjs" ], - "main": "can-parse-uri", - "name": "can-parse-uri", + "license": "MIT", + "main": "./can-event-queue.js", + "name": "can-event-queue", "repository": { "type": "git", - "url": "git://github.com/canjs/can-parse-uri.git" + "url": "git://github.com/canjs/can-event-queue.git" }, "scripts": { "build": "node build.js", - "detect-cycle": "detect-cyclic-packages --ignore done-serve", "develop": "done-serve --static --develop --port 8080", - "jshint": "jshint ./*.js --config", + "jshint": "jshint ./*.js map/**/*.js type/*.js value/*.js --config", "postpublish": "git push --tags && git checkout master && git branch -D release && git push", "preversion": "npm test && npm run build", "release:major": "npm version major && npm publish", "release:minor": "npm version minor && npm publish", "release:patch": "npm version patch && npm publish", - "test": "npm run detect-cycle && npm run jshint && npm run testee", + "test": "npm run jshint && npm run testee", "testee": "testee test.html --browsers firefox", "version": "git commit -am \"Update version number\" && git checkout -b release && git add -f dist/" }, "steal": { - "main": "can-parse-uri", - "configDependencies": [ - "live-reload" - ], "npmIgnore": [ "testee", "generator-donejs", "donejs-cli", "steal-tools" + ], + "plugins": [ + "steal-less", + "steal-stache" ] }, - "version": "1.2.2" - }, - "signatures": [ - { - "code": "parseURI(url)", - "description": "\n\nParse a URI into its components.\n\n```js\nimport {parseURI} from \"can\"\nparseURI(\"http://foo:8080/bar.html?query#change\")\n//-> {\n// authority: \"//foo:8080\",\n// hash: \"#change\",\n// host: \"foo:8080\",\n// hostname: \"foo\",\n// href: \"http://foo:8080/bar.html?query#change\",\n// pathname: \"/bar.html\",\n// port: \"8080\",\n// protocol: \"http:\",\n// search: \"?query\"\n// }\n```\n", - "params": [ - { - "types": [ - { - "type": "String" - } - ], - "name": "url", - "description": "The URL you want to parse.\n" - } - ], - "returns": { - "types": [ - { - "type": "Object", - "options": [] - } - ], - "description": "Returns an object with properties for each part of the URL. `null`\nis returned if the url can not be parsed.\n" - } - } - ], - "_curParam": { - "types": [ - { - "type": "String" - } - ], - "name": "url", - "description": "The URL you want to parse.\n" - }, - "_curReturn": { - "types": [ - { - "type": "Object", - "options": [] - } - ], - "description": "Returns an object with properties for each part of the URL. `null`\nis returned if the url can not be parsed.\n" + "version": "1.1.8" } }, - "can-reflect-tests": { - "src": { - "path": "node_modules/can-reflect-tests/can-reflect-tests.md" - }, - "body": "\ntests for can-reflect types\n\n", - "description": "\n# can-reflect-tests\n", - "name": "can-reflect-tests", - "type": "page" - }, - "can-reflect/call": { - "name": "can-reflect/call", - "title": "Call reflections", - "type": "group", - "parent": "can-reflect", - "description": "", - "order": 3 - }, - "can-reflect/get-set": { - "name": "can-reflect/get-set", - "title": "Get/Set reflections", - "type": "group", - "parent": "can-reflect", - "description": "", - "order": 2 - }, - "can-reflect/observe": { - "name": "can-reflect/observe", - "title": "Observable reflections", - "type": "group", - "parent": "can-reflect", - "description": "", - "order": 5 - }, - "can-reflect/shape": { - "name": "can-reflect/shape", - "title": "Shape reflections", + "can-fixture-socket.properties": { + "name": "can-fixture-socket.properties", + "title": "properties", "type": "group", - "parent": "can-reflect", + "parent": "can-fixture-socket", "description": "", - "order": 4 + "order": 0 }, - "can-reflect/type": { - "name": "can-reflect/type", - "title": "Type reflections", + "can-fixture-socket.types": { + "name": "can-fixture-socket.types", + "title": "types", "type": "group", - "parent": "can-reflect", + "parent": "can-fixture-socket", "description": "", - "order": 1 + "order": 0 }, - "can-reflect": { + "can-fixture-socket": { "src": { - "path": "node_modules/can-reflect/can-reflect.md" + "path": "node_modules/can-fixture-socket/can-fixture-socket.md" }, - "body": "", - "description": "Perform operations and read information on unknown data types. \n", + "body": "\n## Use basics\n\nLets say we wanted to test a simple app that connects to `socket.io`, and\nonce connected, creates a message, and logs when the message is created.\n\nThat app could look like the following:\n\n```js\nconst socket = io();\nsocket.on( \"connect\", function() {\n\tsocket.emit( \"messages create\", { text: \"A new message\" } );\n} );\nsocket.on( \"message created\", function( data ) {\n\n\t// data.text === \"A new message\"\n\tconsole.log( \"Server sent out a new message we just created\", data );\n} );\n```\n\nTo test this, we'll first use [can-fixture-socket.Server can-fixture-socket.Server] to intercept the socket connection:\n\n```js\nimport io from \"socket.io-client\";\nimport fixtureSocket from \"can-fixture-socket\";\nconst mockServer = new fixtureSocket.Server( io );\n```\n\nNow we can mock the socket server by creating socket event listeners and emitting socket events:\n\n```js\nmockServer.on( \"messages create\", function( data ) {\n\tconsole.log( \"New message received\", data );\n\tmockServer.emit( \"message created\", data );\n} );\n```\n\nTo see this in action:\n\n
    \n\n\n### Acknowledgement callbacks\n\nWe also can use socket.io [acknowledgement callbacks](http://socket.io/docs/#sending-and-getting-data-(acknowledgements)):\n```js\nmockServer.on( \"users create\", function( user, ackCb ) {\n\tconsole.log( \"Simulating saving a new user to DB and return the new user id\", user );\n\n\tackCB( {\n\t\tid: Math.random()\n\t} );\n} );\n```\n\nClient code:\n\n```js\nconst socket = io();\nsocket.on( \"connect\", function() {\n\tsocket.emit( \"users create\", { name: \"Ilya\", likes: \"skiing\" }, function( data ) {\n\n\t\t// data is what server calls the acknowledgement callback\n\t\t// with (e.g. data.id is the new user id).\n\t\tconsole.log( data.id );\n\t} );\n} );\n```\n\n## Use with can-fixture.Store\n\nWith can-fixture [can-fixture.store] we can create a store of items and emulate a fully working CRUD service. Optionally, we can use [can-set.Algebra] to power our store filtering, pagination, and sorting abilities.\n\n```js\n// Import can-fixture that provides `store` method for creating a store:\nimport fixture from \"can-fixture\";\n\nimport canSet from \"can-set\";\n\n// Create a fixture store:\nconst messagesStore = fixture.store( [\n\t{ id: 1, title: \"One\" },\n\t{ id: 2, title: \"Two\" },\n\t{ id: 3, title: \"Three\" }\n], new canSet.Algebra( {} ) );\n```\n\nWe can mock the socket.io connection with the rich behavior of _fixture stores_ using the [can-fixture-socket.requestHandlerToListener] helper. `requestHandlerToListener`\nconverts a _fixture store request handler_ to a _socket.io event listener_.\n\n```js\nimport fixtureSocket from \"can-fixture-socket\";\nimport io from \"socket.io-client\";\nconst mockServer = new fixtureSocket.Server( io );\n\nmockServer.on( \"messages get\", fixtureSocket.requestHandlerToListener( messagesStore.getData ) );\n```\n\nOr we can use [can-fixture-socket.storeToListeners] helper to convert all CRUD _fixture store request handlers_ into _socket.io event listeners_:\n\n```js\nconst listeners = fixtureSocket.storeToListeners( messagesStore );\nmockServer.on( {\n\t\"messages remove\": listeners.destroyData,\n\t\"messages create\": listeners.createData,\n\t\"messages update\": listeners.updateData\n} );\n```\n\n## Use with FeathersJS\n\n[Feathers](http://feathersjs.com/) is a minimalist, service-oriented, real-time web framework for modern applications. It is a NodeJS framework built on top of Express. It allows you to build REST-ful services and works with three [providers](https://docs.feathersjs.com/providers/): standard HTTP communication, WebSockets and Primus.\n\nThe mocked server exposes [can-fixture-socket.Server.prototype.onFeathers] method to simulate [FeathersJS](http://feathersjs.com/) CRUD services.\n\nFor example, given the following FeathersJS client app:\n\n```js\nconst socket = io( \"http://api.my-feathers-server.com\" );\nconst app = feathers()\n\t.configure( hooks() )\n\t.configure( feathersSocketio( socket ) );\n\n// Create FeathersJS CRUD service for \"messages\" resource:\nconst messagesService = app.service( \"messages\" );\n```\n\nWe can simulate it with a [can-fixture.store] as follows:\n\n```js\nconst messagesStore = fixture.store( [\n\t{ id: 1, title: \"One\" },\n\t{ id: 2, title: \"Two\" },\n\t{ id: 3, title: \"Three\" }\n], new canSet.Algebra( {} ) );\n\nmockServer.onFeathersService( \"messages\", fixtureStore );\n```\n\nNow you can test your FeathersJS app:\n\n```js\nmessagesService.find( {} ).then( function( data ) {\n\tassert.equal( data.total, 3, \"find should receive 3 items\" );\n} );\nmessagesService.get( 1 ).then( function( data ) {\n\tassert.deepEqual( data, { id: 1, title: \"One\" }, \"get should receive an item\" );\n} );\nmessagesService.create( { title: \"Four\" } ).then( function( data ) {\n\tassert.equal( data.title, \"Four\", \"create should add an new item\" );\n} );\n```\n\n", + "description": "Simulate socket.io services. \n\n\n", "type": "module", "title": "", "types": [ { "type": "Object", "options": [], - "description": "The `can-reflect` package exports an object with\nmethods used to perform operations and read information on unknown data\ntypes. For example, `setKeyValue` sets the `name` property on some type of map:\n\n```js\nimport canReflect from \"can-reflect\";\n\nconst map = CREATE_MAP_SOMEHOW();\n\ncanReflect.setKeyValue( map, \"name\", \"my map\" );\n```\n\nAny object can interact with the reflect APIs by having the right\n[can-symbol] symbols. The following creates an object that informs how\n[can-reflect.getKeyValue] and [can-reflect.setKeyValue] behave:\n\n```js\nimport canSymbol from \"can-symbol\";\n\nconst obj = {\n\t_data: new Map()\n};\nobj[ canSymbol.for( \"can.getKeyValue\" ) ] = function( key ) {\n\treturn this._data.get( key );\n};\nobj[ canSymbol.for( \"can.setKeyValue\" ) ] = function( key, value ) {\n\treturn this._data.set( key, value );\n};\n```\n\n`can-reflect` organizes its methods into the following groups:\n\n- __Type Reflections__ - Determine if an object matches a familiar type to CanJS.\n- __Get/Set Reflections__ - Read and write to objects.\n- __Call Reflections__ - Call functions and function-like objects.\n- __Shape Reflections__ - Perform operations based on multiple values within an object.\n- __Observable Reflections__ - Listen to changes in observable objects.\n" + "description": "\n\n`can-fixture-socket` intercepts socket.io messages and simulates socket.io server responses.\n\nThe `can-fixture-socket` module exports an object with:\n\n- [can-fixture-socket.Server], a constructor function which instance intercepts the socket.io connection;\n- [can-fixture-socket.requestHandlerToListener], a helper to convert XHR request handler into [can-fixture-socket.socket-event-listener];\n- [can-fixture-socket.storeToListeners], a helper to convert all [can-fixture/StoreType] request handlers into [can-fixture-socket.socket-event-listener].\n\nWith three simple steps you can test your real-time application that uses socket.io:\n\n 1. create a mock server that intercepts socket.io;\n 2. mock server behavior;\n 3. test your application.\n\n```js\nimport fixtureSocket from \"can-fixture-socket\";\n\n// Import socket-io client:\nimport io from \"socket.io-client\";\n\n// Create a mock server that intercepts socket.io:\nconst mockServer = new fixtureSocket.Server( io );\n\n// Mock server behavior\nmockServer.on( \"connection\", function() {\n\tmockServer.emit( \"notifications\", { test: \"OK\" } );\n} );\n\n// Client. Create socket.io connection:\nconst socket = io( \"http://localhost:8080/api\" );\n\n// Test your application:\nsocket.on( \"connect\", function() {\n\tassert.ok( true, \"socket connected\" );\n} );\n\nsocket.on( \"notifications\", function( data ) {\n\tassert.deepEqual( data, { test: \"OK\" }, \"received notifications message\" );\n} );\n```\n" } ], - "name": "can-reflect", - "parent": "can-typed-data", - "collection": "can-infrastructure", + "name": "can-fixture-socket", + "parent": "can-data-modeling", + "collection": "can-ecosystem", "package": { "author": { - "name": "DoneJS core team", - "email": "core@donejs.com", - "url": "http://donejs.com" + "name": "bitovi", + "email": "contact@bitovi.com", + "url": "bitovi.com" }, "bugs": { - "url": "https://github.com/canjs/can-reflect/issues" + "url": "https://github.com/canjs/can-fixture-socket/issues" }, "bundleDependencies": false, "dependencies": { - "can-namespace": "^1.0.0", - "can-symbol": "^1.6.4" + "can-assign": "^1.2.0", + "can-fixture": "^3.0.0" }, "deprecated": false, - "description": "reflection on unknown data types", + "description": "Simulate socket connections", "devDependencies": { + "@feathersjs/feathers": "^3.3.1", + "@feathersjs/socketio-client": "^1.2.1", + "can-set-legacy": "<2.0.0", "detect-cyclic-packages": "^1.1.0", - "http-server": "^0.11.0", + "done-serve": "^1.2.0", + "donejs-cli": "^1.0.1", + "es6-promise-polyfill": "^1.2.0", + "generator-donejs": "^1.0.5", "jshint": "^2.9.1", - "steal": "^1.0.5", + "object-assign": "^4.1.0", + "socket.io-client": "^2.2.0", + "steal": "^1.5.6", "steal-qunit": "^2.0.0", - "steal-tools": "^1.0.1", - "test-saucelabs": "0.0.6", + "steal-tools": "^1.1.2", "testee": "^0.9.0" }, - "homepage": "http://canjs.com", + "homepage": "https://github.com/canjs/can-fixture-socket", "keywords": [ - "donejs" + "Done", + "JS", + "Can", + "JS" ], - "main": "can-reflect", - "name": "can-reflect", + "main": "can-fixture-socket", + "name": "can-fixture-socket", "repository": { "type": "git", - "url": "git://github.com/canjs/can-reflect.git" + "url": "git://github.com/canjs/can-fixture-socket.git" }, "scripts": { - "build": "node build.js", - "ci": "npm run build && npm run test && node test-saucelabs.js", "detect-cycle": "detect-cyclic-packages --ignore done-serve", - "http-server": "http-server -p 3000 --silent", - "jshint": "jshint ./*.js reflections/**/*.js types/*.js --config", - "postversion": "git push --tags && git checkout master && git branch -D release && git push", - "preversion": "npm test && npm run build", + "develop": "done-serve --static --develop --port 8080", + "jshint": "jshint ./*.js --config", + "postpublish": "git push --tags && git push", + "preversion": "npm test", "release:major": "npm version major && npm publish", "release:minor": "npm version minor && npm publish", "release:patch": "npm version patch && npm publish", - "release:pre": "npm version prerelease && npm publish --tag pre", + "release:pre": "npm version prerelease && npm publish --tag=pre", "test": "npm run detect-cycle && npm run jshint && npm run testee", - "testee": "testee test.html --browsers firefox", - "version": "git commit -am \"Update dist for release\" && git checkout -b release && git add -f dist/" + "testee": "testee test/test.html --browsers firefox" }, - "version": "1.17.11" - } + "steal": { + "main": "can-fixture-socket", + "configDependencies": [ + "live-reload" + ], + "npmIgnore": [ + "testee", + "generator-donejs", + "donejs-cli", + "steal-tools" + ], + "paths": { + "@feathersjs/commons*lib/lib": "node_modules/@feathersjs/commons/lib/index.js" + } + }, + "version": "2.0.3" + }, + "comment": " " }, - "can-reflect-promise": { + "can-fragment": { "src": { - "path": "node_modules/can-reflect-promise/can-reflect-promise.md" + "line": 7, + "codeLine": 43, + "path": "node_modules/can-fragment/can-fragment.js" }, - "body": "", - "description": "Expose an observable, Map-like API on Promise types. \n", + "type": "module", + "body": "\n\n## Use\n\nContentArrays can be used to combine multiple HTMLElements into a single document fragment. For example:\n\n var fragment = require(\"can-fragment\");\n\n var p = document.createElement(\"p\");\n p.innerHTML = \"Welcome to CanJS\";\n var contentArray = [\"

    Hi There

    \", p];\n var fragment = fragment( contentArray )\n\n`fragment` will be a documentFragment with the following elements:\n\n

    Hi There

    \n

    Welcome to CanJS

    \n\n \n", + "description": "\nConvert a String, HTMLElement, documentFragment, contentArray, or object with a `can.toDOM` symbol into a documentFragment.\n", "title": "", - "name": "can-reflect-promise", - "parent": "can-typed-data", - "type": "function", + "types": [ + { + "type": "function", + "returns": { + "types": [ + { + "type": "undefined" + } + ] + }, + "params": [] + } + ], + "name": "can-fragment", + "parent": "can-dom-utilities", "collection": "can-infrastructure", "package": { "author": { - "name": "Bitovi", - "email": "contact@bitovi.com", - "url": "https://www.bitovi.com" + "name": "donejs core team", + "email": "core@donejs.com", + "url": "http://donejs.com" }, "bugs": { - "url": "https://github.com/canjs/can-reflect-promise/issues" + "url": "https://github.com/canjs/can-fragment/issues" }, "bundleDependencies": false, "dependencies": { - "can-key-tree": "^1.0.0", - "can-log": "^1.0.0", - "can-observation": "^4.0.0", - "can-observation-recorder": "^1.0.0", - "can-queues": "^1.0.0", - "can-reflect": "^1.1.0", - "can-symbol": "^1.0.0" + "can-child-nodes": "^1.0.0", + "can-globals": "^1.0.1", + "can-namespace": "^1.0.0", + "can-reflect": "^1.16.1", + "can-symbol": "^1.6.1" }, "deprecated": false, - "description": "Reflection support for Promise types", + "description": "Create a fragment from lots of stuff", "devDependencies": { - "can-globals": "^1.0.0", - "can-jquery": "^3.2.0", - "can-test-helpers": "^1.1.0", - "detect-cyclic-packages": "^1.1.0", + "can-vdom": "^4.0.1", "jshint": "^2.9.1", "steal": "^2.2.1", - "steal-benchmark": "0.0.1", "steal-qunit": "^2.0.0", "steal-tools": "^2.2.1", "testee": "^0.9.0" }, - "directories": { - "test": "test" - }, - "homepage": "https://canjs.com/doc/can-reflect-promise.html", + "homepage": "http://canjs", "keywords": [ "canjs", - "canjs-plugin", - "donejs" + "donejs", + "donejs-plugin" ], "license": "MIT", - "main": "can-reflect-promise", - "name": "can-reflect-promise", + "main": "can-fragment", + "name": "can-fragment", "repository": { "type": "git", - "url": "git://github.com/canjs/can-reflect-promise.git" + "url": "git://github.com/canjs/can-fragment.git" }, "scripts": { - "detect-cycle": "detect-cyclic-packages --ignore done-serve", + "build": "node build.js", "develop": "done-serve --static --develop --port 8080", - "jshint": "jshint *.js --config", - "postpublish": "git push --tags && git push", - "preversion": "npm test", + "jshint": "jshint ./*.js --config", + "postpublish": "git push --tags && git checkout master && git branch -D release && git push", + "preversion": "npm test && npm run build", "release:major": "npm version major && npm publish", "release:minor": "npm version minor && npm publish", "release:patch": "npm version patch && npm publish", - "release:pre": "npm version prerelease && npm publish --tag pre", - "test": "npm run detect-cycle && npm run jshint && npm run testee", - "testee": "testee test/test.html --browsers firefox" + "test": "npm run jshint && npm run testee", + "testee": "testee test.html --browsers firefox", + "version": "git commit -am \"Update version number\" && git checkout -b release && git add -f dist/" }, - "system": { + "steal": { "configDependencies": [ "live-reload" ], - "npmAlgorithm": "flat" + "npmIgnore": [ + "testee", + "generator-donejs", + "donejs-cli", + "steal-tools" + ] }, - "version": "2.2.1" + "version": "1.3.1" }, "signatures": [ { - "code": "canReflectPromise(promise)", - "description": "\n\nIf `promise` is an instance of a Promise type (either provided natively by the platform or by a polyfill library), the prototype\nof the Promise type is decorated with [can-symbol] symbols for `@@can.onKeyValue`, `@@can.offKeyValue`,\n`@@can.getKeyValue`, `@@can.onValue`, and `@@can.offValue`, which allow it to be used like an observable Map-like in \nreflection.\n\nThen `promise` and all future instances of `promise.constructor` will be initialized on first access to have the following keys\navailable through [can-symbol/symbols/getKeyValue @@can.getKeyValue]:\n\n* \"state\" -- one of \"pending\", \"resolved\", or \"rejected\"\n* \"isPending\" -- true if the promise neither resolved nor rejected, false otherwise.\n* \"isResolved\" -- true if the promise is resolved, false otherwise.\n* \"isRejected\" -- true if the promise is rejected, false otherwise.\n* \"value\" -- the resolved value of the promise if resolved, otherwise undefined.\n* \"reason\" -- the rejected value of the promise if rejected, otherwise undefined.\n\n> Note that, due to native Promises' lack of inspection, it is impossible to tell whether a Promise is resolved or rejected \nwithout using `.then()`. If the Promise is Promises/A+ compliant, then at the time the Promise is initialized by \n`can-reflect-promise`, `isPending` will always be true, even if \nthe Promise has already resolved, and will remain so during synchronous execution. On the next tick, the state will update to \n`resolved`/`rejected` if the Promise has already updated its state. The best strategy for ensuring a proper read of a resolved\nvalue or rejected reason is to listen for the change in state or \nvalue with [can-symbol/symbols/onKeyValue @@can.onKeyValue] immediately after creating a Promise.\n\nIn the cases where `promise` is a plain object (e.g. if it is a `jQuery.Deferred`), the symbols will be applied to `promise`\nitself, not to the proto.\n\n```\nvar p = new Promise(function(resolve) {\n\tsetTimeout(resolve.bind(null, \"a\"), 10);\n});\n\ncanReflectPromise(p);\n\ncanReflect.getKeyValue(p, \"isPending\"); // -> true\n\nsetTimeout(function() {\n\tcanReflect.getKeyValue(p, \"isResolved\"); // -> true\n\tcanReflect.getKeyValue(p, \"value\"); // -> \"a\"\n}, 20);\n```\n", + "code": "fragment(item, doc)", + "description": "\n", "params": [ { "types": [ { - "type": "Promise" + "type": "String" + }, + { + "type": "HTMLElement" + }, + { + "type": "documentFragment" + }, + { + "type": "contentArray" } ], - "name": "promise", - "description": "any Promise, Promise-like, or thenable.\n" - } - ] - } - ], - "_curParam": { + "name": "item", + "description": "" + }, + { + "types": [ + { + "type": "Document" + } + ], + "name": "doc", + "description": "an optional DOM document in which to build the fragment\n" + } + ], + "returns": { + "types": [ + { + "type": "documentFragment" + } + ], + "description": "\n" + } + } + ], + "_curParam": { "types": [ { - "type": "Promise" + "type": "Document" } ], - "name": "promise", - "description": "any Promise, Promise-like, or thenable.\n" - } - }, - "can-route-pushstate.prototype": { - "name": "can-route-pushstate.prototype", - "title": "prototype", - "type": "group", - "parent": "can-route-pushstate", - "description": "", - "order": 0 - }, - "can-route-pushstate": { - "src": { - "path": "node_modules/can-route-pushstate/can-route-pushstate.md" + "name": "doc", + "description": "an optional DOM document in which to build the fragment\n" }, - "body": "\n## Use\n\n__can-route-pushstate__ exports an observable that can be used with [can-route]. To start using can-route-pushstate set the [can-route.urlData] property:\n\n```js\nimport { route, RoutePushstate } from \"can\";\n\nroute.urlData = new RoutePushstate();\n```\n\n### Creating and changing routes\n\nTo create routes use [can-route.register] like:\n\n```js\nroute.urlData = new RoutePushstate();\n\nroute.register( \"{page}\", { page: \"homepage\" } );\nroute.register( \"contacts/{username}\" );\nroute.register( \"books/{genre}/{author}\" );\n\nroute.start(); // Initializes can-route\n```\n\nDo not forget to [can-route.start initialize] can-route after creating all routes, do it by calling `route.start()`.\n\n### Listening changes on matched route\n\nAs can-route contains a map that represents `window.location.pathname`, you can bind on it.\n\nTo bind to specific attributes on [can-route] you can listen to your viewModel's property changes (`viewModel.on()` if using [can-define/map/map]).\n\n### Using different pathname root\n\ncan-route-pushstate has one additional property, [can-route-pushstate.prototype.root], which specifies the part of that pathname that should not change. For example, if we only want to have pathnames within `http://example.com/contacts/`, we can specify a root like:\n\n```js\nroute.urlData = new RoutePushstate();\nroute.urlData.root = \"/contacts/\";\nroute.register( \"{page}\" );\nroute.url( { page: \"list\" } ); //-> \"/contacts/list\"\nroute.url( { foo: \"bar\" } ); //-> \"/contacts/?foo=bar\"\n```\n\nNow, all routes will start with `\"/contacts/\"`. The default `route.urlData.root` value is `\"/\"`.\n\n### Updating the current route\n\ncan-route-pushstate also allows changes to the current route state without creating a new history entry. This behavior can be controlled using the `replaceStateOn`, `replaceStateOff`, and `replaceStateOnce` methods.\n\nEnable the behavior by calling `replaceStateOn` with specified route property keys like:\n\n```js\nconst push = new RoutePushstate();\nroute.urlData = push;\npush.replaceStateOn( \"page\", \"action\" );\nroute.set( \"page\", \"dashboard\" ); // Route changes, no new history record\n```\n\nTo return back to normal, call `replaceStateOff` with the specified route property keys like:\n\n```js\npush.replaceStateOff( \"action\" );\nroute.set( \"action\", \"remove\" ); // Route changes, new history record is created\n```\n\nThe behavior can be configured to occur only once for a specific property using `replaceStateOnce` like:\n\n```js\npush.replaceStateOnce( \"page\" );\nroute.set( \"page\", \"dashboard\" ); // No new history record\nroute.set( \"page\", \"search\" ); // New history record is created\n```\n\n\n## Planning route structure\n\nComplications can arise if your route structure mimics the folder structure inside your app's public directory. For example, if you have a folder structure like the one in this url for your admin app...\n\n`/admin/users/list.js`\n\n... using a route of /admin/users on the same page that uses the list.js file will require the use of a trailing slash on all routes and links. The browser already learned that '/admin/users' is folder. Because folders were originally denoted by a trailing slash in a url, the browser will correct the url to be '/admin/users/'. While it is possible to add the trailing slash in routes and listen for them, any link to the page that omits the trailing slash will not trigger the route handler.\n\n", - "description": "An observable that can be used as [can-route]'s [can-route.urlData]. \n\n", - "type": "module", - "title": "", - "types": [ - { - "type": "RoutePushstate", - "description": "\n\n__can-route-pushstate__ exports a `RoutePushstate` constructor function that configure [can-route] to use\n[pushstate](https://developer.mozilla.org/en-US/docs/Web/Guide/API/DOM/Manipulating_the_browser_history)\nto change the window's [pathname](https://developer.mozilla.org/en-US/docs/Web/API/URLUtils.pathname) instead\nof the [hash](https://developer.mozilla.org/en-US/docs/Web/API/URLUtils.hash)\n" - } - ], - "name": "can-route-pushstate", - "parent": "can-routing", - "collection": "can-core", - "package": { - "author": { - "name": "Bitovi", - "email": "contact@bitovi.com", - "url": "http://bitovi.com" - }, - "bugs": { - "url": "https://github.com/canjs/can-route-pushstate/issues" - }, - "bundleDependencies": false, - "dependencies": { - "can-diff": "<2.0.0", - "can-dom-events": "^1.1.0", - "can-globals": "<2.0.0", - "can-observation-recorder": "^1.0.2", - "can-reflect": "^1.8.0", - "can-route": "^4.3.12", - "can-simple-observable": "^2.0.0", - "can-symbol": "^1.6.3" - }, - "deprecated": false, - "description": "Pushstate for can-route", - "devDependencies": { - "can-assign": "<2.0.0", - "can-define": "^2.6.0", - "can-map": "^4.0.0", - "can-queues": "^1.2.1", - "detect-cyclic-packages": "^1.1.0", - "docco": "^0.8.0", - "jshint": "^2.9.1", - "steal": "^2.1.4", - "steal-qunit": "^2.0.0", - "steal-tools": "^2.0.6", - "testee": "^0.9.0" - }, - "homepage": "https://canjs.com/doc/can-route-pushstate.html", - "keywords": [ - "canjs", - "canjs-plugin", - "donejs" + "_curReturn": { + "types": [ + { + "type": "documentFragment" + } ], - "main": "can-route-pushstate", - "name": "can-route-pushstate", - "repository": { - "type": "git", - "url": "git://github.com/canjs/can-route-pushstate.git" - }, - "scripts": { - "build": "node build.js", - "detect-cycle": "detect-cyclic-packages --ignore done-serve", - "jshint": "jshint ./*.js --config", - "postpublish": "git push --tags && git push", - "preversion": "npm test", - "release:major": "npm version major && npm publish", - "release:minor": "npm version minor && npm publish", - "release:patch": "npm version patch && npm publish", - "release:pre": "npm version prerelease && npm publish --tag=pre", - "test": "npm run detect-cycle && npm run jshint && npm run testee", - "testee": "testee test/test.html --browsers firefox" - }, - "version": "5.0.13" + "description": "\n" }, "comment": " " }, - "can-route-mock": { - "src": { - "path": "node_modules/can-route-mock/can-route-mock.md" - }, - "body": "\n## Use\n\nThe following sets up a `RouteMock` as [can-route.urlData]. Notice that as the\n`routeMock` value changes, so does the `routeData`.\n\n```js\nimport {route, RouteMock, DefineMap} from \"can\";\n\n// route.data will update routeMock and be updated by changes in\n// routeMock.\nvar routeMock = route.urlData = new RouteMock();\nvar routeData = route.data = new DefineMap({},false);\n\n// begin binding\nroute.start();\n\n// simulate setting the URL\nrouteMock.value = \"foo=bar\";\n\nconsole.log( routeData.foo ) //-> \"bar\";\n```\n
    \n\n", - "description": "Simulate routing without having to change the URL. \n", + "can-global": { + "body": "", + "description": "", "type": "module", - "title": "", + "title": "can-global", "types": [ { - "type": "RouteMock", - "description": "\n\nThe `can-route-mock` package exports a `RouteMock` constructor function that\nsimulates the same behavior as the [can-route-hash RouteHash] constructor function.\n\n```js\nimport { RouteMock } from \"can\";\n\nvar routeMock = new RouteMock();\nrouteMock.value //-> \"\"\n\nrouteMock.value = \"#foo/bar\";\n\nrouteMock.value //-> \"foo/bar\";\n```\n\nAs shown above, instances of `RouteMock` support `.value` to get and set values. Also,\ninstances of `RouteMock` implement the common `ValueObservable` symbols:\n\n- [can-reflect.getValue] - `canReflect.getValue( routeMock )`\n- [can-reflect.setValue] - `canReflect.setValue( routeMock, \"foo=bar\" )`\n- [can-reflect/observe.onValue] - `canReflect.onValue( routeMock, handler(newValue, oldValue) )`\n- [can-reflect/observe.offValue] - `canReflect.offValue( routeMock, handler )`\n\n\n" + "type": "function", + "returns": { + "types": [ + { + "type": "undefined" + } + ] + }, + "params": [] } ], - "name": "can-route-mock", - "parent": "can-routing", - "collection": "can-ecosystem", - "package": { - "author": { - "name": "DoneJS Core Team", - "email": "core@donejs.com", - "url": "http://donejs.com" - }, - "bugs": { - "url": "https://github.com/canjs/can-route-mock/issues" - }, - "bundleDependencies": false, - "dependencies": { - "can-reflect": "^1.16.7", - "can-simple-observable": "^2.1.1" - }, - "deprecated": false, - "description": "a fake url for routing", - "devDependencies": { - "jshint": "^2.9.1", - "steal": "^2.2.1", - "steal-qunit": "^2.0.0", - "steal-tools": "^2.2.1", - "testee": "^0.9.0" - }, - "homepage": "http://canjs.com", - "keywords": [ - "canjs", - "donejs", - "donejs-plugin" - ], - "license": "MIT", - "main": "can-route-mock.js", - "name": "can-route-mock", - "repository": { - "type": "git", - "url": "git://github.com/canjs/can-route-mock.git" - }, - "scripts": { - "develop": "done-serve --static --develop --port 8080", - "jshint": "jshint ./*.js --config", - "postpublish": "git push --tags && git push", - "preversion": "npm test", - "release:major": "npm version major && npm publish", - "release:minor": "npm version minor && npm publish", - "release:patch": "npm version patch && npm publish", - "test": "npm run jshint && npm run testee", - "testee": "testee test.html --browsers firefox" - }, - "version": "1.0.2" - }, - "comment": " ", - "codepen": [ - [ - "\"can\"", - "\"//unpkg.com/can@5/core.mjs\"" - ], - [ - "\"can/everything\"", - "\"//unpkg.com/can@5/everything.mjs\"" - ], - [ - "\"can/demos/technology-overview/mock-url\"", - "\"//unpkg.com/mock-url@^5.0.0/mock-url.mjs\"" - ], - [ - "\"can/demos/technology-overview/route-mini-app-components\"", - "\"//unpkg.com/route-mini-app@^5.0.0/components.mjs\"" - ], - [ - "return steal.import(", - "return import(" - ], - [ - "\"can/demos/technology-overview/page-login\"", - "\"//unpkg.com/route-mini-app@^5.0.0/page-login.mjs\"" - ], - [ - "`can/demos/technology-overview/page-${this.page}`", - "`//unpkg.com/route-mini-app@^5.0.0/page-${this.page}.mjs`" - ] - ] - }, - "can-simple-dom": { - "src": { - "path": "node_modules/can-simple-dom/can-simple-dom.md" - }, - "body": "\nImplements a small subset of the WHATWG DOM specification.\n\n", - "description": "\n# can-simple-dom\n", - "name": "can-simple-dom", - "type": "page", - "hide": true - }, - "can-route-hash": { - "src": { - "path": "node_modules/can-route-hash/can-route-hash.md" - }, - "body": "\n\n## Use\n\nAs `can-route-hash` is the default routing observable used by [can-route], it's typically not\nused directly. Instead it's often replaced by [can-route-mock] for testing, or replaces\n[can-route-pushstate] when hashchange based routing would be preferable.\n\nIf [can-route-pushstate] is being used, but it would be useful to switch to hashchange-based routing, you can\ntypically map the `can-route-pushstate` package to `can-route-hash`. This is often done with StealJS as follows:\n\n```js\n\n\n```\n\n", - "description": "An observable that is cross bound to the window.location.hash. \n", - "type": "module", - "title": "", - "types": [ + "name": "can-global", + "parent": "can-infrastructure", + "signatures": [ { - "type": "RouteHash", - "description": "\n\nThe `can-route-hash` package exports a `RouteHash` constructor function. Instances of\n`RouteHash` are two-way bound to the `window.location.hash` once the instances have a listener.\n\n```js\nimport { RouteHash, Reflect } from \"can\";\n\nvar routeHash = new RouteHash();\n\nwindow.location.hash = \"#!foo\";\n\n// You must listen on the routeHash before it\n// begins listening for hashchanges\nReflect.onValue( routeHash, function(){});\n\n// changing the hash updates the observable value\nwindow.location.hash = \"#!bar\";\nrouteHash.value //-> \"bar\"\n\n// changing the observable value updates the hash\nrouteHash.value = \"zed\";\nwindow.location.hash = \"#!zed\";\n```\n\nAs shown above, instances of `RouteHash` support `.value` to get and set values. Also,\ninstances of `RouteHash` implement the common `ValueObservable` symbols:\n\n- [can-reflect.getValue] - `canReflect.getValue( routeHash )`\n- [can-reflect.setValue] - `canReflect.setValue( routeHash, \"foo=bar\" )`\n- [can-reflect/observe.onValue] - `canReflect.onValue( routeHash, handler(newValue, oldValue) )`\n- [can-reflect/observe.offValue] - `canReflect.offValue( routeHash, handler )`\n\n" + "code": "GLOBAL()", + "description": "\n\nReturns the global that this environment provides. It will be one of:\n\n* **Browser**: `window`\n* **Web Worker**: `self`\n* **Node.js**: `global`\n\n```js\nvar GLOBAL = require(\"can-global\");\n\nvar g = GLOBAL();\n\n// In a browser\nconsole.log(g === window); // -> true\n```\n", + "params": [], + "returns": { + "types": [ + { + "type": "Object", + "options": [] + } + ], + "description": "The global object for this JavaScript environment.\n" + } } ], - "name": "can-route-hash", - "parent": "can-routing", - "collection": "can-infrastructure", - "package": { - "author": "", - "bundleDependencies": false, - "dependencies": { - "can-dom-events": "^1.2.0", - "can-globals": "^1.1.1", - "can-key-tree": "^1.1.0", - "can-observation-recorder": "^1.1.2", - "can-queues": "^1.1.2", - "can-reflect": "^1.16.7", - "can-simple-observable": "^2.1.1" - }, - "deprecated": false, - "description": "[![Join our Slack](https://img.shields.io/badge/slack-join%20chat-611f69.svg)](https://www.bitovi.com/community/slack?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![Join our Discourse](https://img.shields.io/discourse/https/forums.bitovi.com/posts.svg)](https://forums.bitovi.com/?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/canjs/can-route-hash/blob/master/LICENSE) [![npm version](https://badge.fury.io/js/can-route-hash.svg)](https://www.npmjs.com/package/can-route-hash) [![Travis build status](https://travis-ci.org/canjs/can-route-hash.svg?branch=master)](https://travis-ci.org/canjs/can-route-hash) [![Greenkeeper badge](https://badges.greenkeeper.io/canjs/can-route-hash.svg)](https://greenkeeper.io/)", - "devDependencies": { - "can-observation": "^4.0.1", - "jshint": "^2.9.5", - "steal": "^2.2.1", - "steal-qunit": "^2.0.0", - "steal-tools": "^2.2.1", - "testee": "^0.9.0" - }, - "homepage": "", - "keywords": [ - "donejs-plugin" + "_curReturn": { + "types": [ + { + "type": "Object", + "options": [] + } ], - "license": "MIT", - "main": "./can-route-hash.js", - "name": "can-route-hash", - "repository": { - "type": "git", - "url": "git://github.com//can-route-hash.git" - }, - "scripts": { - "develop": "done-serve --static --develop --port 8080", - "jshint": "jshint ./*.js --config", - "postpublish": "git push --tags && git push", - "preversion": "npm test", - "release:major": "npm version major && npm publish", - "release:minor": "npm version minor && npm publish", - "release:patch": "npm version patch && npm publish", - "test": "npm run jshint && npm run testee", - "testee": "testee test.html --browsers firefox" - }, - "version": "1.0.2" - }, - "comment": " " + "description": "The global object for this JavaScript environment.\n" + } }, - "can-simple-observable": { - "type": "module", - "name": "can-simple-observable", - "parent": "can-observables", + "define": { + "type": "function", + "name": "define", + "parent": "can-globals/methods", "src": { - "line": 10, - "codeLine": 46, - "path": "node_modules/can-simple-observable/can-simple-observable.js" + "line": 21, + "codeLine": 75, + "path": "node_modules/can-globals/can-globals-proto.js" }, - "body": "\n## Use\n\n```js\n var obs = new SimpleObservable('one');\n\n canReflect.getValue(obs); // -> \"one\"\n\n canReflect.setValue(obs, 'two');\n canReflect.getValue(obs); // -> \"two\"\n\n function handler(newValue) {\n // -> \"three\"\n };\n canReflect.onValue(obs, handler);\n canReflect.setValue(obs, 'three');\n\n canReflect.offValue(obs, handler);\n```\n\n", - "description": "Create an observable value. \n", + "body": "\n", + "description": "\nCreate a new global environment variable.\n", "title": "", - "types": [ + "signatures": [ { - "type": "function", + "code": "globals.define(key, value[, cache])", + "description": "\n\nDefines a new global called `key`, who's value defaults to `value`.\n\nThe following example defines the `global` key's default value to the [`window`](https://developer.mozilla.org/en-US/docs/Web/API/Window) object:\n```javascript\nglobals.define('global', window);\nglobals.getKeyValue('window') //-> window\n```\n\nIf a function is provided and `cache` is falsy, that function is run every time the key value is read:\n```javascript\nglobals.define('isBrowserWindow', function() {\n console.log('EVALUATING')\n return typeof window !== 'undefined' &&\n typeof document !== 'undefined' && typeof SimpleDOM === 'undefined'\n}, false);\nglobals.get('isBrowserWindow') // logs 'EVALUATING'\n // -> true\nglobals.get('isBrowserWindow') // logs 'EVALUATING' again\n // -> true\n```\n\nIf a function is provided and `cache` is truthy, that function is run only the first time the value is read:\n```javascript\nglobals.define('isWebkit', function() {\n console.log('EVALUATING')\n var div = document.createElement('div')\n return 'WebkitTransition' in div.style\n})\nglobals.getKeyValue('isWebkit') // logs 'EVALUATING'\n\t\t\t\t\t\t\t\t // -> true\nglobals.getKeyValue('isWebkit') // Does NOT log again!\n\t\t\t\t\t\t\t\t // -> true\n```\n", + "params": [ + { + "types": [ + { + "type": "String" + } + ], + "name": "key", + "description": "\nThe key value to create.\n" + }, + { + "types": [ + { + "type": "*" + } + ], + "name": "value", + "description": "\nThe default value. If this is a function, its return value will be used.\n" + }, + { + "types": [ + { + "type": "Boolean" + } + ], + "optional": true, + "name": "cache", + "defaultValue": "true", + "description": "\nEnable cache. If false the `value` function is run every time the key value is read.\n" + } + ], "returns": { "types": [ { - "type": "undefined" + "type": "can-globals" } - ] - }, - "params": [] + ], + "description": "\nReturns the instance of `can-globals` for chaining.\n" + } } ], - "collection": "can-infrastructure", - "package": { - "author": { - "name": "Bitovi", - "email": "contact@bitovi.com", - "url": "https://www.bitovi.com/" - }, - "bugs": { - "url": "https://github.com/canjs/can-simple-observable/issues" - }, - "bundleDependencies": false, - "dependencies": { - "can-event-queue": "^1.0.0", - "can-key": "<2.0.0", - "can-key-tree": "^1.0.0", - "can-log": "^1.0.0", - "can-namespace": "1.0.0", - "can-observation": "^4.1.0", - "can-observation-recorder": "^1.0.0", - "can-queues": "^1.0.0", - "can-reflect": "^1.10.1", - "can-reflect-dependencies": "^1.0.0", - "can-symbol": "^1.4.2" - }, - "deprecated": false, - "description": "Create an observable value.", - "devDependencies": { - "can-simple-map": "^4.0.1", - "detect-cyclic-packages": "^1.1.0", - "jshint": "^2.9.1", - "steal": "^2.2.1", - "steal-qunit": "^2.0.0", - "steal-tools": "^2.2.1", - "testee": "^0.9.0" - }, - "homepage": "https://canjs.com/doc/can-simple-observable.html", - "keywords": [ - "canjs", - "donejs-plugin" + "_curParam": { + "types": [ + { + "type": "Boolean" + } ], - "license": "MIT", - "main": "can-simple-observable", - "name": "can-simple-observable", - "repository": { - "type": "git", - "url": "git://github.com/canjs/can-simple-observable.git" - }, - "scripts": { - "build": "node build.js", - "detect-cycle": "detect-cyclic-packages --ignore done-serve", - "jshint": "jshint ./*.js --config", - "postpublish": "git push --tags && git push", - "preversion": "npm test", - "release:major": "npm version major && npm publish", - "release:minor": "npm version minor && npm publish", - "release:patch": "npm version patch && npm publish", - "release:pre": "npm version prerelease && npm publish --tag pre", - "test": "npm run detect-cycle && npm run jshint && npm run testee", - "testee": "testee test.html --browsers firefox" - }, - "steal": { - "npmIgnore": [ - "testee", - "steal-tools" - ] - }, - "version": "2.4.2" + "optional": true, + "name": "cache", + "defaultValue": "true", + "description": "\nEnable cache. If false the `value` function is run every time the key value is read.\n" + }, + "_curReturn": { + "types": [ + { + "type": "can-globals" + } + ], + "description": "\nReturns the instance of `can-globals` for chaining.\n" + } + }, + "getKeyValue": { + "type": "function", + "name": "getKeyValue", + "parent": "can-globals/methods", + "src": { + "line": 89, + "codeLine": 110, + "path": "node_modules/can-globals/can-globals-proto.js" }, + "body": "\n", + "description": "\nGet a global environment variable by name.\n", + "title": "", "signatures": [ { - "code": "new SimpleObservable(initialValue)", - "description": "\n\nCreates an observable value that can be read, written, and observed using [can-reflect].\n", + "code": "globals.getKeyValue(key)", + "description": "\n\nReturns the current value at `key`. If no value has been set, it will return the default value (if it is not a function). If the default value is a function, it will return the output of the function. This execution is cached if the cache flag was set on initialization.\n\n```javascript\nglobals.define('foo', 'bar');\nglobals.getKeyValue('foo'); //-> 'bar'\n```\n", "params": [ { "types": [ { - "type": "*" + "type": "String" } ], - "name": "initialValue", - "description": "The initial value of the observable.\n" + "name": "key", + "description": "\nThe key value to access.\n" } ], "returns": { "types": [ { - "type": "can-simple-observable" + "type": "*" } ], - "description": "An observable instance\n" + "description": "\nReturns the value of a given key.\n" } } ], "_curParam": { "types": [ { - "type": "*" + "type": "String" } ], - "name": "initialValue", - "description": "The initial value of the observable.\n" + "name": "key", + "description": "\nThe key value to access.\n" }, "_curReturn": { "types": [ { - "type": "can-simple-observable" + "type": "*" } ], - "description": "An observable instance\n" - }, - "comment": " " + "description": "\nReturns the value of a given key.\n" + } }, - "can-sort-object": { + "offKeyValue": { + "type": "function", + "name": "offKeyValue", + "parent": "can-globals/methods", "src": { - "path": "node_modules/can-sort-object/can-sort-object.md" - }, - "body": "\nSort object keys recursively\n\n", - "description": "\n# can-sort-object\n", - "name": "can-sort-object", - "type": "page" - }, - "can-single-reference": { - "src": { - "path": "node_modules/can-single-reference/can-single-reference.md" - }, - "body": "\nAssign a value to a function that can be collected later\n\n", - "description": "\n# can-single-reference\n", - "name": "can-single-reference", - "type": "page" - }, - "can-stache-ast": { - "src": { - "path": "node_modules/can-stache-ast/can-stache-ast.md" - }, - "body": "\n\n\n", - "description": "\n# can-stache-ast\n", - "name": "can-stache-ast", - "type": "page" - }, - "can-stache-key": { - "src": { - "path": "node_modules/can-stache-key/can-stache-key.md" - }, - "body": "\nRead and write keys on a value\n\n", - "description": "\n# can-stache-key\n", - "name": "can-stache-key", - "type": "page", - "hide": true - }, - "can-super-model": { - "src": { - "path": "node_modules/can-super-model/can-super-model.md" + "line": 149, + "codeLine": 179, + "path": "node_modules/can-globals/can-globals-proto.js" }, "body": "\n", - "description": "Connect a type to a restful data source, automatically manage lists, combine requests, and use a fall-through localstorage cache.\n\n", - "type": "module", + "description": "\nRemove handler from event queue.\n", "title": "", - "types": [ - { - "type": "function", - "returns": { - "types": [ - { - "type": "undefined" - } - ] - }, - "params": [] - } - ], - "name": "can-super-model", - "parent": "can-data-modeling", - "collection": "can-ecosystem", - "package": { - "author": { - "name": "DoneJS Core Team", - "email": "core@donejs.com", - "url": "http://donejs.com" - }, - "bugs": { - "url": "https://github.com/canjs/can-super-model/issues" - }, - "bundleDependencies": false, - "dependencies": { - "can-connect": "^3.0.0", - "can-define": "^2.2.0", - "can-globals": "^1.0.1", - "can-namespace": "^1.0.0", - "can-query-logic": "<2.0.0", - "can-reflect": "^1.15.2" - }, - "deprecated": false, - "description": "A real-time, fall-through caching, data model layer", - "devDependencies": { - "can-fixture": "^3.0.0", - "jshint": "^2.9.1", - "steal": "^2.2.1", - "steal-qunit": "^2.0.0", - "steal-tools": "^2.2.1", - "testee": "^0.9.0" - }, - "homepage": "http://canjs.com", - "keywords": [ - "canjs", - "donejs", - "donejs-plugin" - ], - "license": "MIT", - "main": "can-super-model", - "name": "can-super-model", - "repository": { - "type": "git", - "url": "git://github.com/canjs/can-super-model.git" - }, - "scripts": { - "build": "node build.js", - "develop": "done-serve --static --develop --port 8080", - "jshint": "jshint ./*.js --config", - "postpublish": "git push --tags && git checkout master && git branch -D release && git push", - "preversion": "npm test && npm run build", - "release:major": "npm version major && npm publish", - "release:minor": "npm version minor && npm publish", - "release:patch": "npm version patch && npm publish", - "test": "npm run jshint && npm run testee", - "testee": "testee test.html --browsers firefox", - "version": "git commit -am \"Update version number\" && git checkout -b release && git add -f dist/" - }, - "steal": { - "main": "can-super-model", - "npmIgnore": [ - "testee", - "generator-donejs", - "donejs-cli", - "steal-tools" - ] - }, - "version": "1.1.1" - }, - "outline": { - "depth": 2 - }, "signatures": [ { - "code": "superModel(options)", - "description": "\n\n`superModel` an advanced data model that CanJS applications can\nuse. It requires a properly configured [can-query-logic] which experimenters might\nfind cumbersome to configure. If you are experimenting with CanJS, or have a\nvery irregular service layer, [can-rest-model] might be a better fit. If you don't need\nor want caching, use [can-realtime-rest-model]. `superModel` adds the following to [can-realtime-rest-model]:\n\n- [can-connect/fall-through-cache/fall-through-cache] - Saves all data in [localStorage](https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage). Uses the data\nin localStorage to present data to the user immediately, but still makes the request and updates\nthe user presented data and localStorage data in the background.\n- [can-connect/data/combine-requests/combine-requests] - Combines multiple request made at approximately the same time into a single request. \n- [can-connect/can/ref/ref] - Reference types that make relationships easier.\n\nIf your service layer matches what `superModel` expects, configuring\n`superModel` is very simple. For example,\nthe following defines a `Todo` and `TodoList` type and extends them\nwith the ability to connect to a restful service layer:\n\n```js\nimport {DefineMap, DefineList, superModel} from \"can\";\n\nconst Todo = DefineMap.extend(\"Todo\",{\n id: {identity: true},\n name: \"string\",\n complete: \"boolean\"\n})\n\nconst TodoList = DefineList.extend(\"TodoList\",{\n get completeCount(){\n return this.filter({complete: true}).length;\n }\n})\n\nconst todoConnection = superModel({\n Map: Todo,\n List: TodoList,\n url: \"/todos/{id}\"\n});\n```\n", + "code": "globals.offKeyValue(key, handler)", + "description": "\n\nRemoves `handler` from future change events for `key`.\n\n\n```javascript\nvar handler = (value) => {\n value === 'baz' //-> true\n};\nglobals.define('foo', 'bar');\nglobals.onKeyValue('foo', handler);\nglobals.setKeyValue('foo', 'baz');\nglobals.offKeyValue('foo', handler);\n```\n", "params": [ { "types": [ { - "type": "Object", - "options": [] + "type": "String" } ], - "name": "options", - "description": "Configuration options supported by all the mixed-in behaviors:\n\n- [can-connect/can/map/map._Map] - The map type constructor function used to create\n instances of the raw record data retrieved from the server.\n The type will also be decorated\n with the following methods:\n - [can-connect/can/map/map.getList]\n - [can-connect/can/map/map.get]\n - [can-connect/can/map/map.prototype.save]\n - [can-connect/can/map/map.prototype.destroy]\n - [can-connect/can/map/map.prototype.isSaving]\n - [can-connect/can/map/map.prototype.isDestroying]\n - [can-connect/can/map/map.prototype.isNew]\n\n- [can-connect/can/map/map._List] - The list type constructor function used to create\n a list of instances of the raw record data retrieved from the server. _\n- [can-connect/data/url/url.url] - Configure the URLs used to create, retrieve, update and\n delete data. It can be configured with a single url like:\n\n ```js\n url: \"/services/todos/{_id}\"\n ```\n\n Or an object that configures how to create, retrieve, update and delete individually:\n\n ```js\n url: {\n getListData: \"GET /services/todos\",\n getData: \"GET /services/todo/{id}\",\n createData: \"POST /services/todo\",\n updateData: \"PUT /services/todo/{id}\",\n destroyData: \"DELETE /services/todo/{id}\"\n }\n ```\n- [can-connect/data/url/url.ajax] - Specify a method to use to make requests. [can-ajax] is used by default. But jQuery's `.ajax` method can be passed.\n- [can-connect/data/parse/parse.parseInstanceProp] - Specify the property to find the data that represents an instance item.\n- [can-connect/data/parse/parse.parseInstanceData] - Returns the properties that should be used to\n [can-connect/constructor/constructor.hydrateInstance make an instance]\n given the results of [can-connect/connection.getData], [can-connect/connection.createData],\n [can-connect/connection.updateData],\n and [can-connect/connection.destroyData].\n- [can-connect/data/parse/parse.parseListProp] Specify the property to find the list data within a `getList` response.\n- [can-connect/data/parse/parse.parseListData] Return the correctly formatted data for a `getList` response.\n- [can-connect/base/base.queryLogic] - Specify the identity properties of the\n type. This is built automatically from the `Map` if [can-define/map/map] is used.\n" - } - ], - "returns": { - "types": [ - { - "type": "connection" - } - ], - "description": "A connection that is the combination of the options and all the behaviors\nthat `superModel` adds.\n" - } - }, - { - "code": "superModel(url)", - "description": "\n\nCreate a connection with just a url. Use this if you do not need to pass in any other `options` to configure the connection.\n\nFor example, the following creates a `Todo` type with the ability to connect to a restful service layer:\n\n```js\nimport {todoFixture} from \"//unpkg.com/can-demo-models@5\";\nimport {superModel} from \"can\";\n\n// Creates a mock backend with 5 todos\ntodoFixture(5);\n\nconst Todo = superModel(\"/api/todos/{id}\").Map;\n\n// Prints out all todo names\nTodo.getList().then(todos => {\n todos.forEach(todo => {\n console.log(todo.name);\n })\n})\n```\n
    \n\n", - "params": [ + "name": "key", + "description": "\nThe key value to observe.\n" + }, { "types": [ { - "type": "String" + "type": "function", + "returns": { + "types": [ + { + "type": "undefined" + } + ] + }, + "params": [ + { + "optional": true, + "name": "value" + } + ] } ], - "name": "url", - "description": "The [can-connect/data/url/url.url] used to create, retrieve, update and\n delete data.\n" + "name": "handler", + "description": "\nThe observer callback.\n" } ], "returns": { "types": [ { - "type": "connection" + "type": "can-globals" } ], - "description": "A connection that is the combination of the options and all the behaviors\nthat `superModel` adds. The `connection` includes a `Map` property which is the type\nconstructor function used to create instances of the raw record data retrieved from the server.\n\n" + "description": "\nReturns the instance of `can-globals` for chaining.\n" } } ], - "_curReturn": { + "_curParam": { "types": [ { - "type": "connection" + "type": "function", + "returns": { + "types": [ + { + "type": "undefined" + } + ] + }, + "params": [ + { + "optional": true, + "name": "value" + } + ] } ], - "description": "A connection that is the combination of the options and all the behaviors\nthat `superModel` adds. The `connection` includes a `Map` property which is the type\nconstructor function used to create instances of the raw record data retrieved from the server.\n\n" + "name": "handler", + "description": "\nThe observer callback.\n" }, - "codepen": [ - [ - "\"can\"", - "\"//unpkg.com/can@5/core.mjs\"" - ], - [ - "\"can/everything\"", - "\"//unpkg.com/can@5/everything.mjs\"" - ], - [ - "\"can/demos/technology-overview/mock-url\"", - "\"//unpkg.com/mock-url@^5.0.0/mock-url.mjs\"" - ], - [ - "\"can/demos/technology-overview/route-mini-app-components\"", - "\"//unpkg.com/route-mini-app@^5.0.0/components.mjs\"" - ], - [ - "return steal.import(", - "return import(" - ], - [ - "\"can/demos/technology-overview/page-login\"", - "\"//unpkg.com/route-mini-app@^5.0.0/page-login.mjs\"" - ], - [ - "`can/demos/technology-overview/page-${this.page}`", - "`//unpkg.com/route-mini-app@^5.0.0/page-${this.page}.mjs`" - ] - ], - "_curParam": { + "_curReturn": { "types": [ { - "type": "String" + "type": "can-globals" } ], - "name": "url", - "description": "The [can-connect/data/url/url.url] used to create, retrieve, update and\n delete data.\n" - }, - "comment": " " + "description": "\nReturns the instance of `can-globals` for chaining.\n" + } }, - "can-string.esc": { + "onKeyValue": { "type": "function", - "name": "can-string.esc", - "parent": "node_modules/can-string/can-string.js", + "name": "onKeyValue", + "parent": "can-globals/methods", "src": { - "line": 22, - "codeLine": 34, - "path": "node_modules/can-string/can-string.js" + "line": 190, + "codeLine": 217, + "path": "node_modules/can-globals/can-globals-proto.js" }, - "body": "", - "description": "", - "title": "esc", + "body": "\n", + "description": "\nAdd handler to event queue.\n", + "title": "", "signatures": [ { - "code": "string.esc(content)", - "description": "", + "code": "globals.onKeyValue(key, handler)", + "description": "\n\nCalls `handler` each time the value of `key` is set or reset.\n\n```javascript\nglobals.define('foo', 'bar');\nglobals.onKeyValue('foo', (value) => {\n value === 'baz' //-> true\n});\nglobals.setKeyValue('foo', 'baz');\n```\n", "params": [ { "types": [ @@ -6542,54 +6910,99 @@ "type": "String" } ], - "name": "content", - "description": "a string" + "name": "key", + "description": "\nThe key value to observe.\n" + }, + { + "types": [ + { + "type": "function", + "returns": { + "types": [ + { + "type": "undefined" + } + ] + }, + "params": [ + { + "types": [ + { + "type": "*" + } + ], + "optional": true, + "name": "value" + } + ] + } + ], + "name": "handler", + "description": "\nThe observer callback.\n" } ], "returns": { "types": [ { - "type": "String" + "type": "can-globals" } ], - "description": "the string safely HTML-escaped\n\n```js\nvar string = require(\"can-string\");\n\nstring.esc(\"
     
    \"); //-> \"<div>&nbsp;</div>\"\n```\n " + "description": "\nReturns the instance of `can-globals` for chaining.\n" } } ], "_curParam": { "types": [ { - "type": "String" + "type": "function", + "returns": { + "types": [ + { + "type": "undefined" + } + ] + }, + "params": [ + { + "types": [ + { + "type": "*" + } + ], + "optional": true, + "name": "value" + } + ] } ], - "name": "content", - "description": "a string" + "name": "handler", + "description": "\nThe observer callback.\n" }, "_curReturn": { "types": [ { - "type": "String" + "type": "can-globals" } ], - "description": "the string safely HTML-escaped\n\n```js\nvar string = require(\"can-string\");\n\nstring.esc(\"
     
    \"); //-> \"<div>&nbsp;</div>\"\n```\n " + "description": "\nReturns the instance of `can-globals` for chaining.\n" } }, - "can-string.capitalize": { + "deleteKeyValue": { "type": "function", - "name": "can-string.capitalize", - "parent": "node_modules/can-string/can-string.js", + "name": "deleteKeyValue", + "parent": "can-globals/methods", "src": { - "line": 42, - "codeLine": 55, - "path": "node_modules/can-string/can-string.js" + "line": 227, + "codeLine": 250, + "path": "node_modules/can-globals/can-globals-proto.js" }, - "body": "", - "description": "", - "title": "capitalize", + "body": "\n", + "description": "\nReset global environment variable.\n", + "title": "", "signatures": [ { - "code": "string.capitalize(s)", - "description": "", + "code": "globals.deleteKeyValue(key)", + "description": "\n\nDeletes the current value at `key`. Future `get`s will use the default value.\n\n```javascript\nglobals.define('global', window);\nglobals.setKeyValue('global', {});\nglobals.deleteKeyValue('global');\nglobals.getKeyValue('global') === window; //-> true\n```\n", "params": [ { "types": [ @@ -6597,17 +7010,17 @@ "type": "String" } ], - "name": "s", - "description": "the string to capitalize" + "name": "key", + "description": "\nThe key value to access.\n" } ], "returns": { "types": [ { - "type": "String" + "type": "can-globals" } ], - "description": "the supplied string with the first character uppercased if it is a letter\n\n```js\nvar string = require(\"can-string\");\n\nconsole.log(string.capitalize(\"foo\")); // -> \"Foo\"\nconsole.log(string.capitalize(\"123\")); // -> \"123\"\n```\n " + "description": "\nReturns the instance of `can-globals` for chaining.\n" } } ], @@ -6617,34 +7030,34 @@ "type": "String" } ], - "name": "s", - "description": "the string to capitalize" + "name": "key", + "description": "\nThe key value to access.\n" }, "_curReturn": { "types": [ { - "type": "String" + "type": "can-globals" } ], - "description": "the supplied string with the first character uppercased if it is a letter\n\n```js\nvar string = require(\"can-string\");\n\nconsole.log(string.capitalize(\"foo\")); // -> \"Foo\"\nconsole.log(string.capitalize(\"123\")); // -> \"123\"\n```\n " + "description": "\nReturns the instance of `can-globals` for chaining.\n" } }, - "can-string.camelize": { + "setKeyValue": { "type": "function", - "name": "can-string.camelize", - "parent": "node_modules/can-string/can-string.js", + "name": "setKeyValue", + "parent": "can-globals/methods", "src": { - "line": 60, - "codeLine": 73, - "path": "node_modules/can-string/can-string.js" + "line": 260, + "codeLine": 287, + "path": "node_modules/can-globals/can-globals-proto.js" }, - "body": "", - "description": "", - "title": "camelize", + "body": "\n", + "description": "\nOverwrite an existing global environment variable.\n", + "title": "", "signatures": [ { - "code": "string.camelize(s)", - "description": "", + "code": "globals.setKeyValue(key, value)", + "description": "\n\n```javascript\nglobals.define('foo', 'bar');\nglobals.setKeyValue('foo', 'baz');\nglobals.getKeyValue('foo'); //-> 'baz'\n```\n\nSets the new value at `key`. Will override previously set values, but preserves the default (see `deleteKeyValue`).\n\nSetting a key which was not previously defined will call `define` with the key and value.\n", "params": [ { "types": [ @@ -6652,109 +7065,112 @@ "type": "String" } ], - "name": "str", - "description": "the string to camelCase" + "name": "key", + "description": "\nThe key value to access.\n" + }, + { + "types": [ + { + "type": "*" + } + ], + "name": "value", + "description": "\nThe new value.\n" } ], "returns": { "types": [ { - "type": "String" + "type": "can-globals" } ], - "description": "the supplied string with hyphens removed and following letters capitalized.\n\n```js\nvar string = require(\"can-string\");\n\nconsole.log(string.camelize(\"foo-bar\")); // -> \"fooBar\"\nconsole.log(string.camelize(\"-webkit-flex-flow\")); // -> \"WebkitFlexFlow\"\n```\n " + "description": "\nReturns the instance of `can-globals` for chaining.\n" } } ], "_curParam": { "types": [ { - "type": "String" + "type": "*" } ], - "name": "str", - "description": "the string to camelCase" + "name": "value", + "description": "\nThe new value.\n" }, "_curReturn": { "types": [ { - "type": "String" + "type": "can-globals" } ], - "description": "the supplied string with hyphens removed and following letters capitalized.\n\n```js\nvar string = require(\"can-string\");\n\nconsole.log(string.camelize(\"foo-bar\")); // -> \"fooBar\"\nconsole.log(string.camelize(\"-webkit-flex-flow\")); // -> \"WebkitFlexFlow\"\n```\n " + "description": "\nReturns the instance of `can-globals` for chaining.\n" } }, - "can-string.hyphenate": { + "reset": { "type": "function", - "name": "can-string.hyphenate", - "parent": "node_modules/can-string/can-string.js", + "name": "reset", + "parent": "can-globals/methods", "src": { - "line": 79, - "codeLine": 92, - "path": "node_modules/can-string/can-string.js" + "line": 298, + "codeLine": 317, + "path": "node_modules/can-globals/can-globals-proto.js" }, - "body": "", - "description": "", - "title": "hyphenate", + "body": "\n", + "description": "\nReset all keys to their default value and clear their caches.\n", + "title": "", "signatures": [ { - "code": "string.hyphenate(s)", - "description": "", - "params": [ - { - "types": [ - { - "type": "String" - } - ], - "name": "str", - "description": "a string in camelCase" - } - ], + "code": "globals.setKeyValue(key, value)", + "description": "\n\n```javascript\nglobals.define('foo', 'bar');\nglobals.setKeyValue('foo', 'baz');\nglobals.getKeyValue('foo'); //-> 'baz'\nglobals.reset();\nglobals.getKeyValue('foo'); //-> 'bar'\n```\n", + "params": [], "returns": { "types": [ { - "type": "String" + "type": "can-globals" } ], - "description": "the supplied string with camelCase converted to hyphen-lowercase digraphs\n\n```js\nvar string = require(\"can-string\");\n\nconsole.log(string.hyphenate(\"fooBar\")); // -> \"foo-bar\"\nconsole.log(string.hyphenate(\"WebkitFlexFlow\")); // -> \"Webkit-flex-flow\"\n```\n " + "description": "\nReturns the instance of `can-globals` for chaining.\n" } } ], - "_curParam": { - "types": [ - { - "type": "String" - } - ], - "name": "str", - "description": "a string in camelCase" - }, "_curReturn": { "types": [ { - "type": "String" + "type": "can-globals" } ], - "description": "the supplied string with camelCase converted to hyphen-lowercase digraphs\n\n```js\nvar string = require(\"can-string\");\n\nconsole.log(string.hyphenate(\"fooBar\")); // -> \"foo-bar\"\nconsole.log(string.hyphenate(\"WebkitFlexFlow\")); // -> \"Webkit-flex-flow\"\n```\n " + "description": "\nReturns the instance of `can-globals` for chaining.\n" } }, - "can-string.pascalize": { - "type": "function", - "name": "can-string.pascalize", - "parent": "node_modules/can-string/can-string.js", + "can-util/js/import/import": { + "type": "module", + "name": "can-util/js/import/import", + "parent": "can-util/js", "src": { - "line": 99, - "codeLine": 112, - "path": "node_modules/can-string/can-string.js" + "line": 5, + "codeLine": 23, + "path": "node_modules/can-import-module/can-import-module.js" }, "body": "", "description": "", - "title": "pascalize", + "title": "import", + "types": [ + { + "type": "function", + "returns": { + "types": [ + { + "type": "undefined" + } + ] + }, + "params": [] + } + ], "signatures": [ { - "code": "string.pascalize(s)", - "description": "", + "code": "importModule(moduleName, parentName)", + "description": "\n\n```js\nvar importModule = require(\"can-util/js/import/import\");\n\nimportModule(\"foo.stache\").then(function(){\n // module was imported\n});\n```\n", "params": [ { "types": [ @@ -6762,17 +7178,27 @@ "type": "String" } ], - "name": "str", - "description": "the string in hyphen case | camelCase" + "name": "moduleName", + "description": "The module to be imported." + }, + { + "types": [ + { + "type": "String" + } + ], + "optional": true, + "name": "parentName", + "description": "A parent module that will be used as a reference for resolving relative module imports." } ], "returns": { "types": [ { - "type": "String" + "type": "Promise" } ], - "description": "the supplied string with hyphens | camelCase converted to PascalCase\n\n```js\nvar string = require(\"can-string\");\n\nconsole.log(string.pascalize(\"fooBar\")); // -> \"FooBar\"\nconsole.log(string.pascalize(\"baz-bar\")); // -> \"BazBar\"\n```\n " + "description": "A Promise that will resolve when the module has been imported.\n" } } ], @@ -6782,34 +7208,49 @@ "type": "String" } ], - "name": "str", - "description": "the string in hyphen case | camelCase" + "optional": true, + "name": "parentName", + "description": "A parent module that will be used as a reference for resolving relative module imports." }, "_curReturn": { "types": [ { - "type": "String" + "type": "Promise" } ], - "description": "the supplied string with hyphens | camelCase converted to PascalCase\n\n```js\nvar string = require(\"can-string\");\n\nconsole.log(string.pascalize(\"fooBar\")); // -> \"FooBar\"\nconsole.log(string.pascalize(\"baz-bar\")); // -> \"BazBar\"\n```\n " + "description": "A Promise that will resolve when the module has been imported.\n" } }, - "can-string.underscore": { - "type": "function", - "name": "can-string.underscore", - "parent": "node_modules/can-string/can-string.js", + "can-importer": { "src": { - "line": 115, - "codeLine": 128, - "path": "node_modules/can-string/can-string.js" + "path": "node_modules/can-import-module/can-import-module.md" + }, + "body": "\n\n\n", + "description": "\n# can-importer\n", + "name": "can-importer", + "type": "page" + }, + "can-join-uris": { + "src": { + "path": "node_modules/can-join-uris/can-join-uris.md" }, "body": "", - "description": "", - "title": "underscore", + "description": "Join together a URI path to a base. ", + "type": "module", + "title": "", + "types": [ + { + "type": "Object", + "options": [] + } + ], + "name": "can-join-uris", + "parent": "can-js-utilities", + "collection": "can-infrastructure", "signatures": [ { - "code": "string.underscore(s)", - "description": "", + "code": "joinURIs(base, href)", + "description": "\n\nProvides a convenient way to join together URIs handling relative paths.\n\n```js\nimport joinURIs from \"can-join-uris\";\n\nconst base = \"http://example.com/some/long/path\";\nconst href = \"../../images/foo.png\";\n\nconst res = joinURIs( base, href );\n\nconsole.log( res ); // -> http://example.com/images/foo.png\n```\n", "params": [ { "types": [ @@ -6817,8 +7258,17 @@ "type": "String" } ], - "name": "str", - "description": "a string in camelCase" + "name": "base", + "description": "" + }, + { + "types": [ + { + "type": "String" + } + ], + "name": "href", + "description": "" } ], "returns": { @@ -6827,7 +7277,7 @@ "type": "String" } ], - "description": "the supplied string with camelCase converted to underscore-lowercase digraphs\n\n```js\nvar string = require(\"can-string\");\n\nconsole.log(string.underscore(\"fooBar\")); // -> \"foo_bar\"\nconsole.log(string.underscore(\"HTMLElement\")); // -> \"html_element\"\n```\n " + "description": "The result of joining the two parts.\n" } } ], @@ -6837,8 +7287,8 @@ "type": "String" } ], - "name": "str", - "description": "a string in camelCase" + "name": "href", + "description": "" }, "_curReturn": { "types": [ @@ -6846,58 +7296,44 @@ "type": "String" } ], - "description": "the supplied string with camelCase converted to underscore-lowercase digraphs\n\n```js\nvar string = require(\"can-string\");\n\nconsole.log(string.underscore(\"fooBar\")); // -> \"foo_bar\"\nconsole.log(string.underscore(\"HTMLElement\")); // -> \"html_element\"\n```\n " + "description": "The result of joining the two parts.\n" } }, - "can-string.strUndHash": { - "name": "can-string.strUndHash", - "type": "property", - "parent": "node_modules/can-string/can-string.js", - "src": { - "line": 135, - "codeLine": 140, - "path": "node_modules/can-string/can-string.js" - }, - "body": " \n", - "description": "\nA regex which matches an underscore or hyphen character\n", - "types": [ - { - "type": "RegExp" - } - ], - "title": "strUndHash" - }, - "can-string": { + "can-key": { "src": { - "path": "node_modules/can-string/can-string.md" + "path": "node_modules/can-key/can-key.md" }, "body": "", - "description": "String utilities. \n", + "description": "Utilities that read and write nested properties on objects and arrays. \n", "type": "module", "title": "", "types": [ { "type": "Object", "options": [], - "description": "\n\n`can-string` exports an object with the following methods:\n\n```js\nimport string from \"can-string\";\n// or\nimport {string} from \"can\";\n\nstring.camelize(\"foo-bar\")) //-> \"fooBar\"\nstring.capitalize(\"foo\") //-> \"Foo\"\nstring.esc(\"
    foo
    \")//-> \"<div>foo</div>\"\nstring.hyphenate(\"fooBar\") //-> \"foo-bar\"\nstring.underscore(\"fooBar\") //-> \"foo_bar\"\nstring.pascalize(\"foo-bar\") //-> \"FooBar\"\n```\n" + "description": "\n\n `can-key` exports an object that contains all of its module functions:\n\n ```js\n import key from \"can-key\";\n\n var task = {\n name: \"learn can-key\",\n owner: {\n name: {first: \"Justin\", last: \"Meyer\"}\n }\n }\n\n // delete a nested key\n key.delete(task, \"owner.name.first\");\n\n // get a nested key\n key.get(task, \"owner.name.last\") //-> \"Meyer\"\n\n // set a nested key\n key.set(task, \"owner.name.first\", \"Bohdi\");\n\n // replace templated parts of a string with values\n key.replaceWith(\"{owner.name.first} {owner.name.last}\", task) //-> \"Bohdi Meyer\"\n\n // move values from one part of an object to another\n key.transform(obj, {\n \"owner.name\": \"user.name\"\n })\n\n // call a function for each key read\n key.walk(task, \"user.name.first\", function(keyInfo){ ... })\n ```\n" } ], - "name": "can-string", + "name": "can-key", "parent": "can-js-utilities", "collection": "can-infrastructure", "package": { "author": { "name": "DoneJS", "email": "core@donejs.com", - "url": "http://donejs.com" + "url": "donejs.com" }, "bugs": { - "url": "https://github.com/canjs/can-string/issues" + "url": "https://github.com/canjs/can-key/issues" }, "bundleDependencies": false, - "dependencies": {}, + "dependencies": { + "can-namespace": "^1.0.0", + "can-reflect": "^1.13.3", + "can-symbol": "^1.0.0" + }, "deprecated": false, - "description": "String helpers", + "description": "Read nested key values", "devDependencies": { "jshint": "^2.9.1", "steal": "^2.2.1", @@ -6911,23 +7347,27 @@ "donejs-plugin" ], "license": "MIT", - "main": "can-string", - "name": "can-string", + "main": "can-key", + "name": "can-key", "repository": { "type": "git", - "url": "git://github.com/canjs/can-string.git" + "url": "git://github.com/canjs/can-key.git" }, "scripts": { + "build": "node build.js", + "develop": "done-serve --static --develop --port 8080", "jshint": "jshint ./*.js --config", - "postpublish": "git push --tags && git push", - "preversion": "npm test", + "postpublish": "git push --tags && git checkout master && git branch -D release && git push", + "preversion": "npm test && npm run build", "release:major": "npm version major && npm publish", "release:minor": "npm version minor && npm publish", "release:patch": "npm version patch && npm publish", "test": "npm run jshint && npm run testee", - "testee": "testee test.html --browsers firefox" + "testee": "testee test.html --browsers firefox", + "version": "git commit -am \"Update version number\" && git checkout -b release && git add -f dist/" }, "steal": { + "main": "can-key", "configDependencies": [ "live-reload" ], @@ -6942,206 +7382,281 @@ "steal-stache" ] }, - "version": "1.1.0" + "version": "1.2.1" } }, - "can-string-to-any": { + "serialize": { + "type": "function", + "name": "serialize", + "params": [], + "parent": "node_modules/can-list/can-list.js", "src": { - "path": "node_modules/can-string-to-any/can-string-to-any.md" + "line": 167, + "codeLine": 171, + "path": "node_modules/can-list/can-list.js" }, - "body": "", - "description": "Turns a string representation of a primitive type back into the associated primitive. \n", - "type": "module", - "title": "", - "types": [ + "body": "\t \n", + "description": "Returns the serialized form of this list.\n", + "hide": true + }, + "can-list.prototype.push": { + "name": "can-list.prototype.push", + "type": "function", + "parent": "can-list.prototype", + "src": { + "line": 237, + "codeLine": 279, + "path": "node_modules/can-list/can-list.js" + }, + "body": "`push` adds elements onto the end of a List here is an example:\n\n```\nvar list = new List(['Alice']);\n\nlist.push('Bob', 'Eve');\nlist.attr(); // ['Alice', 'Bob', 'Eve']\n```\n\nIf you have an array you want to concatenate to the end\nof the List, you can use `apply`:\n\n```\nvar names = ['Bob', 'Eve'],\n list = new List(['Alice']);\n\nlist.push.apply(list, names);\nlist.attr(); // ['Alice', 'Bob', 'Eve']\n```\n\n## Events\n\n`push` causes _change_, _add_, and _length_ events to be fired.\n\n## See also\n\n`push` has a counterpart in [can-list.prototype.pop], or you may be\nlooking for [can-list.prototype.unshift] and its counterpart [can-list.prototype.shift].\n\t \n", + "description": "Add elements to the end of a list. ", + "title": "push", + "signatures": [ { - "type": "function", + "code": "list.push(...elements)", + "description": "\n\n`push` adds elements onto the end of a List.\n", + "params": [ + { + "types": [ + { + "type": "*" + } + ], + "name": "elements", + "description": "the elements to add to the List\n" + } + ], "returns": { "types": [ { - "type": "undefined" + "type": "Number" } - ] - }, - "params": [] + ], + "description": "the new length of the List\n" + } } ], - "name": "can-string-to-any", - "parent": "can-js-utilities", - "collection": "can-infrastructure", - "package": { - "author": { - "name": "DoneJS Core Team", - "email": "core@donejs.com", - "url": "http://donejs.com" - }, - "bugs": { - "url": "https://github.com/canjs/can-string-to-any/issues" - }, - "bundleDependencies": false, - "dependencies": {}, - "deprecated": false, - "description": "Convert strings to equivalent JavaScript values", - "devDependencies": { - "jshint": "^2.9.1", - "steal": "^2.2.1", - "steal-qunit": "^2.0.0", - "steal-tools": "^2.2.1", - "testee": "^0.9.0" - }, - "homepage": "http://canjs.com", - "keywords": [ - "canjs", - "donejs-plugin" + "_curParam": { + "types": [ + { + "type": "*" + } ], - "license": "MIT", - "main": "can-string-to-any", - "name": "can-string-to-any", - "repository": { - "type": "git", - "url": "git://github.com/canjs/can-string-to-any.git" - }, - "scripts": { - "build": "node build.js", - "develop": "done-serve --static --develop --port 8080", - "jshint": "jshint ./*.js --config", - "postpublish": "git push --tags && git checkout master && git branch -D release && git push", - "preversion": "npm test && npm run build", - "release:major": "npm version major && npm publish", - "release:minor": "npm version minor && npm publish", - "release:patch": "npm version patch && npm publish", - "test": "npm run jshint && npm run testee", - "testee": "testee test.html --browsers firefox", - "version": "git commit -am \"Update version number\" && git checkout -b release && git add -f dist/" - }, - "steal": { - "main": "can-string-to-any", - "configDependencies": [ - "live-reload" - ], - "npmIgnore": [ - "testee", - "generator-donejs", - "donejs-cli", - "steal-tools" - ] - }, - "version": "1.2.1" + "name": "elements", + "description": "the elements to add to the List\n" + }, + "_curReturn": { + "types": [ + { + "type": "Number" + } + ], + "description": "the new length of the List\n" }, + "comment": " " + }, + "can-list.prototype.unshift": { + "name": "can-list.prototype.unshift", + "type": "function", + "parent": "can-list.prototype", + "src": { + "line": 280, + "codeLine": 322, + "path": "node_modules/can-list/can-list.js" + }, + "body": "`unshift` adds elements to the front of the list in bulk in the order specified:\n\n```\nvar list = new List(['Alice']);\n\nlist.unshift('Bob', 'Eve');\nlist.attr(); // ['Bob', 'Eve', 'Alice']\n```\n\nIf you have an array you want to concatenate to the beginning\nof the List, you can use `apply`:\n\n```\nvar names = ['Bob', 'Eve'],\n list = new List(['Alice']);\n\nlist.unshift.apply(list, names);\nlist.attr(); // ['Bob', 'Eve', 'Alice']\n```\n\n## Events\n\n`unshift` causes _change_, _add_, and _length_ events to be fired.\n\n## See also\n\n`unshift` has a counterpart in [can-list.prototype.shift], or you may be\nlooking for [can-list.prototype.push] and its counterpart [can-list.prototype.pop].\n\t \n", + "description": "Add elements to the beginning of a List. ", + "title": "unshift", "signatures": [ { - "code": "stringToAny(string)", - "description": "\n\nExamines the provided string to see if it can be converted to a primitive type. Supported arguments are:\n\n* \"true\"\n* \"false\"\n* \"null\"\n* \"undefined\"\n* \"NaN\"\n* \"Infinity\"\n* Any [Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)\n* Any [String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)\n\n```js\nimport stringToAny from \"can-string-to-any\";\n\nstringToAny( \"NaN\" ); // -> NaN\nstringToAny( \"44.4\" ); // -> 44.4\nstringToAny( \"false\" ); // -> false\n```\n", + "code": "list.unshift(...elements)", + "description": "\n\n`unshift` adds elements onto the beginning of a List.\n", "params": [ { "types": [ { - "type": "String" + "type": "*" } ], - "name": "string", - "description": "A string to convert back to its primitive type.\n" + "name": "elements", + "description": "the elements to add to the List\n" } ], "returns": { "types": [ { - "type": "*" + "type": "Number" } ], - "description": "The primitive representation of the provided string.\n" + "description": "the new length of the List\n" } } ], "_curParam": { "types": [ { - "type": "String" + "type": "*" } ], - "name": "string", - "description": "A string to convert back to its primitive type.\n" + "name": "elements", + "description": "the elements to add to the List\n" + }, + "_curReturn": { + "types": [ + { + "type": "Number" + } + ], + "description": "the new length of the List\n" + }, + "comment": " " + }, + "can-list.prototype.pop": { + "name": "can-list.prototype.pop", + "type": "function", + "parent": "can-list.prototype", + "src": { + "line": 356, + "codeLine": 389, + "path": "node_modules/can-list/can-list.js" }, + "body": "`pop` is the opposite action from [can-list.prototype.push]:\n\n```\nvar list = new List(['Alice', 'Bob', 'Eve']);\nlist.attr(); // ['Alice', 'Bob', 'Eve']\n\nlist.pop(); // 'Eve'\nlist.pop(); // 'Bob'\nlist.pop(); // 'Alice'\nlist.pop(); // undefined\n```\n\n## Events\n\n`pop` causes _change_, _remove_, and _length_ events to be fired if the List is not empty\nwhen it is called.\n\n## See also\n\n`pop` has its counterpart in [can-list.prototype.push], or you may be\nlooking for [can-list.prototype.unshift] and its counterpart [can-list.prototype.shift].\n\t \n", + "description": "Remove an element from the end of a List. ", + "title": "pop", + "signatures": [ + { + "code": "list.pop()", + "description": "\n\n`pop` removes an element from the end of a List.\n", + "params": [], + "returns": { + "types": [ + { + "type": "*" + } + ], + "description": "the element just popped off the List, or `undefined` if the List was empty\n" + } + } + ], "_curReturn": { "types": [ { "type": "*" } ], - "description": "The primitive representation of the provided string.\n" - } + "description": "the element just popped off the List, or `undefined` if the List was empty\n" + }, + "comment": " " }, - "can-symbol.for": { + "can-list.prototype.shift": { + "name": "can-list.prototype.shift", "type": "function", - "name": "can-symbol.for", - "parent": "can-symbol/methods", + "parent": "can-list.prototype", "src": { - "line": 39, - "codeLine": 49, - "path": "node_modules/can-symbol/can-symbol.js" + "line": 390, + "codeLine": 425, + "path": "node_modules/can-list/can-list.js" }, - "body": "", - "description": "Get a symbol based on a known string identifier, or create it if it doesn't exist. \n", - "title": "for", + "body": "`shift` is the opposite action from `[can-list.prototype.unshift]`:\n\n```\nvar list = new List(['Alice']);\n\nlist.unshift('Bob', 'Eve');\nlist.attr(); // ['Bob', 'Eve', 'Alice']\n\nlist.shift(); // 'Bob'\nlist.shift(); // 'Eve'\nlist.shift(); // 'Alice'\nlist.shift(); // undefined\n```\n\n## Events\n\n`pop` causes _change_, _remove_, and _length_ events to be fired if the List is not empty\nwhen it is called.\n\n## See also\n\n`shift` has a counterpart in [can-list.prototype.unshift], or you may be\nlooking for [can-list.prototype.push] and its counterpart [can-list.prototype.pop].\n\t \n", + "description": "Remove en element from the front of a list. ", + "title": "shift", "signatures": [ { - "code": "canSymbol.for(String)", - "description": "\n", + "code": "list.shift()", + "description": "\n\n`shift` removes an element from the beginning of a List.\n", + "params": [], + "returns": { + "types": [ + { + "type": "*" + } + ], + "description": "the element just shifted off the List, or `undefined` if the List is empty\n" + } + } + ], + "_curReturn": { + "types": [ + { + "type": "*" + } + ], + "description": "the element just shifted off the List, or `undefined` if the List is empty\n" + }, + "comment": " " + }, + "can-list.prototype.indexOf": { + "type": "function", + "name": "can-list.prototype.indexOf", + "parent": "can-list.prototype", + "src": { + "line": 457, + "codeLine": 484, + "path": "node_modules/can-list/can-list.js" + }, + "body": "```\nvar list = new List(['Alice', 'Bob', 'Eve']);\nlist.indexOf('Alice'); // 0\nlist.indexOf('Charlie'); // -1\n```\n\nIt is trivial to make a `contains`-type function using `indexOf`:\n\n```\nfunction(list, item) {\n return list.indexOf(item) >= 0;\n}\n```\n \n", + "description": "Look for an item in a List. ", + "title": "indexOf", + "signatures": [ + { + "code": "list.indexOf(item)", + "description": "\n\n`indexOf` finds the position of a given item in the List.\n", "params": [ { "types": [ { - "type": "String" + "type": "*" } ], - "name": "description", - "description": "The string value of the symbol" + "name": "item", + "description": "the item to find\n" } ], "returns": { "types": [ { - "type": "CanSymbol" + "type": "Number" } ], - "description": "The globally unique and consistent symbol with the given string value.\n " + "description": "the position of the item in the List, or -1 if the item is not found.\n" } } ], "_curParam": { "types": [ { - "type": "String" + "type": "*" } ], - "name": "description", - "description": "The string value of the symbol" + "name": "item", + "description": "the item to find\n" }, "_curReturn": { "types": [ { - "type": "CanSymbol" + "type": "Number" } ], - "description": "The globally unique and consistent symbol with the given string value.\n " - } + "description": "the position of the item in the List, or -1 if the item is not found.\n" + }, + "comment": " " }, - "can-symbol.keyFor": { + "can-list.prototype.join": { "type": "function", - "name": "can-symbol.keyFor", - "parent": "can-symbol", + "name": "can-list.prototype.join", + "parent": "can-list.prototype", "src": { - "line": 57, - "codeLine": 67, - "path": "node_modules/can-symbol/can-symbol.js" + "line": 494, + "codeLine": 516, + "path": "node_modules/can-list/can-list.js" }, - "body": "", - "description": "Get the description for a symbol. \n", - "title": "keyFor", + "body": "```\nvar list = new List(['Alice', 'Bob', 'Eve']);\nlist.join(', '); // 'Alice, Bob, Eve'\n\nvar beatles = new List(['John', 'Paul', 'Ringo', 'George']);\nbeatles.join('&'); // 'John&Paul&Ringo&George'\n```\n \n", + "description": "Join a List's elements into a string. ", + "title": "join", "signatures": [ { - "code": "canSymbol.keyFor(CanSymbol)", - "description": "\n", + "code": "list.join(separator)", + "description": "\n\n`join` turns a List into a string by inserting _separator_ between the string representations\nof all the elements of the List.\n", "params": [ { "types": [ @@ -7149,17 +7664,17 @@ "type": "String" } ], - "name": "description", - "description": "The string value of the symbol" + "name": "separator", + "description": "the string to seperate elements with\n" } ], "returns": { "types": [ { - "type": "CanSymbol" + "type": "String" } ], - "description": "The globally unique and consistent symbol with the given string value.\n " + "description": "the joined string\n" } } ], @@ -7169,187 +7684,329 @@ "type": "String" } ], - "name": "description", - "description": "The string value of the symbol" + "name": "separator", + "description": "the string to seperate elements with\n" }, "_curReturn": { "types": [ { - "type": "CanSymbol" + "type": "String" } ], - "description": "The globally unique and consistent symbol with the given string value.\n " - } - }, - "can-symbol/methods": { - "name": "can-symbol/methods", - "title": "Methods", - "type": "group", - "parent": "can-symbol", - "description": "", - "order": 0 - }, - "can-symbol/symbols/type": { - "name": "can-symbol/symbols/type", - "title": "Type Symbols", - "type": "group", - "parent": "can-symbol", - "description": "", - "order": 1 - }, - "can-symbol/symbols/get-set": { - "name": "can-symbol/symbols/get-set", - "title": "Get/Set Symbols", - "type": "group", - "parent": "can-symbol", - "description": "", - "order": 2 - }, - "can-symbol/symbols/shape": { - "name": "can-symbol/symbols/shape", - "title": "Shape Symbols", - "type": "group", - "parent": "can-symbol", - "description": "", - "order": 3 - }, - "can-symbol/symbols/call": { - "name": "can-symbol/symbols/call", - "title": "Call Symbols", - "type": "group", - "parent": "can-symbol", - "description": "", - "order": 4 - }, - "can-symbol/symbols/observe": { - "name": "can-symbol/symbols/observe", - "title": "Observe Symbols", - "type": "group", - "parent": "can-symbol", - "description": "", - "order": 5 - }, - "can-symbol/types": { - "name": "can-symbol/types", - "title": "Types", - "type": "group", - "parent": "can-symbol", - "description": "", - "order": 6 + "description": "the joined string\n" + }, + "comment": " " }, - "can-symbol": { + "can-list.prototype.reverse": { + "type": "function", + "name": "can-list.prototype.reverse", + "parent": "can-list.prototype", "src": { - "path": "node_modules/can-symbol/can-symbol.md" + "path": "node_modules/can-list/docs/prototype.reverse.md" }, - "body": "\n```\n\tvar MyIDSymbol = CanSymbol(\"my_ID\");\n\n\t// ES5\n\tvar obj = {};\n\tobj[MyIDSymbol] = 1;\n\n\t// ES6 and above\n\tconst obj = {\n\t\t[myIDSymbol]: 1\n\t};\n```\n\n", - "description": "Symbols used to detail how CanJS may operate on different objects \nCanJS has a consistent internal interface for objects to interact with each other, and this is also important for interop\nwith external libraries. CanJS uses symbols to identify object types, property access methods, and for event\nhandling.\n\n`can-symbol` also has a polyfill function that will fake symbols on unsupported platforms.\n\n", - "name": "can-symbol", - "type": "page", - "parent": "can-polyfills", - "collection": "can-infrastructure", - "package": { - "author": { - "name": "Bitovi", - "email": "core@donejs.com", - "url": "http://donejs.com" - }, - "bugs": { - "url": "https://github.com/canjs/can-symbol/issues" - }, - "bundleDependencies": false, - "dependencies": { - "can-namespace": "^1.0.0" - }, - "deprecated": false, - "description": "Well known symbols used to detail how to operate on different objects", - "devDependencies": { - "bit-docs": "0.1.0", - "detect-cyclic-packages": "^1.1.0", - "done-serve": "^3.3.1", - "donejs-cli": "^3.1.1", - "generator-donejs": "^3.3.0", - "jshint": "^2.9.1", - "steal": "^2.2.1", - "steal-qunit": "^2.0.0", - "steal-tools": "^2.2.1", - "testee": "^0.9.0" - }, - "homepage": "http://canjs.com", - "keywords": [ - "Done", - "JS" + "body": "```\nvar list = new List(['Alice', 'Bob', 'Eve']);\nvar reversedList = list.reverse();\n\nreversedList.attr(); // ['Eve', 'Bob', 'Alice'];\nlist === reversedList; // true\n```\n\n`reverse` calls `replace` internally and triggers corresponding `add`, `remove`, `change` and `length` events respectively.\n\n## Demo\n\n
    \n", + "description": "Reverse the order of a List. ", + "title": "reverse", + "signatures": [ + { + "code": "list.reverse()", + "description": "\n\n`reverse` reverses the elements of the List in place.\n", + "params": [], + "returns": { + "types": [ + { + "type": "can-list" + } + ], + "description": "the List, for chaining\n" + } + } + ], + "_curReturn": { + "types": [ + { + "type": "can-list" + } ], - "main": "can-symbol", - "name": "can-symbol", - "repository": { - "type": "git", - "url": "git://github.com/canjs/can-symbol.git" - }, - "scripts": { - "detect-cycle": "detect-cyclic-packages --ignore done-serve", - "develop": "done-serve --static --develop --port 8080", - "jshint": "jshint ./*.js --config", - "postpublish": "git push --tags && git push", - "preversion": "npm test", - "release:major": "npm version major && npm publish", - "release:minor": "npm version minor && npm publish", - "release:patch": "npm version patch && npm publish", - "release:pre": "npm version prerelease && npm publish --tag=pre", - "test": "npm run detect-cycle && npm run jshint && npm run testee", - "testee": "testee test.html --browsers firefox" - }, - "system": { - "main": "can-symbol", - "configDependencies": [ - "live-reload" + "description": "the List, for chaining\n" + }, + "comment": " " + }, + "can-list.prototype.slice": { + "type": "function", + "name": "can-list.prototype.slice", + "parent": "can-list.prototype", + "src": { + "line": 545, + "codeLine": 577, + "path": "node_modules/can-list/can-list.js" + }, + "body": "```\nvar list = new List(['Alice', 'Bob', 'Charlie', 'Daniel', 'Eve']);\nvar newList = list.slice(1, 4);\nnewList.attr(); // ['Bob', 'Charlie', 'Daniel']\n```\n\n`slice` is the simplest way to copy a List:\n\n```\nvar list = new List(['Alice', 'Bob', 'Eve']);\nvar copy = list.slice();\n\ncopy.attr(); // ['Alice', 'Bob', 'Eve']\nlist === copy; // false\n```\n \n", + "description": "Make a copy of a part of a List. ", + "title": "slice", + "signatures": [ + { + "code": "list.slice([start[, end]])", + "description": "\n\n`slice` creates a copy of a portion of the List.\n", + "params": [ + { + "types": [ + { + "type": "Number" + } + ], + "optional": true, + "name": "start", + "defaultValue": "0", + "description": "the index to start copying from\n" + }, + { + "types": [ + { + "type": "Number" + } + ], + "optional": true, + "name": "end", + "description": "the first index not to include in the copy\nIf _end_ is not supplied, `slice` will copy until the end of the list.\n" + } ], - "npmIgnore": [ - "testee", - "generator-donejs", - "donejs-cli", - "steal-tools" + "returns": { + "types": [ + { + "type": "can-list" + } + ], + "description": "a new `can-list` with the extracted elements\n" + } + } + ], + "_curParam": { + "types": [ + { + "type": "Number" + } + ], + "optional": true, + "name": "end", + "description": "the first index not to include in the copy\nIf _end_ is not supplied, `slice` will copy until the end of the list.\n" + }, + "_curReturn": { + "types": [ + { + "type": "can-list" + } + ], + "description": "a new `can-list` with the extracted elements\n" + }, + "comment": " " + }, + "can-list.prototype.concat": { + "type": "function", + "name": "can-list.prototype.concat", + "parent": "can-list.prototype", + "src": { + "line": 584, + "codeLine": 607, + "path": "node_modules/can-list/can-list.js" + }, + "body": "`concat` makes a new List with the elements of the List followed by the elements of the parameters.\n\n```\nvar list = new List();\nvar newList = list.concat(\n 'Alice',\n ['Bob', 'Charlie']),\n new List(['Daniel', 'Eve']),\n {f: 'Francis'}\n);\nnewList.attr(); // ['Alice', 'Bob', 'Charlie', 'Daniel', 'Eve', {f: 'Francis'}]\n```\n \n", + "description": "Merge many collections together into a List. ", + "title": "concat", + "signatures": [ + { + "code": "list.concat(...args)", + "description": "", + "params": [ + { + "types": [ + { + "type": "Array" + }, + { + "type": "can-list" + }, + { + "type": "*" + } + ], + "name": "args", + "description": "Any number of arrays, Lists, or values to add in\nFor each parameter given, if it is an Array or a List, each of its elements will be added to\nthe end of the concatenated List. Otherwise, the parameter itself will be added.\n" + } ] - }, - "version": "1.6.5" + } + ], + "_curParam": { + "types": [ + { + "type": "Array" + }, + { + "type": "can-list" + }, + { + "type": "*" + } + ], + "name": "args", + "description": "Any number of arrays, Lists, or values to add in\nFor each parameter given, if it is an Array or a List, each of its elements will be added to\nthe end of the concatenated List. Otherwise, the parameter itself will be added.\n" + }, + "comment": " " + }, + "can-list.prototype.forEach": { + "type": "function", + "name": "can-list.prototype.forEach", + "parent": "can-list.prototype", + "src": { + "line": 635, + "codeLine": 657, + "path": "node_modules/can-list/can-list.js" }, + "body": "`forEach` calls a callback for each element in the List.\n\n```\nvar list = new List([1, 2, 3]);\nlist.forEach(function(element, index, list) {\n list.attr(index, element * element);\n});\nlist.attr(); // [1, 4, 9]\n```\n \n", + "description": "Call a function for each element of a List. ", + "title": "forEach", "signatures": [ { - "code": "canSymbol(String)", - "description": "\n\nCreate or reuse symbols based on an optional string description\n", - "params": [] + "code": "list.forEach(callback[, thisArg])", + "description": "", + "params": [ + { + "types": [ + { + "type": "function", + "returns": { + "types": [ + { + "type": "undefined" + } + ] + }, + "params": [ + { + "types": [ + { + "type": "element" + } + ] + }, + { + "types": [ + { + "type": "index" + } + ] + }, + { + "types": [ + { + "type": "list" + } + ] + } + ] + } + ], + "name": "callback", + "description": "a function to call with each element of the List\nThe three parameters that _callback_ gets passed are _element_, the element at _index_, _index_ the\ncurrent element of the list, and _list_ the List the elements are coming from. _callback_ is\nnot invoked for List elements that were never initialized." + }, + { + "types": [ + { + "type": "Object", + "options": [] + } + ], + "optional": true, + "name": "thisArg", + "description": "the object to use as `this` inside the callback\n" + } + ] } ], + "_curParam": { + "types": [ + { + "type": "Object", + "options": [] + } + ], + "optional": true, + "name": "thisArg", + "description": "the object to use as `this` inside the callback\n" + }, "comment": " " }, - "changelog": { + "can-list.prototype.replace": { + "type": "function", + "name": "can-list.prototype.replace", + "parent": "can-list.prototype", "src": { - "path": "node_modules/can-validate/changelog.md" + "line": 668, + "codeLine": 731, + "path": "node_modules/can-list/can-list.js" }, - "body": "\nSee the [latest releases on GitHub](https://github.com/canjs/can-validate/releases).\n\n## [1.0.0.pre]\n\n### Removed\n\n- No longer ships with validate.js shims\n- No longer ships with can.Map plugin\n- `validate`, `one`, and `isValid` methods\n\n### Added\n\n- `test` method, behaves similarly as `isValid` but also sets errors\n- `errors` method to retrieve errors\n- Register validator and library methods\n- Extend method for plugins using can-construct\n\n## [0.9.2] - 2015-06-02\n\n### Changed\n\n- Cleaning up code after incorrect merge.\n\n## [0.9.1] - 2015-06-02\n\n### Changed\n\n- Fixed Validate all bug where some properties would not get properly validate when undefined in map instance.\n- Fixed overloading of validate list on validate all method.\n\n## [0.9.0] - 2015-06-01\n\n### Changed\n\n- [#26](https://github.com/canjs/can-validate/issues/26) Fixed bug that overwrote validate properties for all instances of a Map or Model. Computes are now cached to a dunder property versus overwriting the main `validate` property.\n- [#27](https://github.com/canjs/can-validate/issues/27) Fixed the `validate` method so it resolves computes. Computes are created from functions passed as validate options so validation can be triggered when compute change is triggered.\n- Improved validate init. Using a better method for detecting when Map is initing.\n\n## [0.8.4] - 2016-06-01\n\n### Added\n\n- Added tests for issue [#26](https://github.com/canjs/can-validate/issues/26)\n- Added tests for issue [#27](https://github.com/canjs/can-validate/issues/27)\n\n### Changed\n\n- Updated dependencies\n- Switched to Mocha\n- Improved tests\n\n## [0.8.3] - 2016-04-21\n\n### Changed\n\n- Fixed bug when errors was blank would cause console error\n\n## [0.8.2] - 2016-03-02\n\n### Changed\n\n- Improved handling of validation strings, passes strings through to Validate.JS.\n\n## [0.8.1] - 2016-02-03\n\n### Added\n\n- This change log\n- Contributing guide\n\n### Changed\n\n- Changed documentation root to `can-validate-plugin`, changed from `can-validate-library`.\n- Improved readme.\n- Improved overall documentation.\n\n### Removed\n\n- Removed CanJS Validations library documentation since it is still a WIP.\n\n## [0.8.0] - 2015-12-03\n\n### Changed\n- Fixed memory leaks.\n- Improved validate object compute handling.\n- Updated to work with CanJS 2.3.x.\n\n## [0.7.1] - 2015-11-23\n\n### Changed\n- Improved build.\n\n## [0.7.0] - 2015-10-19\n\n### Added\n- Added XO for linting.\n\n### Changed\n- Cleaned up lint errors in repo.\n\n## [0.6.0] - 2015-10-19\n\n### Added\n- Improved ability to pass functions to validation properties.\n\n### Changed\n- Fixed map init bug.\n\n## [0.5.2] - 2015-10-18\n\n### Changed\n- Fixed tests.\n- Fixed merge conflicts/errors.\n\n## [0.5.1] - 2015-10-01\n\n### Changed\n- Fixed require bug.\n\n## [0.5.0] - 2015-07-16\n\n### Added\n- Added \"validate all\" method to can.Map plugin\n\n## [0.4.2] - 2015-07-13\n\n### Added\n- Published to NPM\n\n## [0.4.1] - 2015-07-13\n\n### Added\n- Inline docs.\n- Added DocumentJS dependency.\n\n## [0.4.0] - 2015-07-10\n\n### Changed\n- Restructured repository.\n\n## [0.3.0] - 2015-07-10\n\n### Added\n- Browserify build.\n\n### Changed\n- Overall build improvements.\n\n## [0.2.0] - 2015-07-09\n\n### Changed\n- Made buildable. Using `import` over Steal syntax.\n\n## [0.1.0] - 2015-07-08\n\n### Added\n- Created can-validate entry point.\n- Created can.Map plugin.\n- Created ValidateJS shim\n\n\n[0.8.0]: https://github.com/canjs/can-validate/commit/0b98de198af17980174531146e43fb8c4b5e11a6\n[0.7.1]: https://github.com/canjs/can-validate/commit/2a58bf9ef280c2bb378221c6c18e85c7fed6daa3\n[0.7.0]: https://github.com/canjs/can-validate/commit/6be268da2a02e2985f71fa1f7196bfad94c84ca5\n[0.6.0]: https://github.com/canjs/can-validate/commit/0383d482353319a6eec3cf218daaa99b8ce62585\n[0.5.2]: https://github.com/canjs/can-validate/commit/17f46a11fb3f788e029359476bca83a67dca2b94\n[0.5.1]: https://github.com/canjs/can-validate/commit/5280c965df668b3eb1b95d10847f20676a3c5820\n[0.5.0]: https://github.com/canjs/can-validate/commit/53d965869263f39ea03dca97822fd5173cf62cdc\n[0.4.2]: https://github.com/canjs/can-validate/commit/608ee0cefdc161ecdf186980738952c86c937981\n[0.4.1]: https://github.com/canjs/can-validate/commit/c15d0b72bcc3e7343615d41baccbf3cf10242898\n[0.4.0]: https://github.com/canjs/can-validate/commit/a1d581aa31c304b04a7bdb4dc40106cf5c48771d\n[0.3.0]: https://github.com/canjs/can-validate/commit/4a7de30a12c27e7db992ac2bfcdb55e94e61c17a\n[0.2.0]: https://github.com/canjs/can-validate/commit/7ba46b1ea42315f68532f4246031d9bf074b785d\n[0.1.0]: https://github.com/canjs/can-validate/commit/b9a9aa2c43d672d9c238a506d788bafb3f89ee70\n\n", - "description": "\n# Change log\n", - "name": "changelog", - "title": "Changelog", - "type": "page", - "parent": "can-validate-plugin", - "hide": true + "body": "`replace` replaces all the elements of this List with new ones.\n\n`replace` is especially useful when `can-list`s are live-bound into `[can-control]`s,\nand you intend to populate them with the results of a `[can-model]` call:\n\n```\ncan.Control({\n init: function() {\n this.list = new Todo.List();\n // live-bind the list into the DOM\n this.element.html(can.view('list.stache', this.list));\n // when this AJAX call returns, the live-bound DOM will be updated\n this.list.replace(Todo.findAll());\n }\n});\n```\n\nLearn more about [can.Model.List making Lists of models].\n\n## Events\n\nA major difference between `replace` and `attr(newElements, true)` is that `replace` always emits\nan _add_ event and a _remove_ event, whereas `attr` will cause _set_ events along with an _add_ or _remove_\nevent if needed. Corresponding _change_ and _length_ events will be fired as well.\n\nThe differences in the events fired by `attr` and `replace` are demonstrated concretely by this example:\n```\nvar attrList = new List(['Alexis', 'Bill']);\nattrList.bind('change', function(ev, index, how, newVals, oldVals) {\n console.log(index + ', ' + how + ', ' + newVals + ', ' + oldVals);\n});\n\nvar replaceList = new List(['Alexis', 'Bill']);\nreplaceList.bind('change', function(ev, index, how, newVals, oldVals) {\n console.log(index + ', ' + how + ', ' + newVals + ', ' + oldVals);\n});\n\nattrList.attr(['Adam', 'Ben'], true); // 0, set, Adam, Alexis\n // 1, set, Ben, Bill\nreplaceList.replace(['Adam', 'Ben']); // 0, remove, undefined, ['Alexis', 'Bill']\n // 0, add, ['Adam', 'Ben'], ['Alexis', 'Bill']\n\nattrList.attr(['Amber'], true); // 0, set, Amber, Adam\n // 1, remove, undefined, Ben\nreplaceList.replace(['Amber']); // 0, remove, undefined, ['Adam', 'Ben']\n // 0, add, Amber, ['Adam', 'Ben']\n\nattrList.attr(['Alice', 'Bob', 'Eve'], true); // 0, set, Alice, Amber\n // 1, add, ['Bob', 'Eve'], undefined\nreplaceList.replace(['Alice', 'Bob', 'Eve']); // 0, remove, undefined, Amber\n // 0, add, ['Alice', 'Bob', 'Eve'], Amber\n```\n \n", + "description": "Replace all the elements of a List. ", + "title": "replace", + "signatures": [ + { + "code": "list.replace(collection)", + "description": "", + "params": [ + { + "types": [ + { + "type": "Array" + }, + { + "type": "can-list" + }, + { + "type": "can.Deferred" + } + ], + "name": "collection", + "description": "the collection of new elements to use\nIf a [can.Deferred] is passed, it must resolve to an `Array` or `can-list`.\nThe elements of the list are not actually removed until the Deferred resolves.\n" + } + ] + } + ], + "_curParam": { + "types": [ + { + "type": "Array" + }, + { + "type": "can-list" + }, + { + "type": "can.Deferred" + } + ], + "name": "collection", + "description": "the collection of new elements to use\nIf a [can.Deferred] is passed, it must resolve to an `Array` or `can-list`.\nThe elements of the list are not actually removed until the Deferred resolves.\n" + }, + "comment": " " }, - "can-validate-interface": { + "can-list": { "src": { - "path": "node_modules/can-validate-interface/can-validate-interface.md" + "path": "node_modules/can-list/docs/list.md" }, - "body": "", - "description": "`can-validate-interface` provides simple property existence validation. Use to prevent errors resulting from missing properties on input objects.\n\n\n", + "body": "\n\nUse for observable array-like objects.\n\n\n## Use\n\n`List` is used to observe changes to an Array. `List` extends `[can-map]`, so all the\nways that you're used to working with Maps also work here.\n\nUse [can-list::attr attr] to read and write properties of a list:\n\n var hobbies = new List([\"JS\",\"Party Rocking\"])\n hobbies.attr(0) //-> \"JS\"\n hobbies.attr(\"length\") //-> 2\n\n hobbies.attr(0,\"JavaScript\")\n\n hobbies.attr() //-> [\"JavaScript\",\"Party Rocking\"]\n\nJust as you shouldn't set properties of an Map directly, you shouldn't change elements\nof a List directly. Always use `attr` to set the elements of a List, or use [can-list::push push],\n[can-list::pop pop], [can-list::shift shift], [can-list::unshift unshift], or [can-list::splice splice].\n\nHere is a tour through the forms of `List`'s `attr` that parallels the one found under [can-map.prototype.attr attr]:\n\n```\nvar people = new List(['Alex', 'Bill']);\n\n// set an element:\npeople.attr(0, 'Adam');\npeople[0] = 'Adam'; // don't do this!\n\n// get an element:\npeople.attr(0); // 'Adam'\npeople[0]; // 'Adam'\n\n// get all elements:\npeople.attr(); // ['Adam', 'Bill']\n\n// extend the array:\npeople.attr(4, 'Charlie');\npeople.attr(); // ['Adam', 'Bill', undefined, undefined, 'Charlie']\n\n// merge the elements:\npeople.attr(['Alice', 'Bob', 'Eve']);\npeople.attr(); // ['Alice', 'Bob', 'Eve', undefined, 'Charlie']\n```\n\n## Listening to changes\n\nAs with `Map`s, the real power of observable arrays comes from being able to\nreact to changes in the member elements of the array. Lists emit five types of events:\n\n- the _change_ event fires on every change to a List.\n- the _set_ event is fired when an element is set.\n- the _add_ event is fired when an element is added to the List.\n- the _remove_ event is fired when an element is removed from the List.\n- the _length_ event is fired when the length of the List changes.\n\nThis example presents a brief concrete survey of the times these events are fired:\n\n```\nvar list = new List(['Alice', 'Bob', 'Eve']);\n\nlist.bind('change', function() { console.log('An element changed.'); });\nlist.bind('set', function() { console.log('An element was set.'); });\nlist.bind('add', function() { console.log('An element was added.'); });\nlist.bind('remove', function() {\n console.log('An element was removed.');\n});\nlist.bind('length', function() {\n console.log('The length of the list changed.');\n});\n\nlist.attr(0, 'Alexis'); // 'An element changed.'\n // 'An element was set.'\n\nlist.attr(3, 'Xerxes'); // 'An element changed.'\n // 'An element was added.'\n // 'The length of the list was changed.'\n\nlist.attr(['Adam', 'Bill']); // 'An element changed.'\n // 'An element was set.'\n // 'An element was changed.'\n // 'An element was set.'\n\nlist.pop(); // 'An element changed.'\n // 'An element was removed.'\n // 'The length of the list was changed.'\n```\n\nMore information about binding to these events can be found under [can-list::attr attr].\n\n", + "description": "\n", + "name": "can-list", "type": "module", - "title": "", "types": [ { - "type": "Object", - "options": [] + "type": "constructor" } ], - "name": "can-validate-interface", - "parent": "can-data-validation", - "collection": "can-infrastructure", + "inherits": "can", + "download": "can/list", + "test": "can/list/test.html", + "parent": "can-observables", + "collection": "can-legacy", + "release": "2.0", "package": { "author": { "name": "Bitovi", @@ -7357,147 +8014,201 @@ "url": "http://bitovi.com" }, "bugs": { - "url": "https://github.com/canjs/can-validate-interface/issues" + "url": "https://github.com/canjs/can-list/issues" }, "bundleDependencies": false, - "dependencies": {}, + "dependencies": { + "can-assign": "^1.1.1", + "can-cid": "^1.1.2", + "can-compute": "^4.0.0", + "can-construct": "^3.2.1", + "can-event-queue": "<2.0.0", + "can-map": "^4.0.0", + "can-namespace": "^1.0.0", + "can-observation": "^4.0.0", + "can-observation-recorder": "<2.0.0", + "can-queues": "<2.0.0", + "can-reflect": "^1.7.2", + "can-simple-observable": "^2.0.0", + "can-stache-key": "^1.0.0", + "can-symbol": "^1.4.1", + "can-types": "^1.1.0" + }, "deprecated": false, - "description": "Utility to validate property existence. Test for missing properties before they cause errors later.", + "description": "Observable lists", "devDependencies": { "detect-cyclic-packages": "^1.1.0", - "jshint": "^2.9.5", - "steal": "^1.5.15", + "jshint": "^2.9.1", + "steal": "^1.2.9", "steal-qunit": "^2.0.0", - "steal-tools": "^1.3.5", + "steal-tools": "^1.1.2", "testee": "^0.9.0" }, - "homepage": "https://github.com/canjs/can-validate-interface#readme", + "homepage": "http://canjs.com", "keywords": [ - "interface", "canjs", - "can", - "can-validate" + "canjs-plugin", + "donejs" ], - "license": "MIT", - "main": "index.js", - "name": "can-validate-interface", + "main": "can-list", + "name": "can-list", "repository": { "type": "git", - "url": "git://github.com/canjs/can-validate-interface.git" + "url": "git://github.com/canjs/can-list.git" }, "scripts": { - "build": "node build.js", - "detect-cycle": "detect-cyclic-packages --ignore can-connect", + "detect-cycle": "detect-cyclic-packages --ignore done-serve", "jshint": "jshint ./*.js --config", - "postpublish": "git push --tags && git checkout - && git branch -D release && git push", - "preversion": "npm test && npm run build", + "postpublish": "git push --tags && git push", + "preversion": "npm test", "release:major": "npm version major && npm publish", "release:minor": "npm version minor && npm publish", "release:patch": "npm version patch && npm publish", - "release:pre": "npm version prerelease && npm publish --tag=pre", + "release:pre": "npm version prerelease && npm publish --tag pre", "test": "npm run detect-cycle && npm run jshint && npm run testee", - "testee": "testee test.html --browsers firefox", - "version": "git commit -am \"Update dist for release\" && git checkout -b release && git add -f dist/" + "testee": "testee test/test.html --browsers firefox" }, - "version": "1.0.3" + "system": { + "configDependencies": [ + "live-reload" + ], + "npmAlgorithm": "flat" + }, + "version": "4.2.2" }, + "link": "../docco/list/list.html docco", "signatures": [ { - "code": "makeInterfaceValidator(propertyArrays)", - "description": "\n\nGet a function that validates a given object for the provided properties:\n\n```js\nimport makeInterfaceValidator from \"can-validate-interface\";\nconst dataMethods = [ \"create\", \"read\", \"update\", \"delete\" ];\nconst daoValidator = makeInterfaceValidator( [ dataMethods, \"id\" ] );\n\nconst dao = {\n\tcreate: function() {},\n\tread: function() {},\n\tupdate: function() {},\n\tdelete: function() {}\n};\n\nlet errors = daoValidator( dao );\n\n// errors == {message:\"missing expected properties\", related: [\"id\"]}\n\ndao.id = 10;\n\nerrors = daoValidator( dao );\n\n// errors == undefined\n```\n", + "code": "new List([array])", + "description": "\n\nCreate an observable array-like object.\n", "params": [ { "types": [ { "type": "Array", - "template": [ - { - "types": [ - { - "type": "String" - } - ] - }, - { - "types": [ - { - "type": "Array", - "template": [ - { - "types": [ - { - "type": "String" - } - ] - } - ] - } - ] - } - ] + "options": [] } ], - "name": "propertyArrays", - "description": "Property names and arrays of property names to validate existence of\n" + "optional": true, + "name": "array", + "description": "Items to seed the List with.\n" } ], "returns": { "types": [ { - "type": "function", - "returns": { - "types": [ - { - "type": "Object", - "options": [ - { - "name": "{" - } - ] - } - ] - }, - "params": [ - { - "types": [ - { - "type": "Object", - "options": [ - { - "name": "*" - } - ] - } - ] - } - ] + "type": "can-list" } ], - "description": "Function that validates an object for properties in propertyArrays and returns an error record or undefined if no properties are missing." + "description": "An instance of `List` with the elements from _array_.\n" + } + }, + { + "code": "new List(deferred)", + "description": "\n", + "params": [ + { + "types": [ + { + "type": "can.Deferred" + } + ], + "name": "deferred", + "description": "A deferred that resolves to an\narray. When the deferred resolves, its values will be added to the list.\n" + } + ], + "returns": { + "types": [ + { + "type": "can-list" + } + ], + "description": "An initially empty `List`. \n\n" } } ], - "_curParam": { + "_curReturn": { "types": [ { - "type": "Array", - "template": [ - { - "types": [ - { - "type": "String" - } - ] - }, + "type": "can-list" + } + ], + "description": "An initially empty `List`. \n\n" + }, + "_curParam": { + "types": [ + { + "type": "can.Deferred" + } + ], + "name": "deferred", + "description": "A deferred that resolves to an\narray. When the deferred resolves, its values will be added to the list.\n" + }, + "comment": " " + }, + "can-connect/data/localstorage-cache/localstorage-cache.name": { + "src": { + "line": 66, + "codeLine": 88, + "path": "node_modules/can-local-store/can-local-store.js" + }, + "type": "property", + "body": "\n\n## Use\n\n```\nvar cacheConnection = connect([\"data-localstorage-cache\"],{\n name: \"todos\"\n});\n```\n\t \n", + "description": "\nSpecify a name to use when saving data in localstorage.\n", + "types": [ + { + "type": "String", + "description": "This name is used to find and save data in\nlocalstorage. Instances are saved in `{name}/instance/{id}`\nand sets are saved in `{name}/set/{set}`.\n" + } + ], + "title": "name", + "name": "can-connect/data/localstorage-cache/localstorage-cache.name", + "parent": "can-connect/data/localstorage-cache/localstorage-cache.identifiers", + "comment": " " + }, + "can-connect/data/localstorage-cache/localstorage-cache.clear": { + "body": "\n", + "description": "\nResets the memory cache so it contains nothing.\n", + "title": "clear", + "name": "can-connect/data/localstorage-cache/localstorage-cache.clear", + "type": "function", + "parent": "can-connect/data/localstorage-cache/localstorage-cache.data-methods", + "signatures": [ + { + "code": "connection.clear()", + "description": "\n\n\t ", + "params": [] + } + ] + }, + "can-connect/data/localstorage-cache/localstorage-cache.getSets": { + "body": "\n\n## Use\n\n```\nconnection.getSets() //-> Promise( [{type: \"completed\"},{user: 5}] )\n```\n\n\t \n", + "description": "\nReturns the sets contained within the cache.\n", + "title": "getSets", + "name": "can-connect/data/localstorage-cache/localstorage-cache.getSets", + "type": "function", + "parent": "can-connect/data/localstorage-cache/localstorage-cache.data-methods", + "signatures": [ + { + "code": "connection.getSets(set)", + "description": "\n\n Returns the sets added by [can-connect/data/localstorage-cache/localstorage-cache.updateListData].\n", + "params": [], + "returns": { + "types": [ { - "types": [ + "type": "Promise", + "template": [ { - "type": "Array", - "template": [ + "types": [ { - "types": [ + "type": "Array", + "template": [ { - "type": "String" + "types": [ + { + "type": "Set" + } + ] } ] } @@ -7505,36 +8216,27 @@ } ] } - ] + ], + "description": "A promise that resolves to the list of sets.\n" } - ], - "name": "propertyArrays", - "description": "Property names and arrays of property names to validate existence of\n" - }, + } + ], "_curReturn": { "types": [ { - "type": "function", - "returns": { - "types": [ - { - "type": "Object", - "options": [ - { - "name": "{" - } - ] - } - ] - }, - "params": [ + "type": "Promise", + "template": [ { "types": [ { - "type": "Object", - "options": [ + "type": "Array", + "template": [ { - "name": "*" + "types": [ + { + "type": "Set" + } + ] } ] } @@ -7543,169 +8245,127 @@ ] } ], - "description": "Function that validates an object for properties in propertyArrays and returns an error record or undefined if no properties are missing." - } + "description": "A promise that resolves to the list of sets.\n" + }, + "comment": " " }, - "validator": { + "can-connect/data/localstorage-cache/localstorage-cache.getListData": { + "body": "\n", + "description": "\nGets a set of data from localstorage.\n", + "title": "getListData", + "name": "can-connect/data/localstorage-cache/localstorage-cache.getListData", "type": "function", - "name": "validator", - "params": [ + "parent": "can-connect/data/localstorage-cache/localstorage-cache.data-methods", + "signatures": [ { - "types": [ + "code": "connection.getListData(set)", + "description": "\n\n Goes through each set add by [can-connect/data/memory-cache.updateListData]. If\n `set` is a subset, uses [can-connect/base/base.queryLogic] to get the data for the requested `set`.\n", + "params": [ { - "type": "string" + "types": [ + { + "type": "can-query-logic/query" + } + ], + "name": "query", + "description": "An object that represents the data to load.\n" } ], - "name": "id", - "description": "The key name of the validator library." - }, - { - "types": [ - { - "type": "object" - }, - { - "type": "function", - "returns": { - "types": [ + "returns": { + "types": [ + { + "type": "Promise", + "template": [ { - "type": "undefined" + "types": [ + { + "type": "can-connect.listData" + } + ] } ] - }, - "params": [] - } - ], - "name": "validator", - "description": "The validator libarary. Only pass instances." + } + ], + "description": "A promise that resolves if `set` is a subset of\nsome data added by [can-connect/data/memory-cache.updateListData]. If it is not,\nthe promise is rejected.\n\t " + } } ], - "parent": "node_modules/can-validate-legacy/can-validate.js", - "src": { - "line": 17, - "codeLine": 27, - "path": "node_modules/can-validate-legacy/can-validate.js" - }, - "body": "\n", - "description": "Registers a library with can.validate. The last one registered is the default library.\nOverride the default by changing `_validatorId` to the key of the desired registered library.\n```js\nValidate.register('validatejs',validatejs);\n```\n", "_curParam": { "types": [ { - "type": "object" - }, - { - "type": "function", - "returns": { - "types": [ - { - "type": "undefined" - } - ] - }, - "params": [] + "type": "can-query-logic/query" } ], - "name": "validator", - "description": "The validator libarary. Only pass instances." + "name": "query", + "description": "An object that represents the data to load.\n" }, - "hide": true - }, - "register": { - "type": "function", - "name": "register", - "params": [ - { - "types": [ - { - "type": "string" - } - ], - "name": "id", - "description": "The key name of the validator library." - }, - { - "types": [ - { - "type": "object" - }, - { - "type": "function", - "returns": { + "_curReturn": { + "types": [ + { + "type": "Promise", + "template": [ + { "types": [ { - "type": "undefined" + "type": "can-connect.listData" } ] - }, - "params": [] - } - ], - "name": "validator", - "description": "The validator libarary. Only pass instances." - } - ], - "parent": "node_modules/can-validate-legacy/can-validate.js", - "src": { - "line": 31, - "codeLine": 41, - "path": "node_modules/can-validate-legacy/can-validate.js" - }, - "body": "\n", - "description": "Registers a library with can.validate. The last one registered is the default library.\nOverride the default by changing `_validatorId` to the key of the desired registered library.\n```js\nValidate.register('validatejs',validatejs);\n```\n", - "_curParam": { - "types": [ - { - "type": "object" - }, - { - "type": "function", - "returns": { - "types": [ - { - "type": "undefined" - } - ] - }, - "params": [] + } + ] } ], - "name": "validator", - "description": "The validator libarary. Only pass instances." - }, - "hide": true + "description": "A promise that resolves if `set` is a subset of\nsome data added by [can-connect/data/memory-cache.updateListData]. If it is not,\nthe promise is rejected.\n\t " + } }, - "isValid": { + "can-connect/data/localstorage-cache.getListDataSync": { + "body": "\n\t \n", + "description": "\nSynchronously gets a set of data from localstorage.\n", + "title": "getListDataSync", + "name": "can-connect/data/localstorage-cache.getListDataSync", "type": "function", - "name": "isValid", - "params": [ + "parent": "can-connect/data/localstorage-cache.data-methods", + "signatures": [ { - "types": [ - { - "type": "*" - } - ], - "name": "value", - "description": "Some value to validate against." - }, + "code": "connection.getListDataSync(set)", + "description": "", + "params": [] + } + ], + "hide": true + }, + "can-connect/data/localstorage-cache/localstorage-cache.getData": { + "body": "\n", + "description": "\nGet an instance's data from localstorage.\n", + "title": "getData", + "name": "can-connect/data/localstorage-cache/localstorage-cache.getData", + "type": "function", + "parent": "can-connect/data/localstorage-cache/localstorage-cache.data-methods", + "signatures": [ { - "types": [ + "code": "connection.getData(params)", + "description": "\n\n Looks in localstorage for the requested instance.\n", + "params": [ { - "type": "Object", - "options": [] + "types": [ + { + "type": "Object", + "options": [] + } + ], + "name": "params", + "description": "An object that should have the [conenction.id] of the element\nbeing retrieved.\n" } ], - "name": "options", - "description": "Raw validation options. They will be processed since\nnot all options are valid for ValidateJS." + "returns": { + "types": [ + { + "type": "Promise" + } + ], + "description": "A promise that resolves to the item if the memory cache has this item.\nIf localstorage does not have this item, it rejects the promise.\n\t " + } } ], - "parent": "node_modules/can-validate-legacy/shims/validatejs.js", - "src": { - "line": 63, - "codeLine": 73, - "path": "node_modules/can-validate-legacy/shims/validatejs.js" - }, - "body": "\n", - "description": "Simply checks if the property value will validate or not, this method will not set errors, it is meant to check validity *before* a property\nis set.\n", "_curParam": { "types": [ { @@ -7713,296 +8373,287 @@ "options": [] } ], - "name": "options", - "description": "Raw validation options. They will be processed since\nnot all options are valid for ValidateJS." - }, - "hide": true, - "title": "Is Valid", - "returns": { - "types": [ - { - "type": "boolean" - } - ], - "description": "True if valid, otherwise returns false\n" + "name": "params", + "description": "An object that should have the [conenction.id] of the element\nbeing retrieved.\n" }, "_curReturn": { "types": [ { - "type": "boolean" + "type": "Promise" } ], - "description": "True if valid, otherwise returns false\n" + "description": "A promise that resolves to the item if the memory cache has this item.\nIf localstorage does not have this item, it rejects the promise.\n\t " } }, - "once": { + "can-connect/data/localstorage-cache/localstorage-cache.updateListData": { + "body": "\n", + "description": "\nSaves a set of data in the cache.\n", + "title": "updateListData", + "name": "can-connect/data/localstorage-cache/localstorage-cache.updateListData", "type": "function", - "name": "once", - "params": [ - { - "types": [ - { - "type": "*" - } - ], - "name": "value", - "description": "Some value to validate against." - }, + "parent": "can-connect/data/localstorage-cache/localstorage-cache.data-methods", + "signatures": [ { - "types": [ + "code": "connection.updateListData(listData, set)", + "description": "\n\n Tries to merge this set of data with any other saved sets of data. If\n unable to merge this data, saves the set by itself.\n", + "params": [ { - "type": "Object", - "options": [] - } - ], - "name": "options", - "description": "Raw validation options. They will be processed since\nnot all options are valid for ValidateJS." - }, - { - "types": [ + "types": [ + { + "type": "can-connect.listData" + } + ], + "name": "listData", + "description": "" + }, { - "type": "string" + "types": [ + { + "type": "can-query-logic/query" + } + ], + "name": "query", + "description": "" } ], - "name": "name", - "description": "The key name of the value to validate. Used to prepend to\nerror messages, if any." + "returns": { + "types": [ + { + "type": "Promise" + } + ], + "description": "Promise resolves if and when the data has been successfully saved.\n\t " + } } ], - "parent": "node_modules/can-validate-legacy/shims/validatejs.js", - "src": { - "line": 24, - "codeLine": 35, - "path": "node_modules/can-validate-legacy/shims/validatejs.js" - }, - "body": "\n", - "description": "Validates a single property using provided validation options ", "_curParam": { "types": [ { - "type": "string" - } - ], - "name": "name", - "description": "The key name of the value to validate. Used to prepend to\nerror messages, if any." - }, - "hide": true, - "title": "Once", - "returns": { - "types": [ - { - "type": "undefined" - }, - { - "type": "array" + "type": "can-query-logic/query" } ], - "description": "Returns undefined if no errors, otherwise returns\na list of errors.\n" + "name": "query", + "description": "" }, "_curReturn": { "types": [ { - "type": "undefined" - }, - { - "type": "array" + "type": "Promise" } ], - "description": "Returns undefined if no errors, otherwise returns\na list of errors.\n" + "description": "Promise resolves if and when the data has been successfully saved.\n\t " } }, - "validate": { + "can-connect/data/localstorage-cache/localstorage-cache.createData": { + "body": "\n", + "description": "\nCalled when an instance is created and should be added to cache.\n", + "title": "createData", + "name": "can-connect/data/localstorage-cache/localstorage-cache.createData", "type": "function", - "name": "validate", - "params": [], - "parent": "node_modules/can-validate-legacy/map/validate/validate.js", + "parent": "can-connect/data/localstorage-cache/localstorage-cache.data-methods", + "signatures": [ + { + "code": "connection.createData(props)", + "description": "\n\n Adds `props` to the stored list of instances. Then, goes\n through every set and adds props the sets it belongs to.\n\t ", + "params": [] + } + ] + }, + "can-connect/data/localstorage-cache/localstorage-cache.updateData": { + "body": "\n", + "description": "\nCalled when an instance is updated.\n", + "title": "updateData", + "name": "can-connect/data/localstorage-cache/localstorage-cache.updateData", + "type": "function", + "parent": "can-connect/data/localstorage-cache/localstorage-cache.data-methods", + "signatures": [ + { + "code": "connection.updateData(props)", + "description": "\n\n Overwrites the stored instance with the new props. Then, goes\n through every set and adds or removes the instance if it belongs or not.\n\t ", + "params": [] + } + ] + }, + "can-connect/data/localstorage-cache/localstorage-cache.destroyData": { "src": { - "line": 154, - "codeLine": 162, - "path": "node_modules/can-validate-legacy/map/validate/validate.js" + "line": 213, + "codeLine": 227, + "path": "node_modules/can-local-store/can-local-store.js" }, + "type": "function", "body": "\n", - "description": "Runs validation on the entire map instance. Actual behavior of \"validate all\" is defined by the registered shim.\n\n", - "_curParam": { - "types": [ - { - "type": "Object", - "options": [] - } - ], - "name": "options", - "description": "Raw validation options. They will be processed since\nnot all options are valid for ValidateJS. It should be a map of property keys\nwhich contain the respective validation properties." - }, - "hide": true, - "title": "Validate", - "returns": { - "types": [ - { - "type": "undefined" - }, - { - "type": "array" - } - ], - "description": "Returns undefined if no errors, otherwise returns\na list of errors.\n" - }, - "_curReturn": { - "types": [ - { - "type": "undefined" - }, - { - "type": "array" - } - ], - "description": "Returns undefined if no errors, otherwise returns\na list of errors.\n" - }, - "deprecated": [ + "description": "\nCalled when an instance should be removed from the cache.\n", + "title": "destroyData", + "name": "can-connect/data/localstorage-cache/localstorage-cache.destroyData", + "parent": "can-connect/data/localstorage-cache/localstorage-cache.data-methods", + "signatures": [ { - "version": "1.0", - "description": "`validate` is deprecated and will be removed in version 1.0.\nUse `_validate` instead.\n" + "code": "connection.destroyData(props)", + "description": "\n\n Goes through each set of data and removes any data that matches\n `props`'s [can-connect/base/base.id]. Finally removes this from the instance store.\n\t ", + "params": [] } ] }, - "can-types": { - "name": "can-types", - "type": "module", - "parent": "can-typed-data", + "can-local-store.data-methods": { + "name": "can-local-store.data-methods", + "title": "data methods", + "type": "group", + "parent": "can-local-store", + "description": "", + "order": 0 + }, + "can-local-store": { "src": { - "line": 6, - "codeLine": 27, - "path": "node_modules/can-types/can-types.js" + "path": "node_modules/can-local-store/can-local-store.md" }, - "body": "\n## Use\n\n`can-types` exports an object with placeholder functions that\ncan be used to provide default types or test if something is of a certain type.\n\nFor example, `can-define/map/map` might overwrite `DefeaultMap` to return DefineMap\n\n```js\ntypes.DefaultMap = DefineMap;\n```\n\n", - "description": "A stateful container for CanJS type information. \n", - "title": "", - "types": [ - { - "type": "Object", - "options": [] - } - ], + "body": "\n\n## Use\n\n`can-local-store` is used as a store of query-able data. It can either be used on its own or\nas part of a [can-connect] cache connection.\n\n### Standalone use\n\nTo use `localStore`, first create one with a `queryLogic` instance:\n\n```js\nimport localStore from \"can-local-store\";\nimport QueryLogic from \"can-query-logic\";\n\n// Create a store\nvar todosStore = localStore({\n queryLogic: new QueryLogic({\n identity: [\"id\"]\n })\n});\n```\n\nThen populate the store with data:\n\n```js\ntodosStore.updateListData([\n {id: 1, name: \"dishes\", points: 2},\n {id: 2, name: \"lawn\", points: 8},\n {id: 3, name: \"trash\", points: 1},\n {id: 4, name: \"car wash\", points: 5},\n]);\n```\n\nThen you can query the store for data:\n\n```js\ntodosStore.getListData({\n filter: {points: {$gt: 1}},\n sort: \"name\",\n page: {start: 0, end: 1}\n})\n//-> {\n// data: [\n// {id: 4, name: \"car wash\", points: 5},\n// {id: 1, name: \"dishes\", points: 2}],\n// count: 3\n// }\n```\n\n### Use with connection\n\n\n`can-local-store` is often used with a caching strategy like [can-connect/fall-through-cache/fall-through-cache] or\n[can-connect/cache-requests/cache-requests] as their\n`cacheConnection`. The following gives an example of using it with the\n`connectFallThroughCache`:\n\n```js\nimport {\n DefineMap,\n QueryLogic,\n localStore,\n connectFallThroughCache,\n connectCanMap,\n connectRest,\n connectConstructor,\n connect\n} from \"can\";\n\n// Define a type\nconst Todo = DefineMap.extend(\"Todo\",{\n id: {identity: true, type:\"number\"},\n name: \"string\",\n complete: \"boolean\"\n});\n\n// Create a store\nvar todosStore = localStore({\n queryLogic: new QueryLogic(Todo),\n name: \"todos\"\n});\n\nvar todoConnection = connect([\n connectRest,\n connectMap,\n connectFallThroughCache,\n connectConstructor\n],\n{\n url: \"/services/todos\",\n cacheConnection: todosStore\n});\n```\n\n\n## Caching localStorage reads\n\nIf your data set is large, you might want to avoid reading and parsing localStorage on every\naccess to the local store. To avoid this, you can turn on `cacheLocalStorageReads` like:\n\n\n```js\nvar todosStore = localStore({\n queryLogic: new QueryLogic({\n identity: [\"id\"]\n }),\n name: \"todos\",\n cacheLocalStorageReads: true\n});\n```\n\n", + "description": "\nCreate, update, delete and query data saved in localStorage.\n", + "type": "module", + "title": "can-local-store", + "name": "can-local-store", + "parent": "can-data-modeling", "collection": "can-infrastructure", "package": { "author": { - "name": "Bitovi", - "email": "contact@bitovi.com", - "url": "http://bitovi.com" + "name": "Core DoneJS Team", + "email": "core@donejs.com", + "url": "http://donejs.com" }, "bugs": { - "url": "https://github.com/canjs/can-types/issues" + "url": "https://github.com/canjs/can-local-store/issues" }, "bundleDependencies": false, "dependencies": { - "can-globals": "<2.0.0", - "can-log": "^1.0.0", - "can-namespace": "1.0.0", - "can-reflect": "^1.0.0", - "can-symbol": "^1.0.0" + "can-diff": "<2.0.0", + "can-memory-store": "<2.0.0", + "can-namespace": "^1.0.0", + "can-query-logic": "<2.0.0", + "can-reflect": "^1.13.4", + "can-sort-object": "^1.0.1" }, "deprecated": false, - "description": "A stateful container for CanJS type information", + "description": "A localStorage database for the client", "devDependencies": { - "detect-cyclic-packages": "^1.1.0", + "can-set-legacy": "<2.0.0", "jshint": "^2.9.1", - "steal": "^1.2.10", - "steal-qunit": "^1.0.1", - "steal-tools": "^1.1.2", - "testee": "^0.8.0" + "steal": "^2.2.1", + "steal-qunit": "^2.0.0", + "steal-tools": "^2.2.1", + "testee": "^0.9.0" }, "homepage": "http://canjs.com", "keywords": [ "canjs", - "canjs-plugin", - "donejs" + "donejs", + "donejs-plugin" ], - "main": "can-types", - "name": "can-types", + "license": "MIT", + "main": "can-local-store", + "name": "can-local-store", "repository": { "type": "git", - "url": "git://github.com/canjs/can-types.git" + "url": "git://github.com/canjs/can-local-store.git" }, "scripts": { "build": "node build.js", - "detect-cycle": "detect-cyclic-packages --ignore done-serve", + "develop": "done-serve --static --develop --port 8080", "jshint": "jshint ./*.js --config", - "postversion": "git push --tags && git checkout master && git branch -D release && git push", + "postpublish": "git push --tags && git checkout master && git branch -D release && git push", "preversion": "npm test && npm run build", "release:major": "npm version major && npm publish", "release:minor": "npm version minor && npm publish", "release:patch": "npm version patch && npm publish", - "release:pre": "npm version prerelease && npm publish --tag=pre", - "test": "npm run detect-cycle && npm run jshint && npm run testee", - "testee": "testee test/test.html --browsers firefox", - "version": "git commit -am \"Update dist for release\" && git checkout -b release && git add -f dist/" + "test": "npm run jshint && npm run testee", + "testee": "testee test.html --browsers firefox", + "version": "git commit -am \"Update version number\" && git checkout -b release && git add -f dist/" }, - "version": "1.4.0" - }, - "comment": " " - }, - "can-types.DefaultMap": { - "name": "can-types.DefaultMap", - "type": "property", - "parent": "can-types", - "src": { - "line": 90, - "codeLine": 98, - "path": "node_modules/can-types/can-types.js" + "steal": { + "main": "can-local-store", + "configDependencies": [ + "live-reload" + ], + "npmIgnore": [ + "testee", + "generator-donejs", + "donejs-cli", + "steal-tools" + ] + }, + "version": "1.0.1" }, - "body": "", - "description": "\n", - "types": [ + "signatures": [ { - "type": "Map", - "description": "\n\n The default map type to create if a map is needed. If both [can-map] and [can-define/map/map]\n are imported, the default type will be [can-define/map/map].\n " + "code": "localStore( baseConnection )", + "description": "\n\nCreate a database-like store of a single data type. For example:\n\n```js\nimport localStore from \"can-local-store\";\nimport QueryLogic from \"can-query-logic\";\n\n// Create a store\nvar todosStore = localStore({\n queryLogic: new QueryLogic({\n identity: [\"id\"]\n }),\n name: \"todos\"\n});\n\n// Add a list of data to the store\ntodosStore.updateListData(...);\n// Get a list of data from the store\ntodosStore.getListData(...)\n// Create a record in the store\ntodosStore.createData(...)\n// Get a record in the store\ntodosStore.getData(...)\n// Update a record in the store\ntodosStore.updateData(...)\n// Remove a record from the store\ntodosStore.destroyData(...)\n// Clear all records from the store\ntodosStore.clear()\n// Get the queries that are currently stored\ntodosStore.getQueries()\n```\n", + "params": [ + { + "types": [ + { + "type": "Object", + "options": [] + } + ], + "optional": true, + "name": "baseConnection", + "description": "A base [can-connect] connection or a settings object. `baseConnection`\n must have:\n - a `queryLogic` property that references a [can-query-logic] instance. The `can-query-logic`\n instance is used to determine the behavior of [can-local-store.getListData].\n - a unique `name` property used as a key to store data in localStorage.\n\n It can optionally have:\n - a `cacheLocalStorageReads` property. When set to `true`, prevents reading from localStorage and parsing the result on\n every read.\n" + } + ] } ], - "title": "DefaultMap" - }, - "can-types.DefaultList": { - "name": "can-types.DefaultList", - "type": "property", - "parent": "can-types", - "src": { - "line": 99, - "codeLine": 107, - "path": "node_modules/can-types/can-types.js" + "_curParam": { + "types": [ + { + "type": "Object", + "options": [] + } + ], + "optional": true, + "name": "baseConnection", + "description": "A base [can-connect] connection or a settings object. `baseConnection`\n must have:\n - a `queryLogic` property that references a [can-query-logic] instance. The `can-query-logic`\n instance is used to determine the behavior of [can-local-store.getListData].\n - a unique `name` property used as a key to store data in localStorage.\n\n It can optionally have:\n - a `cacheLocalStorageReads` property. When set to `true`, prevents reading from localStorage and parsing the result on\n every read.\n" }, - "body": "", - "description": "\n", + "comment": " " + }, + "can-log": { + "body": "\n", + "description": "\nUtilities for logging to the console.\n", + "type": "module", + "title": "log", "types": [ { - "type": "can-connect.List", - "description": "\n\n The default list type to create if a list is needed. If both [can-list] and [can-define/list/list]\n are imported, the default type will be [can-define/list/list].\n " + "type": "Object", + "options": [] } ], - "title": "DefaultList" + "name": "can-log", + "parent": "can-js-utilities", + "collection": "can-infrastructure", + "hide": true }, - "can-types.queueTask": { + "can-log.warn": { "type": "function", - "name": "can-types.queueTask", - "parent": "can-types", + "name": "can-log.warn", + "parent": "can-log", "src": { - "line": 108, - "codeLine": 114, - "path": "node_modules/can-types/can-types.js" + "line": 14, + "codeLine": 30, + "path": "node_modules/can-log/can-log.js" }, "body": "", - "description": "", - "title": "queueTask", + "description": " \nAdds a warning message to the console.\n\n```\nvar canLog = require(\"can-log\");\n\ncanLog.warn(\"something evil\");\n```\n\n", + "title": "warn", "signatures": [ { - "code": "types.queueTask(task)", - "description": "\n Run code that will be queued at the end of the current batch.", + "code": "canLog.warn(msg)", + "description": "", "params": [ { "types": [ { - "type": "Array", - "options": [] + "type": "String" } ], - "name": "task", - "description": "\n " + "name": "msg", + "description": "the message to be logged.\n" } ] } @@ -8010,282 +8661,266 @@ "_curParam": { "types": [ { - "type": "Array", - "options": [] + "type": "String" } ], - "name": "task", - "description": "\n " + "name": "msg", + "description": "the message to be logged.\n" } }, - "can-types.wrapElement": { + "can-log.log": { "type": "function", - "name": "can-types.wrapElement", - "parent": "can-types", + "name": "can-log.log", + "parent": "can-log", "src": { - "line": 118, - "codeLine": 126, - "path": "node_modules/can-types/can-types.js" + "line": 41, + "codeLine": 57, + "path": "node_modules/can-log/can-log.js" }, "body": "", - "description": "", - "title": "wrapElement", + "description": " Adds a message to the console.\n\n```\nvar canLog = require(\"can-log\");\n\ncanLog.log(\"hi\");\n```\n\n", + "title": "log", + "hide": true, "signatures": [ { - "code": "types.wrapElement(element)", - "description": "\n Wraps an element into an object useful by DOM libraries ala jQuery.\n", + "code": "canLog.log(msg)", + "description": "", "params": [ { "types": [ { - "type": "Node" + "type": "String" } ], - "name": "element", - "description": "Any object inheriting from the [Node interface](https://developer.mozilla.org/en-US/docs/Web/API/Node)." + "name": "msg", + "description": "the message\n" } - ], - "returns": { - "types": [ - { - "type": "Object", - "options": [] - } - ], - "description": "A wrapped object.\n " - } + ] } ], "_curParam": { "types": [ { - "type": "Node" - } - ], - "name": "element", - "description": "Any object inheriting from the [Node interface](https://developer.mozilla.org/en-US/docs/Web/API/Node)." - }, - "_curReturn": { - "types": [ - { - "type": "Object", - "options": [] + "type": "String" } ], - "description": "A wrapped object.\n " + "name": "msg", + "description": "the message\n" } }, - "can-types.unwrapElement": { + "can-log.error": { "type": "function", - "name": "can-types.unwrapElement", - "parent": "can-types", + "name": "can-log.error", + "parent": "can-log", "src": { - "line": 129, - "codeLine": 137, - "path": "node_modules/can-types/can-types.js" + "line": 66, + "codeLine": 82, + "path": "node_modules/can-log/can-log.js" }, "body": "", - "description": "", - "title": "unwrapElement", + "description": " Adds an error message to the console.\n\n```\nvar canLog = require(\"can-log\");\n\ncanLog.error(new Error(\"Oh no!\"));\n```\n\n", + "title": "error", + "hide": true, "signatures": [ { - "code": "types.unwrapElement(object)", - "description": "\n Unwraps an object that contains an element within.\n", + "code": "canLog.error(err)", + "description": "", "params": [ { "types": [ { - "type": "Object", - "options": [] + "type": "String" + }, + { + "type": "Error" } ], - "name": "object", - "description": "Any object that can be unwrapped into a Node." + "name": "err", + "description": "The error to be logged.\n" } - ], - "returns": { - "types": [ - { - "type": "Node" - } - ], - "description": "A Node.\n " - } + ] } ], "_curParam": { "types": [ { - "type": "Object", - "options": [] - } - ], - "name": "object", - "description": "Any object that can be unwrapped into a Node." - }, - "_curReturn": { - "types": [ + "type": "String" + }, { - "type": "Node" + "type": "Error" } ], - "description": "A Node.\n " + "name": "err", + "description": "The error to be logged.\n" } }, - "can-value/methods": { - "name": "can-value/methods", - "title": "methods", - "type": "group", - "parent": "can-value", - "description": "", - "order": 0 - }, - "can-value": { + "can-make-map": { + "type": "module", + "name": "can-make-map", + "parent": "can-js-utilities", "src": { - "path": "node_modules/can-value/can-value.md" + "line": 1, + "codeLine": 13, + "path": "node_modules/can-make-map/can-make-map.js" }, - "body": "\n## Use\n\n### Observable from an initial value\n\nAt its simplest, [can-value.with] can be used to\ncreate an observable from another initial value.\nAs how an `age` observable being created in this next example:\n\n```js\nimport {value, Reflect as canReflect} from \"can\";\n\nconst age = value.with(15);\n\nconsole.log( age.value ); //-> 15\n```\n
    \n
    \n\nNotice that [can-reflect/observe.onValue] can be used\nto listen to changes. The following shows creating an \n`age` observable, reading it's value, then listening when \n`age` changes:\n\n```js\nimport {value, Reflect as canReflect} from \"can\";\n\nconst age = value.with(15);\n\nconst handler = newValue => {\n console.log( newValue ); //-> 18 ... time to Vote!\n};\n\ncanReflect.onValue(observable, handler);\nage.value = 18;\n\n```\n
    \n
    \n\n### Observable derived from other values\n\n[can-value.returnedBy] can be used to create an\nobservable value that derives its value from other observable values. When the\nderived values change, the observable's value will be updated automatically.\n\nThe following creates a `fullName` observable that derives its values from the\n`first` and `last` observables. The value of the observable is read with `fullName.value`.\nNotice how [can-reflect/observe.onValue] is used to listen when the observable value changes.\nWhen one of the values from which the observable derives its value changed:\n\n```js\nimport {value, Reflect as canReflect} from \"can\";\n\nconst first = value.with(\"Grace\");\nconst last = value.with(\"Murray\");\n\nconst fullName = value.returnedBy( () => {\n return first.value + \" \" + last.value;\n} );\n\nconsole.log( fullName.value ); //-> \"Grace Murray\"\n\nconst handler = newValue => {\n console.log( newValue ); //-> \"Grace Hopper\"\n};\n\ncanReflect.onValue(fullName, handler);\nlast.value = \"Hopper\";\n\n```\n
    \n
    \n\n### Bind to other objects\n\nUse `can-value` when you need an observable that can get or set a property on an object.\n\nIn the example below, we use [can-value.bind] to get an observable that\ncan get _and_ set `outer.inner.key`:\n\n```js\nimport {DefineMap, value} from \"can\";\n\nconst outer = new DefineMap({\n inner: {\n key: \"hello\"\n }\n});\n\nconst keyObservable = value.bind(outer, \"inner.key\");\n\n// reading `keyObservable.value`, we get the value at `outer.inner.key`\nconsole.log( keyObservable.value ); //-> \"hello\"\n\n// writing to `keyObservable.value` will change the value at `outer.inner.key`\nkeyObservable.value = \"aloha\";\nconsole.log( outer.inner.key ); //->\"aloha\"\n```\n
    \n\n[can-value.from] and [can-value.to] exist to create\nobservables that just get or just set properties on an object, respectively.\n\n", - "description": "Get an observable that’s bound to a specific property on another object. \n", - "type": "module", - "title": "", + "body": "", + "description": "Convert a comma-separated string into a plain JavaScript object. ", + "title": "can-make-map", "types": [ { - "type": "Object", - "options": [], - "description": "\n\n`can-value` exports an object with the following methods:\n\n```js\n{\n bind(object, keyPath)\n // Returns an observable for getting and setting a property on an object.\n\n from(object, keyPath)\n // Returns an observable for only getting a property on an object.\n\n returnedBy(getter)\n // Creates an observable that derives its value from other observable values.\n\n to(object, keyPath)\n // Returns an observable for only setting a property on an object.\n\n with(initialValue)\n // Creates an observable with an initial value that can be read, written, and observed.\n}\n```\n" + "type": "function", + "returns": { + "types": [ + { + "type": "undefined" + } + ] + }, + "params": [] } ], - "name": "can-value", + "collection": "can-infrastructure", "package": { "author": { "name": "Bitovi", - "email": "core@donejs.com", - "url": "https://canjs.com/" + "email": "contact@bitovi.com", + "url": "https://www.bitovi.com/" }, "bugs": { - "url": "https://github.com/canjs/can-value/issues" + "url": "https://github.com/canjs/can-make-map/issues" }, "bundleDependencies": false, - "dependencies": { - "can-key": "<2.0.0", - "can-namespace": "1.0.0", - "can-observation": "^4.0.0", - "can-reflect": "^1.4.0", - "can-simple-observable": "^2.1.0" - }, + "dependencies": {}, "deprecated": false, - "description": "Observable values from other CanJS observables.", + "description": "Convert a comma-separated string into a plain JavaScript object.", "devDependencies": { - "can-reflect-dependencies": "^1.0.0", - "can-simple-map": "^4.0.1", + "detect-cyclic-packages": "^1.1.0", + "done-serve": "^3.3.1", + "donejs-cli": "^3.1.1", + "generator-donejs": "^3.3.0", "jshint": "^2.9.1", - "steal": "^1.6.5", + "steal": "^2.2.1", "steal-qunit": "^2.0.0", - "steal-tools": "^1.11.3", + "steal-tools": "^2.2.1", "testee": "^0.9.0" }, - "homepage": "https://canjs.com/doc/can-value.html", - "license": "MIT", - "main": "can-value", - "name": "can-value", + "homepage": "https://canjs.com/", + "keywords": [ + "canjs", + "make", + "map", + "convert", + "string" + ], + "main": "can-make-map", + "name": "can-make-map", "repository": { "type": "git", - "url": "git://github.com/canjs/can-value.git" + "url": "git://github.com/canjs/can-make-map.git" }, "scripts": { "build": "node build.js", + "detect-cycle": "detect-cyclic-packages --ignore done-serve", + "develop": "done-serve --static --develop --port 8080", "jshint": "jshint ./*.js --config", "postpublish": "git push --tags && git checkout master && git branch -D release && git push", "preversion": "npm test && npm run build", "release:major": "npm version major && npm publish", "release:minor": "npm version minor && npm publish", "release:patch": "npm version patch && npm publish", - "test": "npm run jshint && npm run testee", - "testee": "testee test/test.html --browsers firefox", + "test": "npm run detect-cycle && npm run jshint && npm run testee", + "testee": "testee test.html --browsers firefox", "version": "git commit -am \"Update version number\" && git checkout -b release && git add -f dist/" }, "steal": { - "main": "can-value", + "main": "can-make-map", "configDependencies": [ "live-reload" ], "npmIgnore": [ - "steal-tools", - "testee" + "testee", + "generator-donejs", + "donejs-cli", + "steal-tools" ] }, - "version": "1.1.1" - }, - "parent": "can-observables", - "collection": "can-core", - "outline": { - "depth": 2 + "version": "1.2.2" }, - "comment": " ", - "codepen": [ - [ - "\"can\"", - "\"//unpkg.com/can@5/core.mjs\"" - ], - [ - "\"can/everything\"", - "\"//unpkg.com/can@5/everything.mjs\"" - ], - [ - "\"can/demos/technology-overview/mock-url\"", - "\"//unpkg.com/mock-url@^5.0.0/mock-url.mjs\"" - ], - [ - "\"can/demos/technology-overview/route-mini-app-components\"", - "\"//unpkg.com/route-mini-app@^5.0.0/components.mjs\"" - ], - [ - "return steal.import(", - "return import(" + "signatures": [ + { + "code": "makeMap( string )", + "description": "", + "params": [ + { + "types": [ + { + "type": "String" + } + ], + "name": "string", + "description": "A comma separated list of values" + } + ], + "returns": { + "types": [ + { + "type": "Object", + "options": [] + } + ], + "description": "A JavaScript object with the same keys as the passed-in comma-separated values\n\nmakeMap takes a comma-separated string (can-list, NodeList, etc.) and converts it to a JavaScript object\n" + } + } + ], + "_curParam": { + "types": [ + { + "type": "String" + } ], - [ - "\"can/demos/technology-overview/page-login\"", - "\"//unpkg.com/route-mini-app@^5.0.0/page-login.mjs\"" + "name": "string", + "description": "A comma separated list of values" + }, + "_curReturn": { + "types": [ + { + "type": "Object", + "options": [] + } ], - [ - "`can/demos/technology-overview/page-${this.page}`", - "`//unpkg.com/route-mini-app@^5.0.0/page-${this.page}.mjs`" - ] - ] + "description": "A JavaScript object with the same keys as the passed-in comma-separated values\n\nmakeMap takes a comma-separated string (can-list, NodeList, etc.) and converts it to a JavaScript object\n" + } }, - "can-vdom.modules": { - "name": "can-vdom.modules", - "title": "modules", - "type": "group", - "parent": "can-vdom", - "description": "", - "order": 0 - }, - "can-vdom.types": { - "name": "can-vdom.types", - "title": "types", - "type": "group", - "parent": "can-vdom", - "description": "", - "order": 0 + "can-make-rest": { + "src": { + "path": "node_modules/can-make-rest/can-make-rest.md" + }, + "body": "\nMake restful urls and methods from a resource\n\n", + "description": "\n# can-make-rest\n", + "name": "can-make-rest", + "type": "page", + "hide": true }, - "can-vdom": { + "can-map": { "src": { - "path": "node_modules/can-vdom/can-vdom.md" + "path": "node_modules/can-map/docs/map.md" }, - "body": "\n\n\n## Shiming a browser environment\n\nImporting `can-vdom` will shim a browser-like environment into Node's globals. Use this approach to run code that expects a global `window` and/or `document` object.\n\n```js\nrequire( \"can-vdom\" );\n\ntypeof window; // \"object\"\n\ntypeof window.addEventListener; // \"function\"\n\ndocument.getElementById( \"foo\" ); // undefined\n```\n\n## Loading as a module\n\nIf you want to prevent setting globals you can load `can-vdom/make-window/make-window` directly:\n\n```js\nimport makeWindow from \"can-vdom/make-window/make-window\";\n\nconst myWindow = makeWindow( global );\n```\n\n", - "description": "A browser-lite environment for Node.js or a worker thread. \n", + "body": "\n## Use\n\nWatch this video to see an example of creating an ATM machine using can.Map:\n\n\n\n\n`Map` provides a way for you to listen for and keep track of changes\nto objects. When you use the getters and setters provided by `Map`,\nevents are fired that you can react to. `Map` also has support for\nworking with deep properties. Observable arrays are also available with\n`[can-list]`, which is based on `Map`.\n\n## Working with Observes\n\nTo create an Observe, use `new Map([props])`. This will return a\ncopy of `props` that emits events when its properties are changed with\n`[can-map.prototype.attr attr]`.\n\nYou can read the values of properties on Observes directly, but you should\nnever set them directly. You can also read property values using `attr`.\n\n\n var aName = {a: 'Alexis'},\n map = new can.Map(aName);\n\n // Observes are copies of data:\n aName === map; // false\n\n // reading from an Observe:\n map.attr(); // {a: 'Alexis'}\n map.a; // 'Alexis'\n map.attr('a'); // 'Alexis'\n\n // setting an Observe's property:\n map.attr('a', 'Alice');\n map.a; // Alice\n\n // removing an Observe's property;\n map.removeAttr('a');\n map.attr(); // {}\n\n // Don't do this!\n map.a = 'Adam'; // wrong!\n\n\nFind out more about manipulating properties of a map under\n[can.Map.prototype.attr attr] and [can.Map.prototype.removeAttr removeAttr].\n\n## Listening to changes\n\nThe real power of maps comes from being able to react to\nproperties being added, set, and removed. Maps emit events when\nproperties are changed that you can bind to.\n\n`Map` has two types of events that fire due to changes on a map:\n- the _change_ event fires on every change to a map.\n- an event named after the property name fires on every change to that property.\n\n\n var o = new Map({});\n o.bind('change', function(ev, attr, how, newVal, oldVal) {\n console.log('Something on o changed.');\n });\n o.bind('a', function(ev, newVal, oldVal) {\n console.log('a was changed.');\n });\n\n o.attr('a', 'Alexis'); // 'Something on o changed.'\n // 'a was changed.'\n o.attr({\n 'a': 'Alice', // 'Something on o changed.' (for a's change)\n 'b': 'Bob' // 'Something on o changed.' (for b's change)\n }); // 'a was changed.'\n\n o.removeAttr('a'); // 'Something on o changed.'\n // 'a was changed.'\n\n\nFor more detail on how to use these events, see [can.Map.prototype.bind bind] and\n[can.Map.prototype.unbind unbind]. There is also a plugin called [can.Map.delegate]\nthat makes binding to specific types of events easier:\n\n\n var o = new Map({});\n o.delegate('a', 'add', function(ev, newVal, oldVal) {\n console.log('a was added.');\n });\n o.delegate('a', 'set', function(ev, newVal, oldVal) {\n console.log('a was set.');\n });\n o.delegate('a', 'remove', function(ev, newVal, oldVal) {\n console.log('a was removed.');\n });\n o.delegate('a', 'change', function(ev, newVal, oldVal) {\n console.log('a was changed.');\n });\n\n o.attr('a', 'Alexis'); // 'a was added.'\n // 'a was changed.'\n\n o.attr('a', 'Alice'); // 'a was set.'\n // 'a was changed.'\n\n o.removeAttr('a'); // 'a was removed.'\n // 'a was changed.'\n\n## Object.prototype.watch\n\nDue to a method available on the base Object prototype called \"watch\", refrain from\nusing properties with the same name on Gecko based browsers as there will be a\ncollision. [Source](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/watch)\n\n", + "description": "Create observable objects. \n", + "name": "can-map", "type": "module", - "title": "", "types": [ { - "type": "undefined", - "description": "\n\nThe `can-vdom` module does not export anything, but it changes the current\nenvironment to have the limited subset of browser environment behavior and\nfunctionality needed to support CanJS templates and other behavior without\na native DOM.\n\n```js\nrequire( \"can-vdom\" );\n\nwindow === global; // true\n\ndocument.getElementsByTagName( \"body\" ); // [HTMLBodyElement]\n```\n\n`can-vdom` decorates the environment `global` to include:\n\n - a non-functional `navigator`, `location`, and `history` object.\n - a limitedly functional `document` with basic `Node` behavior, event binding and dispatching.\n\n\n" + "type": "constructor" } ], - "name": "can-vdom", - "parent": "can-polyfills", - "collection": "can-ecosystem", + "inherits": "can", + "parent": "can-observables", + "collection": "can-legacy", + "test": "can/map/test.html", + "plugin": "can/map", + "release": "2.0", + "link": "../docco/map/map.html docco", "package": { "author": { "name": "Bitovi", @@ -8293,176 +8928,122 @@ "url": "http://bitovi.com" }, "bugs": { - "url": "https://github.com/canjs/can-vdom/issues" + "url": "https://github.com/canjs/can-map/issues" }, "bundleDependencies": false, "dependencies": { "can-assign": "^1.0.0", - "can-globals": "^1.0.0", + "can-cid": "^1.1.2", + "can-compute": "^4.0.0", + "can-construct": "^3.5.4", + "can-event-queue": "^1.0.0", "can-log": "^1.0.0", - "can-simple-dom": "^1.6.1", - "can-view-parser": "^4.0.0" + "can-namespace": "^1.0.0", + "can-observation-recorder": "^1.0.2", + "can-queues": "^1.0.0", + "can-reflect": "^1.7.2", + "can-simple-observable": "^2.0.0", + "can-single-reference": "^1.0.0", + "can-stache-key": "^1.0.0", + "can-symbol": "^1.4.1", + "can-types": "^1.1.0" }, "deprecated": false, - "description": "A browser-lite environment for nodejs", + "description": "Observable Objects", "devDependencies": { - "bit-docs": "0.0.7", - "can-test-helpers": "^1.1.2", - "can-util": "^3.9.0", - "chai": "^4.1.2", + "can-observation": "^4.0.0", + "can-reflect-tests": "^1.0.0", + "can-simple-observable": "^2.0.0", + "can-test-helpers": "^1.1.4", "detect-cyclic-packages": "^1.1.0", - "done-serve": "^2.0.0", - "donejs-cli": "^1.0.1", - "generator-donejs": "^1.0.5", "jshint": "^2.9.1", - "mocha": "^4.0.0", - "steal": "^1.2.10", - "steal-mocha": "^1.0.0", - "steal-tools": "^1.1.2", - "testee": "^0.8.0" + "steal": "^2.1.3", + "steal-qunit": "^2.0.0", + "steal-tools": "^2.0.4", + "testee": "^0.9.0" }, "homepage": "http://canjs.com", "keywords": [ - "donejs", - "canjs" + "canjs", + "canjs-plugin", + "donejs" ], - "main": "can-vdom.js", - "name": "can-vdom", + "main": "can-map", + "name": "can-map", "repository": { "type": "git", - "url": "git://github.com/canjs/can-vdom.git" + "url": "git://github.com/canjs/can-map.git" }, "scripts": { - "build": "node build.js", "detect-cycle": "detect-cyclic-packages --ignore done-serve", "develop": "done-serve --static --develop --port 8080", "jshint": "jshint ./*.js --config", - "postversion": "git push --tags && git checkout master && git branch -D release && git push", - "preversion": "npm test && npm run build", + "postpublish": "git push --tags && git push", + "preversion": "npm test", "release:major": "npm version major && npm publish", "release:minor": "npm version minor && npm publish", "release:patch": "npm version patch && npm publish", - "release:pre": "npm version prerelease && npm publish --tag=pre", - "test": "npm run detect-cycle && npm run test:node && npm run test:browser", - "test:browser": "testee test/test.html --browsers firefox --reporter Spec", - "test:node": "mocha test/test.js", - "testee": "testee test/test.html --browsers firefox", - "version": "git commit -am \"Update dist for release\" && git checkout -b release && git add -f dist/" + "release:pre": "npm version prerelease && npm publish --tag pre", + "test": "npm run detect-cycle && npm run jshint && npm run testee", + "testee": "testee test/test.html --browsers firefox" }, "steal": { - "main": "can-vdom", - "map": { - "./assert": "chai/chai" - }, - "meta": { - "chai/chai": { - "format": "global", - "exports": "chai.assert" - } - }, - "plugins": [ - "chai" + "configDependencies": [ + "live-reload" ] }, - "version": "4.4.1" - }, - "comment": " " - }, - "can/view/autorender": { - "src": { - "path": "node_modules/can-view-autorender/autorender.md" + "version": "4.3.12" }, - "body": "\n\n## Use\n\nAs long is this module is part of your CanJS build or imported with RequireJS, StealJS, or SystemJS,\n[can/view/autorender.can-autorender] will automatically look for `can-autorender` tags and render them. Once\nall templates have finished rendering, it will call any callbacks passed to `can.autorender()`.\n\nNote: Although `can-autorender` works on all HTML elements, using elements other than `script` tags will result in all attribute names being lowercased by the browser. This can cause `can-stache-bindings` to not work properly, so you should use `\n\n\t\n\t\n\t\n\t\n\t\n\t\n\n```\n\n## Rendered placement\n\nIf the template source is a `\n\t
    ...
    \n\n```\n\nBecomes:\n\n```\n\n\t\n\tHi!\n\t
    ...
    \n\n```\n\nIf the `\n\n\n\t
    ...
    \n\n```\n\nBecomes:\n\n```\n\n\t\n\n\n\t
    ...
    \n\tHi!\n\n```\n\nIf the template source is any other element, the element's contents will be replaced with the rendered result. For example:\n\n```\n\n\t
    \n\t\t{{message}}!\n\t
    \n\n```\n\nBecomes:\n\n```\n\n\t
    \n\t\tHi!\n\t
    \n\n```\n\n## Scope\n\nThe template is rendered with a [can.Map] made from the attributes of the\ntemplate source element. That `map` is available on the\ntemplate source element via [can.viewModel]. You can\nchange the map at any time:\n\n```\n\n\t\n\t\n\n```\n\nYou can change attributes on the element and it will update the\nviewModel too:\n\n```\n\n\t\n\t\n\n```\n\n\n\n## StealJS Use\n\nFor demo pages that require very little setup:\n\n```\n\n\t\n\t\n\n```\n\nFor demo pages that require a little custom setup:\n\n```\n\n\t\n\t\n\n```\n\n\n\n\n\n## Errors\n\nError callbacks will be called if a template has a parsing error or\na [can/view/stache/system.import] fails.\n\n", - "description": "\nA module that automatically renders script and other elements with\nthe [can/view/autorender.can-autorender] attribute. This function is useful to know when\nthe templates have finished rendering.\n", - "type": "module", - "title": "can.autorender", - "types": [ - { - "type": "function", - "returns": { - "types": [ - { - "type": "undefined" - } - ] - }, - "params": [] - } - ], - "name": "can/view/autorender", - "parent": "can.view.plugins", - "hide": true, "signatures": [ { - "code": "can.autorender(succcess, error)", - "description": "\n\n\tRegisters functions to callback when all templates successfully render or an error in rendering happens.\n", + "code": "new Map([props])", + "description": "\n\nCreates a new instance of can.Map.\n", "params": [ { "types": [ { - "type": "function", - "returns": { - "types": [ - { - "type": "undefined" - } - ] - }, - "params": [] - } - ], - "name": "success", - "description": "A function to callback when all autorendered templates have been rendered\nsuccessfully.\n" - }, - { - "types": [ - { - "type": "function", - "returns": { - "types": [ - { - "type": "undefined" - } - ] - }, - "params": [] + "type": "Object", + "options": [] } ], "optional": true, - "name": "error", - "description": "A function to callback if a template was not rendered successfully.\n" + "name": "props", + "description": "Properties and values to seed the Observe with." } - ] + ], + "returns": { + "types": [ + { + "type": "can.Map" + } + ], + "description": "An instance of `can.Map` with the properties from _props_.\n" + } + }, + { + "code": "Map.extend([name,] [staticProperties,] instanceProperties)", + "description": "\n\nCreates a new extended constructor function.\n\n", + "params": [] } ], - "_curParam": { + "_curReturn": { "types": [ { - "type": "function", - "returns": { - "types": [ - { - "type": "undefined" - } - ] - }, - "params": [] + "type": "can.Map" } ], - "optional": true, - "name": "error", - "description": "A function to callback if a template was not rendered successfully.\n" + "description": "An instance of `can.Map` with the properties from _props_.\n" }, "comment": " " }, - "can-view-autorender": { + "can-map-compat": { "src": { - "path": "node_modules/can-view-autorender/can-view-autorender.md" + "path": "node_modules/can-map-compat/can-map-compat.md" }, - "body": "\n\n## Use\n\nAs long is this module is part of your CanJS build or imported with RequireJS, StealJS, or SystemJS,\n[can-view-autorender] will automatically look for `can-autorender` tags and render them. Once\nall templates have finished rendering, it will call any callbacks passed to `can.autorender()`.\n\nNote: Although `can-autorender` works on all HTML elements, using elements other than `script` tags will result in all attribute names being lowercased by the browser. This can cause `can-stache-bindings` to not work properly, so you should use `\n\n \n \n \n \n \n \n\n```\n\n## Rendered placement\n\nIf the template source is a `\n
    ...
    \n\n```\n\nBecomes:\n\n```\n\n \n Hi!\n
    ...
    \n\n```\n\nIf the `\n\n\n
    ...
    \n\n```\n\nBecomes:\n\n```\n\n \n\n\n
    ...
    \n Hi!\n\n```\n\nIf the template source is any other element, the element's contents will be replaced with the rendered result. For example:\n\n```\n\n
    \n {{message}}!\n
    \n\n```\n\nBecomes:\n\n```\n\n
    \n Hi!\n
    \n\n```\n\n## Scope\n\nThe template is rendered with a [can.Map] made from the attributes of the\ntemplate source element. That `map` is available on the\ntemplate source element via [can.viewModel]. You can\nchange the map at any time:\n\n```\n\n \n \n\n```\n\nYou can change attributes on the element and it will update the\nviewModel too:\n\n```\n\n \n \n\n```\n\n\n\n## StealJS Use\n\nFor demo pages that require very little setup:\n\n```\n\n \n \n\n```\n\nFor demo pages that require a little custom setup:\n\n```\n\n \n \n \n\n```\n\n\n\n\n\n## Errors\n\nError callbacks will be called if a template has a parsing error or\na [can/view/stache/system.import] fails.\n\n", - "description": "\nA module that automatically renders script and other elements with\nthe `can-autorender` attribute. This function is useful to know when the templates have finished rendering.\n", + "body": "", + "description": "", "type": "module", - "title": "can-view-autorender", + "title": "", "types": [ { "type": "function", @@ -8476,417 +9057,498 @@ "params": [] } ], - "name": "can-view-autorender", + "name": "can-map-compat", + "parent": "can-observables", + "collection": "can-ecosystem", "package": { "author": { - "name": "Bitovi", - "email": "contact@bitovi.com", - "url": "http://bitovi.com" + "name": "DoneJS Contributors", + "email": "team@donejs.com", + "url": "https://donejs.com/" }, "bugs": { - "url": "https://github.com/canjs/can-view-autorender/issues" + "url": "https://github.com/canjs/can-map-compat/issues" }, "bundleDependencies": false, "dependencies": { - "can-dom-events": "^1.2.0", - "can-import-module": "^1.0.0", - "can-namespace": "1.0.0", - "can-reflect": "^1.15.2", - "can-string": "<2.0.0", - "can-view-model": "^4.0.0" + "can-key": "^1.2.0", + "can-log": "^1.0.0", + "can-reflect": "^1.17.4" }, "deprecated": false, - "description": "Automatically render templates found in the document", + "description": "Makes observables compatible with can-map", "devDependencies": { - "bit-docs": "0.0.8-0", - "can-component": "^4.0.0", - "can-define": "^2.0.0", - "can-stache": "^4.0.0", - "detect-cyclic-packages": "^1.1.0", + "can-define": "^1.5.6", + "can-observe": "^2.2.0", "jshint": "^2.9.1", - "steal": "^1.2.10", + "steal": "^2.0.0", "steal-qunit": "^2.0.0", - "steal-tools": "^1.1.2", - "testee": "^0.9.0" + "testee": "^0.9.1" }, - "homepage": "https://canjs.com", + "homepage": "https://canjs.com/", "keywords": [ "canjs", - "canjs-plugin", - "donejs" + "donejs-plugin", + "can-map", + "can-define" ], - "main": "can-view-autorender", - "name": "can-view-autorender", + "license": "MIT", + "main": "can-map-compat.js", + "name": "can-map-compat", "repository": { "type": "git", - "url": "git://github.com/canjs/can-view-autorender.git" + "url": "git://github.com/canjs/can-map-compat.git" }, "scripts": { - "build": "node build.js", - "detect-cycle": "detect-cyclic-packages --ignore done-serve", "jshint": "jshint ./*.js --config", - "postversion": "git push --tags && git checkout master && git branch -D release && git push", - "preversion": "npm test && npm run build", + "postpublish": "git push --tags && git push", + "preversion": "npm test", "release:major": "npm version major && npm publish", "release:minor": "npm version minor && npm publish", "release:patch": "npm version patch && npm publish", - "release:pre": "npm version prerelease && npm publish --tags=pre", - "test": "npm run detect-cycle && npm run jshint && npm run testee", - "testee": "testee test/test.html --browsers firefox", - "version": "git commit -am \"Update dist for release\" && git checkout -b release && git add -f dist/" + "test": "npm run jshint && npm run testee", + "testee": "testee test.html --browsers firefox", + "version": "git commit -am \"Update version number\"" }, - "version": "5.0.4" + "version": "1.1.1" }, - "parent": "can-views", - "collection": "can-ecosystem", "signatures": [ { - "code": "autorender(success, error)", - "description": "\n\n Registers functions to callback when all templates successfully render or an error in rendering happens.\n", + "code": "makeMapCompat(Type)", + "description": "\n\nMakes an observable type, such as [can-define/map/map] or an [can-observe.Object ObserveObject] compatible with the [can-map] APIs such as [can-map.prototype.attr] and [can-map.prototype.removeAttr].\n\n```js\nimport makeMapCompat from \"can-map-compat\";\nimport DefineMap from \"can-define/map/map\";\n\nvar MyMap = makeMapCompat(DefineMap.extend({\n count: {\n type: \"number\",\n default: 0\n }\n}));\n\nvar map = new MyMap({ count: 0 });\n\nmap.attr(\"count\", 1);\nconsole.log(map.attr(\"count\")); // -> 1\n\n\nmap.removeAttr(\"count\");\nconsole.log(map.attr(\"count\")); // -> undefined\n```\n", "params": [ { "types": [ { - "type": "function", - "returns": { - "types": [ - { - "type": "undefined" - } - ] - }, - "params": [] - } - ], - "name": "success", - "description": "A function to callback when all autorendered templates have been rendered\nsuccessfully.\n" - }, - { - "types": [ - { - "type": "function", - "returns": { - "types": [ - { - "type": "undefined" - } - ] - }, - "params": [] + "type": "Object", + "options": [] } ], - "optional": true, - "name": "error", - "description": "A function to callback if a template was not rendered successfully.\n" + "name": "Type", + "description": "The __Type__ to make compatible with [can-map]." } - ] + ], + "returns": { + "types": [ + { + "type": "Object", + "options": [] + } + ], + "description": "The Type, with the can-map methods added.\n" + } } ], "_curParam": { "types": [ { - "type": "function", - "returns": { - "types": [ - { - "type": "undefined" - } - ] - }, - "params": [] + "type": "Object", + "options": [] } ], - "optional": true, - "name": "error", - "description": "A function to callback if a template was not rendered successfully.\n" + "name": "Type", + "description": "The __Type__ to make compatible with [can-map]." }, - "comment": " " + "_curReturn": { + "types": [ + { + "type": "Object", + "options": [] + } + ], + "description": "The Type, with the can-map methods added.\n" + } }, - "can-view-model": { - "src": { - "path": "node_modules/can-view-model/can-view-model.md" - }, - "body": "\n## Use\n\n**can-view-model** is used to get and set properties on an element’s ViewModel. Each element in the DOM can have an associated ViewModel. An example of this is a [can-component] and its associated [can-component.prototype.ViewModel].\n\nThis shows a Component and getting its ViewModel:\n\n```html\n\n ...\n\n```\n\n```js\nimport canViewModel from \"can-view-model\";\n\nconst element = document.querySelector( \"my-tabs\" );\nconst vm = canViewModel( element );\n```\n\nThe other signatures provide the ability to get and set properties on the ViewModel. For example, this sets the `foo` property on a component’s viewModel:\n\n```js\nimport canViewModel from \"can-view-model\";\n\nconst element = document.querySelector( \"my-tabs\" );\nconst vm = canViewModel( element );\n\ncanViewModel( element, \"foo\", \"bar\" );\n\nconsole.log( vm.foo, \"bar\" );\n```\n\n## Setting an element’s ViewModel\n\nOne thing that can-view-model does ***not*** do is provide a way to set what an element’s ViewModel should be. To do that, use [can-util/dom/data/data] instead like so:\n\n```js\nimport domData from \"can-dom-data\";\nimport DefineMap from \"can-define/map/map\";\n\nconst element = document.querySelector( \"#my-id\" );\n\nconst myVm = new DefineMap();\n\ndomData.set( element, \"viewModel\", myVm );\n```\n\n", - "description": "Gets the ViewModel of an [element](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement). \n", - "type": "module", - "title": "can-view-model", - "types": [ + "can-memory-store.getQueries": { + "body": "\n\n## Use\n\n```js\nconnection.getSets() //-> Promise( [{type: \"completed\"},{user: 5}] )\n```\n\n\t \n", + "description": "\nReturns the queries contained within the cache.\n", + "title": "getQueries", + "name": "can-memory-store.getQueries", + "type": "function", + "parent": "can-memory-store.data-methods", + "signatures": [ { - "type": "function", + "code": "connection.getQueries()", + "description": "\n\n Returns the queries added by [can-memory-store.updateListData].\n", + "params": [], "returns": { "types": [ { - "type": "undefined" + "type": "Promise", + "template": [ + { + "types": [ + { + "type": "Array", + "template": [ + { + "types": [ + { + "type": "can-query-logic/query" + } + ] + } + ] + } + ] + } + ] } - ] - }, - "params": [] + ], + "description": "A promise that resolves to the list of queries.\n" + } } ], - "name": "can-view-model", - "parent": "can-views", - "collection": "can-infrastructure", - "package": { - "author": { - "name": "Bitovi", - "email": "contact@bitovi.com", - "url": "http://bitovi.com" - }, - "bundleDependencies": false, - "dependencies": { - "can-globals": "^1.0.0", - "can-namespace": "1.0.0", - "can-reflect": "^1.2.1", - "can-simple-map": "^4.0.0", - "can-symbol": "^1.5.0" - }, - "deprecated": false, - "description": "Gets or sets the view model of an element.", - "devDependencies": { - "detect-cyclic-packages": "^1.1.0", - "jshint": "^2.9.1", - "steal": "^1.0.1", - "steal-qunit": "^2.0.0", - "steal-tools": "^1.0.0", - "testee": "^0.9.0" - }, - "homepage": "https://canjs.com/doc/can-view-model.html", - "keywords": [ - "canjs", - "donejs" + "_curReturn": { + "types": [ + { + "type": "Promise", + "template": [ + { + "types": [ + { + "type": "Array", + "template": [ + { + "types": [ + { + "type": "can-query-logic/query" + } + ] + } + ] + } + ] + } + ] + } ], - "main": "can-view-model", - "name": "can-view-model", - "scripts": { - "detect-cycle": "detect-cyclic-packages --ignore done-serve", - "develop": "done-serve --static --develop --port 8080", - "jshint": "jshint ./*.js --config", - "postpublish": "git push --tags && git push", - "preversion": "npm test", - "release:major": "npm version major && npm publish", - "release:minor": "npm version minor && npm publish", - "release:patch": "npm version patch && npm publish", - "release:pre": "npm version prerelease && npm publish --tag pre", - "test": "npm run detect-cycle && npm run jshint && npm run testee", - "testee": "testee test/test.html --browsers firefox" - }, - "version": "4.0.3" + "description": "A promise that resolves to the list of queries.\n" }, + "comment": " " + }, + "can-memory-store.clear": { + "body": "\n", + "description": "\nResets the memory store so it contains nothing.\n", + "title": "clear", + "name": "can-memory-store.clear", + "type": "function", + "parent": "can-memory-store.data-methods", "signatures": [ { - "code": "canViewModel(element)", - "description": "\n\nGets the map instance associated with **element**, creating one as a [can-types.DefaultMap] if it doesn’t already exist, and returns the map.\n\n```js\nconst vm = canViewModel( element );\n\nconst vm2 = canViewModel( \"#element2id\" );\n\nconst vm3 = canViewModel( $( [ element3 ] ) );\n\nconst vm4 = canViewModel( document.querySelectorAll( \".element4class\" ) );\n```", + "code": "connection.clear()", + "description": "\n\n Removes all instances and lists being stored in memory.\n\n ```js\n memoryStore({queryLogic: new QueryLogic()});\n\n cacheConnection.updateInstance({id: 5, name: \"justin\"});\n\n cacheConnection.getData({id: 5}).then(function(data){\n data //-> {id: 5, name: \"justin\"}\n cacheConnection.clear();\n cacheConnection.getData({id: 5}).catch(function(err){\n err -> {message: \"no data\", error: 404}\n });\n });\n ```\n\n\t ", + "params": [] + } + ] + }, + "can-memory-store.getListData": { + "body": "\n", + "description": "\nGets a list of data from the memory store.\n", + "title": "getListData", + "name": "can-memory-store.getListData", + "type": "function", + "parent": "can-memory-store.data-methods", + "signatures": [ + { + "code": "connection.getListData(query)", + "description": "\n\n Goes through each query add by [can-memory-store.updateListData]. If\n `query` is a subset, uses [can-connect/base/base.queryLogic] to get the data for the requested `query`.\n", "params": [ { "types": [ { - "type": "HTMLElement" - }, - { - "type": "String" - }, - { - "type": "ArrayLike" + "type": "can-query-logic/query" } ], - "name": "element", - "description": "Any element in the DOM, represented by a reference to the element itself, a query selector string, or an Array-like holding the element in its zero index.\n" + "name": "query", + "description": "An object that represents the data to load.\n" } ], "returns": { "types": [ { - "type": "can-map" - }, - { - "type": "can-define/map/map" - }, - { - "type": "Object", - "options": [] + "type": "Promise", + "template": [ + { + "types": [ + { + "type": "can-connect.listData" + } + ] + } + ] } ], - "description": "The ViewModel associated with this element.\n" + "description": "A promise that resolves if `query` is a subset of\nsome data added by [can-memory-store.updateListData]. If it is not,\nthe promise is rejected.\n\t " } - }, + } + ], + "_curParam": { + "types": [ + { + "type": "can-query-logic/query" + } + ], + "name": "query", + "description": "An object that represents the data to load.\n" + }, + "_curReturn": { + "types": [ + { + "type": "Promise", + "template": [ + { + "types": [ + { + "type": "can-connect.listData" + } + ] + } + ] + } + ], + "description": "A promise that resolves if `query` is a subset of\nsome data added by [can-memory-store.updateListData]. If it is not,\nthe promise is rejected.\n\t " + } + }, + "can-connect/data/memory-cache.getListDataSync": { + "body": "\n\t \n", + "description": "\nSynchronously gets a query of data from the memory cache.\n", + "title": "getListDataSync", + "name": "can-connect/data/memory-cache.getListDataSync", + "type": "function", + "parent": "can-connect/data/memory-cache.data-methods", + "signatures": [ { - "code": "canViewModel(element, property)", - "description": "\n\nGets the map instance associated with **element**, creating one as a [can-types.DefaultMap] if it doesn’t already exist. Then, gets the **property** inside of the ViewModel and returns that.\n\n```\nvar foo = canViewModel(element, \"foo\");\n\nconsole.log(foo); // -> \"bar\"\n```\n", + "code": "connection.getListDataSync(query)", + "description": "", + "params": [] + } + ], + "hide": true + }, + "can-memory-store.updateListData": { + "body": "\n", + "description": "\nSaves a query of data in the cache.\n", + "title": "updateListData", + "name": "can-memory-store.updateListData", + "type": "function", + "parent": "can-memory-store.data-methods", + "signatures": [ + { + "code": "connection.updateListData(listData, query)", + "description": "\n\n Tries to merge this query of data with any other saved queries of data. If\n unable to merge this data, saves the query by itself.\n", "params": [ { "types": [ { - "type": "HTMLElement" - }, - { - "type": "String" - }, - { - "type": "ArrayLike" + "type": "can-connect.listData" } ], - "name": "element", - "description": "Any element in the DOM, represented by a reference to the element itself, a query selector string, or an Array-like holding the element in its zero index." + "name": "listData", + "description": "The data that belongs to `query`." }, { "types": [ { - "type": "String" + "type": "can-query-logic/query" } ], - "name": "property", - "description": "The property to get from the ViewModel.\n" + "name": "query", + "description": "The query `listData` belongs to." } ], "returns": { "types": [ { - "type": "*" + "type": "Promise" } ], - "description": "The value of the property on the ViewModel or undefined if the property doesn’t exist.\n" + "description": "Promise resolves if and when the data has been successfully saved.\n\t " } - }, + } + ], + "_curParam": { + "types": [ + { + "type": "can-query-logic/query" + } + ], + "name": "query", + "description": "The query `listData` belongs to." + }, + "_curReturn": { + "types": [ + { + "type": "Promise" + } + ], + "description": "Promise resolves if and when the data has been successfully saved.\n\t " + } + }, + "can-memory-store.getData": { + "body": "\n", + "description": "\nGet an instance's data from the memory cache.\n", + "title": "getData", + "name": "can-memory-store.getData", + "type": "function", + "parent": "can-memory-store.data-methods", + "signatures": [ { - "code": "canViewModel(element, property, value)", - "description": "\n\nGets the map instance associated with **element**, creating one as a [can-types.DefaultMap] if it doesn’t already exist. Sets the **property** on that map to **value**.\n\n```js\ncanViewModel( element, \"foo\", \"bar\" );\n\nconst foo = canViewModel( element, \"foo\" );\n\nconsole.log( foo ); // -> \"bar\"\n```\n", + "code": "connection.getData(params)", + "description": "\n\n Looks in the instance store for the requested instance.\n", "params": [ { "types": [ { - "type": "HTMLElement" - }, - { - "type": "String" - }, - { - "type": "ArrayLike" - } - ], - "name": "element", - "description": "Any element in the DOM, represented by a reference to the element itself, a query selector string, or an Array-like holding the element in its zero index." - }, - { - "types": [ - { - "type": "String" - } - ], - "name": "property", - "description": "The property that is being set on the ViewModel." - }, - { - "types": [ - { - "type": "*" + "type": "Object", + "options": [] } ], - "name": "value", - "description": "The value being set on the property.\n" + "name": "params", + "description": "An object that should have the [conenction.id] of the element\nbeing retrieved.\n" } ], "returns": { "types": [ { - "type": "HTMLElement" + "type": "Promise" } ], - "description": "The element.\n" + "description": "A promise that resolves to the item if the memory cache has this item.\nIf the memory cache does not have this item, it rejects the promise.\n\t " } } ], - "_curReturn": { + "_curParam": { "types": [ { - "type": "HTMLElement" + "type": "Object", + "options": [] } ], - "description": "The element.\n" + "name": "params", + "description": "An object that should have the [conenction.id] of the element\nbeing retrieved.\n" }, - "_curParam": { + "_curReturn": { "types": [ { - "type": "*" + "type": "Promise" } ], - "name": "value", - "description": "The value being set on the property.\n" - }, - "comment": " " + "description": "A promise that resolves to the item if the memory cache has this item.\nIf the memory cache does not have this item, it rejects the promise.\n\t " + } }, - "can-view-nodelist/methods": { - "name": "can-view-nodelist/methods", - "title": "methods", - "type": "group", - "parent": "can-view-nodelist", - "description": "", - "order": 0 + "can-memory-store.createData": { + "body": "\n", + "description": "\nCalled when an instance is created and should be added to cache.\n", + "title": "createData", + "name": "can-memory-store.createData", + "type": "function", + "parent": "can-memory-store.data-methods", + "signatures": [ + { + "code": "connection.createData(record)", + "description": "\n\n Adds `record` to the stored list of instances. Then, goes\n through every query and adds record the queries it belongs to.\n\t ", + "params": [] + } + ] }, - "can-view-nodelist/types": { - "name": "can-view-nodelist/types", - "title": "types", + "can-memory-store.updateData": { + "body": "\n", + "description": "\nCalled when an instance is updated.\n", + "title": "updateData", + "name": "can-memory-store.updateData", + "type": "function", + "parent": "can-memory-store.data-methods", + "signatures": [ + { + "code": "connection.updateData(record)", + "description": "\n\n Overwrites the stored instance with the new record. Then, goes\n through every query and adds or removes the instance if it belongs or not.\n\t ", + "params": [] + } + ] + }, + "can-memory-store.destroyData": { + "src": { + "line": 188, + "codeLine": 202, + "path": "node_modules/can-memory-store/can-memory-store.js" + }, + "type": "function", + "body": "\n", + "description": "\nCalled when an instance should be removed from the cache.\n", + "title": "destroyData", + "name": "can-memory-store.destroyData", + "parent": "can-memory-store.data-methods", + "signatures": [ + { + "code": "connection.destroyData(record)", + "description": "\n\n Goes through each query of data and removes any data that matches\n `record`'s [can-connect/base/base.id]. Finally removes this from the instance store.\n\t ", + "params": [] + } + ] + }, + "can-memory-store.data-methods": { + "name": "can-memory-store.data-methods", + "title": "data methods", "type": "group", - "parent": "can-view-nodelist", + "parent": "can-memory-store", "description": "", "order": 0 }, - "can-view-nodelist": { + "can-memory-store": { "src": { - "path": "node_modules/can-view-nodelist/can-view-nodelist.md" + "path": "node_modules/can-memory-store/can-memory-store.md" }, - "body": "", - "description": "Adds nesting of text nodes \n", + "body": "\n\n## Use\n\n`can-memory-store` is used as a store of query-able data. It can either be used on its own or\nas part of a [can-connect] cache connection.\n\n### Standalone use\n\nTo use `memoryStore`, first create one with a `queryLogic` instance:\n\n```js\nimport memoryStore from \"can-memory-store\";\nimport QueryLogic from \"can-query-logic\";\n\n// Create a store\nvar todosStore = memoryStore({\n queryLogic: new QueryLogic({\n identity: [\"id\"]\n })\n});\n```\n\nThen populate the store with data:\n\n```js\ntodosStore.updateListData([\n {id: 1, name: \"dishes\", points: 2},\n {id: 2, name: \"lawn\", points: 8},\n {id: 3, name: \"trash\", points: 1},\n {id: 4, name: \"car wash\", points: 5},\n]);\n```\n\nThen you can query the store for data:\n\n```js\ntodosStore.getListData({\n filter: {points: {$gt: 1}},\n sort: \"name\",\n page: {start: 0, end: 1}\n})\n//-> {\n// data: [\n// {id: 4, name: \"car wash\", points: 5},\n// {id: 1, name: \"dishes\", points: 2}],\n// count: 3\n// }\n```\n\n### Use with connection\n\n\n`can-memory-store` is often used with a caching strategy like [can-connect/fall-through-cache/fall-through-cache] or\n[can-connect/cache-requests/cache-requests] as their\n`cacheConnection`. The following gives an example of using it with the\n`connectFallThroughCache`:\n\n```js\nimport {\n DefineMap,\n QueryLogic,\n memoryStore,\n connectFallThroughCache,\n connectCanMap,\n connectRest,\n connectConstructor,\n connect\n} from \"can\";\n\n// Define a type\nconst Todo = DefineMap.extend(\"Todo\",{\n id: {identity: true, type:\"number\"},\n name: \"string\",\n complete: \"boolean\"\n});\n\n// Create a store\nvar todosStore = memoryStore({\n queryLogic: new QueryLogic(Todo)\n});\n\nvar todoConnection = connect([\n connectRest,\n connectMap,\n connectFallThroughCache,\n connectConstructor\n],\n{\n url: \"/services/todos\",\n cacheConnection: todosStore\n});\n```\n\n", + "description": "\nCreate, update, delete and query data saved in memory.\n", "type": "module", - "title": "", - "types": [ - { - "type": "Object", - "options": [], - "description": "\n\n`can-view-nodelist` is used to make sure nested live-binding\nsections are able to be cleaned up.\n\nConsider the following template:\n\n```html\n
    \n{{#if items.length}}\n Items:\n {{#items}}\n \n {{/items}}\n !\n{{/if}}\n
    \n```\n\nWhen `items.length` value changes to 0, the inner content should be removed and the `{{#items}}`\nbinding should be torn down.\n\n`can-view-nodelist` is used to maintain this structure so all nested bindings can be\nrecursively torn down. It's also used to know all the items that need to be removed.\n\nThe basic use is\n\nA `target` is going to be hydrated:\n\n```js\ntarget.hydrate( scope );\n```\n\nThis will call the callbacks on placeholder elements.\n\nThose callbacks register their placeholder like this:\n\n```js\nnodeLists.register( nodeList = [ placeholderElement ], null );\n```\n\nThen they render the content for the\nplaceholder. This will recursively repeat the same process\nof hydrating other targets, and registering placeholder\nelements.\n\nAfter the content renders, it will call:\n\n```js\n// this doesn't actually update the dom. But this will\n// detach any \"old\" nodeLists within `nodeList`\n// but oldNodes are all the nodes within the nodeLists\nconst oldNodes = nodeLists.update(\n\tnodeList,\n\trenderedContentFragment.childNodes );\n```\n\nThe children calling `.update()` end up adding to the parent `nodeList`'s `.replacements`\narray. `nodList` might look like:\n\n```\n[\n TEXT_NODE<> //original placeholder text node\n replacements: [\n [\n