{"action":"created","comment":{"url":"https://api.github.com/repos/plotly/plotly.js/pulls/comments/75356388","id":75356388,"diff_hunk":"@@ -0,0 +1,137 @@\n+/**\n+* Copyright 2012-2016, Plotly, Inc.\n+* All rights reserved.\n+*\n+* This source code is licensed under the MIT license found in the\n+* LICENSE file in the root directory of this source tree.\n+*/\n+\n+\n+'use strict';\n+\n+var Lib = require('./lib');\n+var basePlotAttributes = require('./plots/attributes');\n+\n+exports.modules = {};\n+exports.allTypes = [];\n+exports.allCategories = {};\n+exports.subplotsRegistry = {};\n+exports.transformsRegistry = {};\n+\n+/**\n+ * register a module as the handler for a trace type\n+ *\n+ * @param {object} _module the module that will handle plotting this trace type\n+ * @param {string} thisType\n+ * @param {array of strings} categoriesIn all the categories this type is in,\n+ *     tested by calls: traceIs(trace, oneCategory)\n+ * @param {object} meta meta information about the trace type\n+ */\n+exports.register = function(_module, thisType, categoriesIn, meta) {\n+    if(exports.modules[thisType]) {\n+        Lib.log('Type ' + thisType + ' already registered');\n+        return;\n+    }\n+\n+    var categoryObj = {};\n+    for(var i = 0; i < categoriesIn.length; i++) {\n+        categoryObj[categoriesIn[i]] = true;\n+        exports.allCategories[categoriesIn[i]] = true;\n+    }\n+\n+    exports.modules[thisType] = {\n+        _module: _module,\n+        categories: categoryObj\n+    };\n+\n+    if(meta && Object.keys(meta).length) {\n+        exports.modules[thisType].meta = meta;\n+    }\n+\n+    exports.allTypes.push(thisType);\n+};\n+\n+/**\n+ * register a subplot type\n+ *\n+ * @param {object} _module subplot module:\n+ *\n+ *      @param {string or array of strings} attr\n+ *          attribute name in traces and layout\n+ *      @param {string or array of strings} idRoot\n+ *          root of id (setting the possible value for attrName)\n+ *      @param {object} attributes\n+ *          attribute(s) for traces of this subplot type\n+ *\n+ * In trace objects `attr` is the object key taking a valid `id` as value\n+ * (the set of all valid ids is generated below and stored in idRegex).\n+ *\n+ * In the layout object, a or several valid `attr` name(s) can be keys linked\n+ * to a nested attribute objects\n+ * (the set of all valid attr names is generated below and stored in attrRegex).\n+ */\n+exports.registerSubplot = function(_module) {\n+    var plotType = _module.name;\n+\n+    if(exports.subplotsRegistry[plotType]) {\n+        Lib.log('Plot type ' + plotType + ' already registered.');\n+        return;\n+    }\n+\n+    // not sure what's best for the 'cartesian' type at this point\n+    exports.subplotsRegistry[plotType] = _module;\n+};\n+\n+/**\n+ * Get registered module using trace object or trace type\n+ *\n+ * @param {object||string} trace\n+ *  trace object with prop 'type' or trace type as a string\n+ * @return {object}\n+ *  module object corresponding to trace type\n+ */\n+exports.getModule = function(trace) {\n+    if(trace.r !== undefined) {\n+        Lib.warn('Tried to put a polar trace ' +\n+            'on an incompatible graph of cartesian ' +\n+            'data. Ignoring this dataset.', trace\n+        );\n+        return false;\n+    }\n+\n+    var _module = exports.modules[getTraceType(trace)];\n+    if(!_module) return false;\n+    return _module._module;\n+};\n+\n+/**\n+ * Determine if this trace type is in a given category\n+ *\n+ * @param {object||string} traceType\n+ *  a trace (object) or trace type (string)\n+ * @param {string} category\n+ *  category in question\n+ * @return {boolean}\n+ */\n+exports.traceIs = function(traceType, category) {\n+    traceType = getTraceType(traceType);\n+\n+    if(traceType === 'various') return false;  // FIXME","path":"src/registry.js","position":120,"original_position":119,"commit_id":"a1ea3658de01e04795ef3497f05325b97e907bd7","original_commit_id":"910e17c756062d95d50f3698008520802009663f","user":{"login":"etpinard","id":6675409,"avatar_url":"https://avatars.githubusercontent.com/u/6675409?v=3","gravatar_id":"","url":"https://api.github.com/users/etpinard","html_url":"https://github.com/etpinard","followers_url":"https://api.github.com/users/etpinard/followers","following_url":"https://api.github.com/users/etpinard/following{/other_user}","gists_url":"https://api.github.com/users/etpinard/gists{/gist_id}","starred_url":"https://api.github.com/users/etpinard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/etpinard/subscriptions","organizations_url":"https://api.github.com/users/etpinard/orgs","repos_url":"https://api.github.com/users/etpinard/repos","events_url":"https://api.github.com/users/etpinard/events{/privacy}","received_events_url":"https://api.github.com/users/etpinard/received_events","type":"User","site_admin":false},"body":"old plot.ly workspace hack to we need to keep :disappointed: ","created_at":"2016-08-18T17:55:53Z","updated_at":"2016-08-18T17:55:53Z","html_url":"https://github.com/plotly/plotly.js/pull/845#discussion_r75356388","pull_request_url":"https://api.github.com/repos/plotly/plotly.js/pulls/845","_links":{"self":{"href":"https://api.github.com/repos/plotly/plotly.js/pulls/comments/75356388"},"html":{"href":"https://github.com/plotly/plotly.js/pull/845#discussion_r75356388"},"pull_request":{"href":"https://api.github.com/repos/plotly/plotly.js/pulls/845"}}},"pull_request":{"url":"https://api.github.com/repos/plotly/plotly.js/pulls/845","id":81020099,"html_url":"https://github.com/plotly/plotly.js/pull/845","diff_url":"https://github.com/plotly/plotly.js/pull/845.diff","patch_url":"https://github.com/plotly/plotly.js/pull/845.patch","issue_url":"https://api.github.com/repos/plotly/plotly.js/issues/845","number":845,"state":"open","locked":false,"title":"Add registry of component modules","user":{"login":"etpinard","id":6675409,"avatar_url":"https://avatars.githubusercontent.com/u/6675409?v=3","gravatar_id":"","url":"https://api.github.com/users/etpinard","html_url":"https://github.com/etpinard","followers_url":"https://api.github.com/users/etpinard/followers","following_url":"https://api.github.com/users/etpinard/following{/other_user}","gists_url":"https://api.github.com/users/etpinard/gists{/gist_id}","starred_url":"https://api.github.com/users/etpinard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/etpinard/subscriptions","organizations_url":"https://api.github.com/users/etpinard/orgs","repos_url":"https://api.github.com/users/etpinard/repos","events_url":"https://api.github.com/users/etpinard/events{/privacy}","received_events_url":"https://api.github.com/users/etpinard/received_events","type":"User","site_admin":false},"body":"This PR introduces a new registry, this one for component modules. For those keeping track, we now have registries for trace, plot (aka subplot aka base plot), transform and component modules.\r\n\r\nThis new component registry, will allow us to remove (some, maybe all?) component modules from the core plotly.js module for :leaves: custom builds in [`v2.0.0`](https://github.com/plotly/plotly.js/issues/420).\r\n\r\nInternally, this PR \r\n\r\n- pulls out `Plotly.register` out of `src/plotly.js` and into `src/plot_api/register.js` side-by-side with its `Plotly` method friends\r\n- pulls out all the registry-related objects and methods out of `src/plots/plots.js` and into `src/registry.js`. This new `registry.js` module only depends on `Lib` and one attribute file which allow us to :hocho: a lot of circular dependencies\r\n- adds a helper method `Register.getComponentMethod` used to access method of registered component modules without having to require the module themselves.\r\n","created_at":"2016-08-11T19:55:32Z","updated_at":"2016-08-18T17:55:53Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8c0fe4e7e08b7f783b74fbc7449bfa1d02f55baa","assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/plotly/plotly.js/milestones/9","html_url":"https://github.com/plotly/plotly.js/milestones/Decircularise%20src%20dependencies","labels_url":"https://api.github.com/repos/plotly/plotly.js/milestones/9/labels","id":1935278,"number":9,"title":"Decircularise src dependencies","description":"Some an the older files in `src/` depend on each other in a circular way. This is an artefact from our pre-open-source, pre-browserify IIFE / `window.Plotly = ` pattern.  It's time to go :bomb: ","creator":{"login":"etpinard","id":6675409,"avatar_url":"https://avatars.githubusercontent.com/u/6675409?v=3","gravatar_id":"","url":"https://api.github.com/users/etpinard","html_url":"https://github.com/etpinard","followers_url":"https://api.github.com/users/etpinard/followers","following_url":"https://api.github.com/users/etpinard/following{/other_user}","gists_url":"https://api.github.com/users/etpinard/gists{/gist_id}","starred_url":"https://api.github.com/users/etpinard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/etpinard/subscriptions","organizations_url":"https://api.github.com/users/etpinard/orgs","repos_url":"https://api.github.com/users/etpinard/repos","events_url":"https://api.github.com/users/etpinard/events{/privacy}","received_events_url":"https://api.github.com/users/etpinard/received_events","type":"User","site_admin":false},"open_issues":2,"closed_issues":2,"state":"open","created_at":"2016-08-10T17:58:03Z","updated_at":"2016-08-11T19:55:32Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/plotly/plotly.js/pulls/845/commits","review_comments_url":"https://api.github.com/repos/plotly/plotly.js/pulls/845/comments","review_comment_url":"https://api.github.com/repos/plotly/plotly.js/pulls/comments{/number}","comments_url":"https://api.github.com/repos/plotly/plotly.js/issues/845/comments","statuses_url":"https://api.github.com/repos/plotly/plotly.js/statuses/a1ea3658de01e04795ef3497f05325b97e907bd7","head":{"label":"plotly:registry-use-component","ref":"registry-use-component","sha":"a1ea3658de01e04795ef3497f05325b97e907bd7","user":{"login":"plotly","id":5997976,"avatar_url":"https://avatars.githubusercontent.com/u/5997976?v=3","gravatar_id":"","url":"https://api.github.com/users/plotly","html_url":"https://github.com/plotly","followers_url":"https://api.github.com/users/plotly/followers","following_url":"https://api.github.com/users/plotly/following{/other_user}","gists_url":"https://api.github.com/users/plotly/gists{/gist_id}","starred_url":"https://api.github.com/users/plotly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/plotly/subscriptions","organizations_url":"https://api.github.com/users/plotly/orgs","repos_url":"https://api.github.com/users/plotly/repos","events_url":"https://api.github.com/users/plotly/events{/privacy}","received_events_url":"https://api.github.com/users/plotly/received_events","type":"Organization","site_admin":false},"repo":{"id":45646037,"name":"plotly.js","full_name":"plotly/plotly.js","owner":{"login":"plotly","id":5997976,"avatar_url":"https://avatars.githubusercontent.com/u/5997976?v=3","gravatar_id":"","url":"https://api.github.com/users/plotly","html_url":"https://github.com/plotly","followers_url":"https://api.github.com/users/plotly/followers","following_url":"https://api.github.com/users/plotly/following{/other_user}","gists_url":"https://api.github.com/users/plotly/gists{/gist_id}","starred_url":"https://api.github.com/users/plotly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/plotly/subscriptions","organizations_url":"https://api.github.com/users/plotly/orgs","repos_url":"https://api.github.com/users/plotly/repos","events_url":"https://api.github.com/users/plotly/events{/privacy}","received_events_url":"https://api.github.com/users/plotly/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/plotly/plotly.js","description":"The open source javascript graphing library that powers plotly","fork":false,"url":"https://api.github.com/repos/plotly/plotly.js","forks_url":"https://api.github.com/repos/plotly/plotly.js/forks","keys_url":"https://api.github.com/repos/plotly/plotly.js/keys{/key_id}","collaborators_url":"https://api.github.com/repos/plotly/plotly.js/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/plotly/plotly.js/teams","hooks_url":"https://api.github.com/repos/plotly/plotly.js/hooks","issue_events_url":"https://api.github.com/repos/plotly/plotly.js/issues/events{/number}","events_url":"https://api.github.com/repos/plotly/plotly.js/events","assignees_url":"https://api.github.com/repos/plotly/plotly.js/assignees{/user}","branches_url":"https://api.github.com/repos/plotly/plotly.js/branches{/branch}","tags_url":"https://api.github.com/repos/plotly/plotly.js/tags","blobs_url":"https://api.github.com/repos/plotly/plotly.js/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/plotly/plotly.js/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/plotly/plotly.js/git/refs{/sha}","trees_url":"https://api.github.com/repos/plotly/plotly.js/git/trees{/sha}","statuses_url":"https://api.github.com/repos/plotly/plotly.js/statuses/{sha}","languages_url":"https://api.github.com/repos/plotly/plotly.js/languages","stargazers_url":"https://api.github.com/repos/plotly/plotly.js/stargazers","contributors_url":"https://api.github.com/repos/plotly/plotly.js/contributors","subscribers_url":"https://api.github.com/repos/plotly/plotly.js/subscribers","subscription_url":"https://api.github.com/repos/plotly/plotly.js/subscription","commits_url":"https://api.github.com/repos/plotly/plotly.js/commits{/sha}","git_commits_url":"https://api.github.com/repos/plotly/plotly.js/git/commits{/sha}","comments_url":"https://api.github.com/repos/plotly/plotly.js/comments{/number}","issue_comment_url":"https://api.github.com/repos/plotly/plotly.js/issues/comments{/number}","contents_url":"https://api.github.com/repos/plotly/plotly.js/contents/{+path}","compare_url":"https://api.github.com/repos/plotly/plotly.js/compare/{base}...{head}","merges_url":"https://api.github.com/repos/plotly/plotly.js/merges","archive_url":"https://api.github.com/repos/plotly/plotly.js/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/plotly/plotly.js/downloads","issues_url":"https://api.github.com/repos/plotly/plotly.js/issues{/number}","pulls_url":"https://api.github.com/repos/plotly/plotly.js/pulls{/number}","milestones_url":"https://api.github.com/repos/plotly/plotly.js/milestones{/number}","notifications_url":"https://api.github.com/repos/plotly/plotly.js/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/plotly/plotly.js/labels{/name}","releases_url":"https://api.github.com/repos/plotly/plotly.js/releases{/id}","deployments_url":"https://api.github.com/repos/plotly/plotly.js/deployments","created_at":"2015-11-05T23:27:17Z","updated_at":"2016-08-18T13:38:43Z","pushed_at":"2016-08-18T15:21:10Z","git_url":"git://github.com/plotly/plotly.js.git","ssh_url":"git@github.com:plotly/plotly.js.git","clone_url":"https://github.com/plotly/plotly.js.git","svn_url":"https://github.com/plotly/plotly.js","homepage":"https://plot.ly/javascript/","size":135275,"stargazers_count":5147,"watchers_count":5147,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":452,"mirror_url":null,"open_issues_count":179,"forks":452,"open_issues":179,"watchers":5147,"default_branch":"master"}},"base":{"label":"plotly:master","ref":"master","sha":"7387b2b4d25c3f49cf2da56f216c83fe42b28501","user":{"login":"plotly","id":5997976,"avatar_url":"https://avatars.githubusercontent.com/u/5997976?v=3","gravatar_id":"","url":"https://api.github.com/users/plotly","html_url":"https://github.com/plotly","followers_url":"https://api.github.com/users/plotly/followers","following_url":"https://api.github.com/users/plotly/following{/other_user}","gists_url":"https://api.github.com/users/plotly/gists{/gist_id}","starred_url":"https://api.github.com/users/plotly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/plotly/subscriptions","organizations_url":"https://api.github.com/users/plotly/orgs","repos_url":"https://api.github.com/users/plotly/repos","events_url":"https://api.github.com/users/plotly/events{/privacy}","received_events_url":"https://api.github.com/users/plotly/received_events","type":"Organization","site_admin":false},"repo":{"id":45646037,"name":"plotly.js","full_name":"plotly/plotly.js","owner":{"login":"plotly","id":5997976,"avatar_url":"https://avatars.githubusercontent.com/u/5997976?v=3","gravatar_id":"","url":"https://api.github.com/users/plotly","html_url":"https://github.com/plotly","followers_url":"https://api.github.com/users/plotly/followers","following_url":"https://api.github.com/users/plotly/following{/other_user}","gists_url":"https://api.github.com/users/plotly/gists{/gist_id}","starred_url":"https://api.github.com/users/plotly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/plotly/subscriptions","organizations_url":"https://api.github.com/users/plotly/orgs","repos_url":"https://api.github.com/users/plotly/repos","events_url":"https://api.github.com/users/plotly/events{/privacy}","received_events_url":"https://api.github.com/users/plotly/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/plotly/plotly.js","description":"The open source javascript graphing library that powers plotly","fork":false,"url":"https://api.github.com/repos/plotly/plotly.js","forks_url":"https://api.github.com/repos/plotly/plotly.js/forks","keys_url":"https://api.github.com/repos/plotly/plotly.js/keys{/key_id}","collaborators_url":"https://api.github.com/repos/plotly/plotly.js/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/plotly/plotly.js/teams","hooks_url":"https://api.github.com/repos/plotly/plotly.js/hooks","issue_events_url":"https://api.github.com/repos/plotly/plotly.js/issues/events{/number}","events_url":"https://api.github.com/repos/plotly/plotly.js/events","assignees_url":"https://api.github.com/repos/plotly/plotly.js/assignees{/user}","branches_url":"https://api.github.com/repos/plotly/plotly.js/branches{/branch}","tags_url":"https://api.github.com/repos/plotly/plotly.js/tags","blobs_url":"https://api.github.com/repos/plotly/plotly.js/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/plotly/plotly.js/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/plotly/plotly.js/git/refs{/sha}","trees_url":"https://api.github.com/repos/plotly/plotly.js/git/trees{/sha}","statuses_url":"https://api.github.com/repos/plotly/plotly.js/statuses/{sha}","languages_url":"https://api.github.com/repos/plotly/plotly.js/languages","stargazers_url":"https://api.github.com/repos/plotly/plotly.js/stargazers","contributors_url":"https://api.github.com/repos/plotly/plotly.js/contributors","subscribers_url":"https://api.github.com/repos/plotly/plotly.js/subscribers","subscription_url":"https://api.github.com/repos/plotly/plotly.js/subscription","commits_url":"https://api.github.com/repos/plotly/plotly.js/commits{/sha}","git_commits_url":"https://api.github.com/repos/plotly/plotly.js/git/commits{/sha}","comments_url":"https://api.github.com/repos/plotly/plotly.js/comments{/number}","issue_comment_url":"https://api.github.com/repos/plotly/plotly.js/issues/comments{/number}","contents_url":"https://api.github.com/repos/plotly/plotly.js/contents/{+path}","compare_url":"https://api.github.com/repos/plotly/plotly.js/compare/{base}...{head}","merges_url":"https://api.github.com/repos/plotly/plotly.js/merges","archive_url":"https://api.github.com/repos/plotly/plotly.js/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/plotly/plotly.js/downloads","issues_url":"https://api.github.com/repos/plotly/plotly.js/issues{/number}","pulls_url":"https://api.github.com/repos/plotly/plotly.js/pulls{/number}","milestones_url":"https://api.github.com/repos/plotly/plotly.js/milestones{/number}","notifications_url":"https://api.github.com/repos/plotly/plotly.js/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/plotly/plotly.js/labels{/name}","releases_url":"https://api.github.com/repos/plotly/plotly.js/releases{/id}","deployments_url":"https://api.github.com/repos/plotly/plotly.js/deployments","created_at":"2015-11-05T23:27:17Z","updated_at":"2016-08-18T13:38:43Z","pushed_at":"2016-08-18T15:21:10Z","git_url":"git://github.com/plotly/plotly.js.git","ssh_url":"git@github.com:plotly/plotly.js.git","clone_url":"https://github.com/plotly/plotly.js.git","svn_url":"https://github.com/plotly/plotly.js","homepage":"https://plot.ly/javascript/","size":135275,"stargazers_count":5147,"watchers_count":5147,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":452,"mirror_url":null,"open_issues_count":179,"forks":452,"open_issues":179,"watchers":5147,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/plotly/plotly.js/pulls/845"},"html":{"href":"https://github.com/plotly/plotly.js/pull/845"},"issue":{"href":"https://api.github.com/repos/plotly/plotly.js/issues/845"},"comments":{"href":"https://api.github.com/repos/plotly/plotly.js/issues/845/comments"},"review_comments":{"href":"https://api.github.com/repos/plotly/plotly.js/pulls/845/comments"},"review_comment":{"href":"https://api.github.com/repos/plotly/plotly.js/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/plotly/plotly.js/pulls/845/commits"},"statuses":{"href":"https://api.github.com/repos/plotly/plotly.js/statuses/a1ea3658de01e04795ef3497f05325b97e907bd7"}}}}
{"actor":{"display_login":"etpinard"}}