diff --git a/.bowerrc b/.bowerrc deleted file mode 100644 index 7262f163..00000000 --- a/.bowerrc +++ /dev/null @@ -1,3 +0,0 @@ -{ - "directory": "lib" -} \ No newline at end of file diff --git a/.gitignore b/.gitignore index f1ff06d6..f670c5c8 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,4 @@ -lib/ \ No newline at end of file +.idea +.DS_Store +bower_components/ +node_modules/ \ No newline at end of file diff --git a/bower.json b/bower.json index 9c84fa5a..22c9fbfe 100644 --- a/bower.json +++ b/bower.json @@ -23,7 +23,7 @@ "test", "tests" ], - "dependencies": { + "devDependencies": { "seajs": "~2.3.0" } } diff --git a/demo.html b/demo/dev.html similarity index 80% rename from demo.html rename to demo/dev.html index cf4aad81..ec8b1d1f 100644 --- a/demo.html +++ b/demo/dev.html @@ -3,9 +3,7 @@ KityMinder Editor - Powered By FEX - - - + + + +

KityMinder Editor - Powered By FEX

+
+ + + + + \ No newline at end of file diff --git a/less/editor.less b/less/editor.less index 457bb036..d23f97e2 100644 --- a/less/editor.less +++ b/less/editor.less @@ -1,3 +1,6 @@ +@import (css) "../lib/km-core/src/kityminder" +@import (less) "../lib/hotbox/less/hotbox.less" + .km-editor { overflow: hidden; } diff --git a/lib/seajs/.bower.json b/lib/seajs/.bower.json deleted file mode 100644 index 0e371386..00000000 --- a/lib/seajs/.bower.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "name": "seajs", - "version": "2.3.0", - "main": "./dist/sea.js", - "ignore": [ - "**/.*", - "docs", - "lib", - "src", - "tests", - "CNAME", - "component.json", - "CONTRIBUTING.md", - "index.html", - "Makefile", - "package.json", - "README.md" - ], - "homepage": "https://github.com/seajs/seajs", - "_release": "2.3.0", - "_resolution": { - "type": "version", - "tag": "2.3.0", - "commit": "9c6299636991fbca73a9aa7b2eb152c6e8614854" - }, - "_source": "git://github.com/seajs/seajs.git", - "_target": "~2.3.0", - "_originalSource": "seajs", - "_direct": true -} \ No newline at end of file diff --git a/lib/seajs/LICENSE.md b/lib/seajs/LICENSE.md deleted file mode 100644 index 02749911..00000000 --- a/lib/seajs/LICENSE.md +++ /dev/null @@ -1,24 +0,0 @@ -MIT LICENSE - -Copyright (c) 2009 - 2099 Frank Wang, http://seajs.org/ - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - - diff --git a/lib/seajs/bower.json b/lib/seajs/bower.json deleted file mode 100644 index eab82cda..00000000 --- a/lib/seajs/bower.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "name": "seajs", - "version": "2.3.0", - "main": "./dist/sea.js", - "ignore": [ - "**/.*", - "docs", - "lib", - "src", - "tests", - "CNAME", - "component.json", - "CONTRIBUTING.md", - "index.html", - "Makefile", - "package.json", - "README.md" - ] -} diff --git a/lib/seajs/dist/sea-debug.js b/lib/seajs/dist/sea-debug.js deleted file mode 100644 index c56ea301..00000000 --- a/lib/seajs/dist/sea-debug.js +++ /dev/null @@ -1,846 +0,0 @@ -/** - * Sea.js 2.3.0 | seajs.org/LICENSE.md - */ -(function(global, undefined) { - -// Avoid conflicting when `sea.js` is loaded multiple times -if (global.seajs) { - return -} - -var seajs = global.seajs = { - // The current version of Sea.js being used - version: "2.3.0" -} - -var data = seajs.data = {} - - -/** - * util-lang.js - The minimal language enhancement - */ - -function isType(type) { - return function(obj) { - return {}.toString.call(obj) == "[object " + type + "]" - } -} - -var isObject = isType("Object") -var isString = isType("String") -var isArray = Array.isArray || isType("Array") -var isFunction = isType("Function") - -var _cid = 0 -function cid() { - return _cid++ -} - - -/** - * util-events.js - The minimal events support - */ - -var events = data.events = {} - -// Bind event -seajs.on = function(name, callback) { - var list = events[name] || (events[name] = []) - list.push(callback) - return seajs -} - -// Remove event. If `callback` is undefined, remove all callbacks for the -// event. If `event` and `callback` are both undefined, remove all callbacks -// for all events -seajs.off = function(name, callback) { - // Remove *all* events - if (!(name || callback)) { - events = data.events = {} - return seajs - } - - var list = events[name] - if (list) { - if (callback) { - for (var i = list.length - 1; i >= 0; i--) { - if (list[i] === callback) { - list.splice(i, 1) - } - } - } - else { - delete events[name] - } - } - - return seajs -} - -// Emit event, firing all bound callbacks. Callbacks receive the same -// arguments as `emit` does, apart from the event name -var emit = seajs.emit = function(name, data) { - var list = events[name], fn - - if (list) { - // Copy callback lists to prevent modification - list = list.slice() - - // Execute event callbacks, use index because it's the faster. - for(var i = 0, len = list.length; i < len; i++) { - list[i](data) - } - } - - return seajs -} - - -/** - * util-path.js - The utilities for operating path such as id, uri - */ - -var DIRNAME_RE = /[^?#]*\// - -var DOT_RE = /\/\.\//g -var DOUBLE_DOT_RE = /\/[^/]+\/\.\.\// -var MULTI_SLASH_RE = /([^:/])\/+\//g - -// Extract the directory portion of a path -// dirname("a/b/c.js?t=123#xx/zz") ==> "a/b/" -// ref: http://jsperf.com/regex-vs-split/2 -function dirname(path) { - return path.match(DIRNAME_RE)[0] -} - -// Canonicalize a path -// realpath("http://test.com/a//./b/../c") ==> "http://test.com/a/c" -function realpath(path) { - // /a/b/./c/./d ==> /a/b/c/d - path = path.replace(DOT_RE, "/") - - /* - @author wh1100717 - a//b/c ==> a/b/c - a///b/////c ==> a/b/c - DOUBLE_DOT_RE matches a/b/c//../d path correctly only if replace // with / first - */ - path = path.replace(MULTI_SLASH_RE, "$1/") - - // a/b/c/../../d ==> a/b/../d ==> a/d - while (path.match(DOUBLE_DOT_RE)) { - path = path.replace(DOUBLE_DOT_RE, "/") - } - - return path -} - -// Normalize an id -// normalize("path/to/a") ==> "path/to/a.js" -// NOTICE: substring is faster than negative slice and RegExp -function normalize(path) { - var last = path.length - 1 - var lastC = path.charAt(last) - - // If the uri ends with `#`, just return it without '#' - if (lastC === "#") { - return path.substring(0, last) - } - - return (path.substring(last - 2) === ".js" || - path.indexOf("?") > 0 || - lastC === "/") ? path : path + ".js" -} - - -var PATHS_RE = /^([^/:]+)(\/.+)$/ -var VARS_RE = /{([^{]+)}/g - -function parseAlias(id) { - var alias = data.alias - return alias && isString(alias[id]) ? alias[id] : id -} - -function parsePaths(id) { - var paths = data.paths - var m - - if (paths && (m = id.match(PATHS_RE)) && isString(paths[m[1]])) { - id = paths[m[1]] + m[2] - } - - return id -} - -function parseVars(id) { - var vars = data.vars - - if (vars && id.indexOf("{") > -1) { - id = id.replace(VARS_RE, function(m, key) { - return isString(vars[key]) ? vars[key] : m - }) - } - - return id -} - -function parseMap(uri) { - var map = data.map - var ret = uri - - if (map) { - for (var i = 0, len = map.length; i < len; i++) { - var rule = map[i] - - ret = isFunction(rule) ? - (rule(uri) || uri) : - uri.replace(rule[0], rule[1]) - - // Only apply the first matched rule - if (ret !== uri) break - } - } - - return ret -} - - -var ABSOLUTE_RE = /^\/\/.|:\// -var ROOT_DIR_RE = /^.*?\/\/.*?\// - -function addBase(id, refUri) { - var ret - var first = id.charAt(0) - - // Absolute - if (ABSOLUTE_RE.test(id)) { - ret = id - } - // Relative - else if (first === ".") { - ret = realpath((refUri ? dirname(refUri) : data.cwd) + id) - } - // Root - else if (first === "/") { - var m = data.cwd.match(ROOT_DIR_RE) - ret = m ? m[0] + id.substring(1) : id - } - // Top-level - else { - ret = data.base + id - } - - // Add default protocol when uri begins with "//" - if (ret.indexOf("//") === 0) { - ret = location.protocol + ret - } - - return ret -} - -function id2Uri(id, refUri) { - if (!id) return "" - - id = parseAlias(id) - id = parsePaths(id) - id = parseVars(id) - id = normalize(id) - - var uri = addBase(id, refUri) - uri = parseMap(uri) - - return uri -} - - -var doc = document -var cwd = (!location.href || location.href.indexOf('about:') === 0) ? '' : dirname(location.href) -var scripts = doc.scripts - -// Recommend to add `seajsnode` id for the `sea.js` script element -var loaderScript = doc.getElementById("seajsnode") || - scripts[scripts.length - 1] - -// When `sea.js` is inline, set loaderDir to current working directory -var loaderDir = dirname(getScriptAbsoluteSrc(loaderScript) || cwd) - -function getScriptAbsoluteSrc(node) { - return node.hasAttribute ? // non-IE6/7 - node.src : - // see http://msdn.microsoft.com/en-us/library/ms536429(VS.85).aspx - node.getAttribute("src", 4) -} - - -// For Developers -seajs.resolve = id2Uri - - -/** - * util-request.js - The utilities for requesting script and style files - * ref: tests/research/load-js-css/test.html - */ - -var head = doc.head || doc.getElementsByTagName("head")[0] || doc.documentElement -var baseElement = head.getElementsByTagName("base")[0] - -var currentlyAddingScript -var interactiveScript - -function request(url, callback, charset) { - var node = doc.createElement("script") - - if (charset) { - var cs = isFunction(charset) ? charset(url) : charset - if (cs) { - node.charset = cs - } - } - - addOnload(node, callback, url) - - node.async = true - node.src = url - - // For some cache cases in IE 6-8, the script executes IMMEDIATELY after - // the end of the insert execution, so use `currentlyAddingScript` to - // hold current node, for deriving url in `define` call - currentlyAddingScript = node - - // ref: #185 & http://dev.jquery.com/ticket/2709 - baseElement ? - head.insertBefore(node, baseElement) : - head.appendChild(node) - - currentlyAddingScript = null -} - -function addOnload(node, callback, url) { - var supportOnload = "onload" in node - - if (supportOnload) { - node.onload = onload - node.onerror = function() { - emit("error", { uri: url, node: node }) - onload() - } - } - else { - node.onreadystatechange = function() { - if (/loaded|complete/.test(node.readyState)) { - onload() - } - } - } - - function onload() { - // Ensure only run once and handle memory leak in IE - node.onload = node.onerror = node.onreadystatechange = null - - // Remove the script to reduce memory leak - if (!data.debug) { - head.removeChild(node) - } - - // Dereference the node - node = null - - callback() - } -} - -function getCurrentScript() { - if (currentlyAddingScript) { - return currentlyAddingScript - } - - // For IE6-9 browsers, the script onload event may not fire right - // after the script is evaluated. Kris Zyp found that it - // could query the script nodes and the one that is in "interactive" - // mode indicates the current script - // ref: http://goo.gl/JHfFW - if (interactiveScript && interactiveScript.readyState === "interactive") { - return interactiveScript - } - - var scripts = head.getElementsByTagName("script") - - for (var i = scripts.length - 1; i >= 0; i--) { - var script = scripts[i] - if (script.readyState === "interactive") { - interactiveScript = script - return interactiveScript - } - } -} - - -// For Developers -seajs.request = request - - -/** - * util-deps.js - The parser for dependencies - * ref: tests/research/parse-dependencies/test.html - */ - -var REQUIRE_RE = /"(?:\\"|[^"])*"|'(?:\\'|[^'])*'|\/\*[\S\s]*?\*\/|\/(?:\\\/|[^\/\r\n])+\/(?=[^\/])|\/\/.*|\.\s*require|(?:^|[^$])\brequire\s*\(\s*(["'])(.+?)\1\s*\)/g -var SLASH_RE = /\\\\/g - -function parseDependencies(code) { - var ret = [] - - code.replace(SLASH_RE, "") - .replace(REQUIRE_RE, function(m, m1, m2) { - if (m2) { - ret.push(m2) - } - }) - - return ret -} - - -/** - * module.js - The core of module loader - */ - -var cachedMods = seajs.cache = {} -var anonymousMeta - -var fetchingList = {} -var fetchedList = {} -var callbackList = {} - -var STATUS = Module.STATUS = { - // 1 - The `module.uri` is being fetched - FETCHING: 1, - // 2 - The meta data has been saved to cachedMods - SAVED: 2, - // 3 - The `module.dependencies` are being loaded - LOADING: 3, - // 4 - The module are ready to execute - LOADED: 4, - // 5 - The module is being executed - EXECUTING: 5, - // 6 - The `module.exports` is available - EXECUTED: 6 -} - - -function Module(uri, deps) { - this.uri = uri - this.dependencies = deps || [] - this.exports = null - this.status = 0 - - // Who depends on me - this._waitings = {} - - // The number of unloaded dependencies - this._remain = 0 -} - -// Resolve module.dependencies -Module.prototype.resolve = function() { - var mod = this - var ids = mod.dependencies - var uris = [] - - for (var i = 0, len = ids.length; i < len; i++) { - uris[i] = Module.resolve(ids[i], mod.uri) - } - return uris -} - -// Load module.dependencies and fire onload when all done -Module.prototype.load = function() { - var mod = this - - // If the module is being loaded, just wait it onload call - if (mod.status >= STATUS.LOADING) { - return - } - - mod.status = STATUS.LOADING - - // Emit `load` event for plugins such as combo plugin - var uris = mod.resolve() - emit("load", uris) - - var len = mod._remain = uris.length - var m - - // Initialize modules and register waitings - for (var i = 0; i < len; i++) { - m = Module.get(uris[i]) - - if (m.status < STATUS.LOADED) { - // Maybe duplicate: When module has dupliate dependency, it should be it's count, not 1 - m._waitings[mod.uri] = (m._waitings[mod.uri] || 0) + 1 - } - else { - mod._remain-- - } - } - - if (mod._remain === 0) { - mod.onload() - return - } - - // Begin parallel loading - var requestCache = {} - - for (i = 0; i < len; i++) { - m = cachedMods[uris[i]] - - if (m.status < STATUS.FETCHING) { - m.fetch(requestCache) - } - else if (m.status === STATUS.SAVED) { - m.load() - } - } - - // Send all requests at last to avoid cache bug in IE6-9. Issues#808 - for (var requestUri in requestCache) { - if (requestCache.hasOwnProperty(requestUri)) { - requestCache[requestUri]() - } - } -} - -// Call this method when module is loaded -Module.prototype.onload = function() { - var mod = this - mod.status = STATUS.LOADED - - if (mod.callback) { - mod.callback() - } - - // Notify waiting modules to fire onload - var waitings = mod._waitings - var uri, m - - for (uri in waitings) { - if (waitings.hasOwnProperty(uri)) { - m = cachedMods[uri] - m._remain -= waitings[uri] - if (m._remain === 0) { - m.onload() - } - } - } - - // Reduce memory taken - delete mod._waitings - delete mod._remain -} - -// Fetch a module -Module.prototype.fetch = function(requestCache) { - var mod = this - var uri = mod.uri - - mod.status = STATUS.FETCHING - - // Emit `fetch` event for plugins such as combo plugin - var emitData = { uri: uri } - emit("fetch", emitData) - var requestUri = emitData.requestUri || uri - - // Empty uri or a non-CMD module - if (!requestUri || fetchedList[requestUri]) { - mod.load() - return - } - - if (fetchingList[requestUri]) { - callbackList[requestUri].push(mod) - return - } - - fetchingList[requestUri] = true - callbackList[requestUri] = [mod] - - // Emit `request` event for plugins such as text plugin - emit("request", emitData = { - uri: uri, - requestUri: requestUri, - onRequest: onRequest, - charset: data.charset - }) - - if (!emitData.requested) { - requestCache ? - requestCache[emitData.requestUri] = sendRequest : - sendRequest() - } - - function sendRequest() { - seajs.request(emitData.requestUri, emitData.onRequest, emitData.charset) - } - - function onRequest() { - delete fetchingList[requestUri] - fetchedList[requestUri] = true - - // Save meta data of anonymous module - if (anonymousMeta) { - Module.save(uri, anonymousMeta) - anonymousMeta = null - } - - // Call callbacks - var m, mods = callbackList[requestUri] - delete callbackList[requestUri] - while ((m = mods.shift())) m.load() - } -} - -// Execute a module -Module.prototype.exec = function () { - var mod = this - - // When module is executed, DO NOT execute it again. When module - // is being executed, just return `module.exports` too, for avoiding - // circularly calling - if (mod.status >= STATUS.EXECUTING) { - return mod.exports - } - - mod.status = STATUS.EXECUTING - - // Create require - var uri = mod.uri - - function require(id) { - return Module.get(require.resolve(id)).exec() - } - - require.resolve = function(id) { - return Module.resolve(id, uri) - } - - require.async = function(ids, callback) { - Module.use(ids, callback, uri + "_async_" + cid()) - return require - } - - // Exec factory - var factory = mod.factory - - var exports = isFunction(factory) ? - factory(require, mod.exports = {}, mod) : - factory - - if (exports === undefined) { - exports = mod.exports - } - - // Reduce memory leak - delete mod.factory - - mod.exports = exports - mod.status = STATUS.EXECUTED - - // Emit `exec` event - emit("exec", mod) - - return exports -} - -// Resolve id to uri -Module.resolve = function(id, refUri) { - // Emit `resolve` event for plugins such as text plugin - var emitData = { id: id, refUri: refUri } - emit("resolve", emitData) - - return emitData.uri || seajs.resolve(emitData.id, refUri) -} - -// Define a module -Module.define = function (id, deps, factory) { - var argsLen = arguments.length - - // define(factory) - if (argsLen === 1) { - factory = id - id = undefined - } - else if (argsLen === 2) { - factory = deps - - // define(deps, factory) - if (isArray(id)) { - deps = id - id = undefined - } - // define(id, factory) - else { - deps = undefined - } - } - - // Parse dependencies according to the module factory code - if (!isArray(deps) && isFunction(factory)) { - deps = parseDependencies(factory.toString()) - } - - var meta = { - id: id, - uri: Module.resolve(id), - deps: deps, - factory: factory - } - - // Try to derive uri in IE6-9 for anonymous modules - if (!meta.uri && doc.attachEvent) { - var script = getCurrentScript() - - if (script) { - meta.uri = script.src - } - - // NOTE: If the id-deriving methods above is failed, then falls back - // to use onload event to get the uri - } - - // Emit `define` event, used in nocache plugin, seajs node version etc - emit("define", meta) - - meta.uri ? Module.save(meta.uri, meta) : - // Save information for "saving" work in the script onload event - anonymousMeta = meta -} - -// Save meta data to cachedMods -Module.save = function(uri, meta) { - var mod = Module.get(uri) - - // Do NOT override already saved modules - if (mod.status < STATUS.SAVED) { - mod.id = meta.id || uri - mod.dependencies = meta.deps || [] - mod.factory = meta.factory - mod.status = STATUS.SAVED - - emit("save", mod) - } -} - -// Get an existed module or create a new one -Module.get = function(uri, deps) { - return cachedMods[uri] || (cachedMods[uri] = new Module(uri, deps)) -} - -// Use function is equal to load a anonymous module -Module.use = function (ids, callback, uri) { - var mod = Module.get(uri, isArray(ids) ? ids : [ids]) - - mod.callback = function() { - var exports = [] - var uris = mod.resolve() - - for (var i = 0, len = uris.length; i < len; i++) { - exports[i] = cachedMods[uris[i]].exec() - } - - if (callback) { - callback.apply(global, exports) - } - - delete mod.callback - } - - mod.load() -} - - -// Public API - -seajs.use = function(ids, callback) { - Module.use(ids, callback, data.cwd + "_use_" + cid()) - return seajs -} - -Module.define.cmd = {} -global.define = Module.define - - -// For Developers - -seajs.Module = Module -data.fetchedList = fetchedList -data.cid = cid - -seajs.require = function(id) { - var mod = Module.get(Module.resolve(id)) - if (mod.status < STATUS.EXECUTING) { - mod.onload() - mod.exec() - } - return mod.exports -} - - -/** - * config.js - The configuration for the loader - */ - -// The root path to use for id2uri parsing -data.base = loaderDir - -// The loader directory -data.dir = loaderDir - -// The current working directory -data.cwd = cwd - -// The charset for requesting files -data.charset = "utf-8" - -// data.alias - An object containing shorthands of module id -// data.paths - An object containing path shorthands in module id -// data.vars - The {xxx} variables in module id -// data.map - An array containing rules to map module uri -// data.debug - Debug mode. The default value is false - -seajs.config = function(configData) { - - for (var key in configData) { - var curr = configData[key] - var prev = data[key] - - // Merge object config such as alias, vars - if (prev && isObject(prev)) { - for (var k in curr) { - prev[k] = curr[k] - } - } - else { - // Concat array config such as map - if (isArray(prev)) { - curr = prev.concat(curr) - } - // Make sure that `data.base` is an absolute path - else if (key === "base") { - // Make sure end with "/" - if (curr.slice(-1) !== "/") { - curr += "/" - } - curr = addBase(curr) - } - - // Set config - data[key] = curr - } - } - - emit("config", configData) - return seajs -} - -})(this); diff --git a/lib/seajs/dist/sea.js b/lib/seajs/dist/sea.js deleted file mode 100644 index 3a54f361..00000000 --- a/lib/seajs/dist/sea.js +++ /dev/null @@ -1,2 +0,0 @@ -/*! Sea.js 2.3.0 | seajs.org/LICENSE.md */ -!function(a,b){function c(a){return function(b){return{}.toString.call(b)=="[object "+a+"]"}}function d(){return z++}function e(a){return a.match(C)[0]}function f(a){for(a=a.replace(D,"/"),a=a.replace(F,"$1/");a.match(E);)a=a.replace(E,"/");return a}function g(a){var b=a.length-1,c=a.charAt(b);return"#"===c?a.substring(0,b):".js"===a.substring(b-2)||a.indexOf("?")>0||"/"===c?a:a+".js"}function h(a){var b=u.alias;return b&&w(b[a])?b[a]:a}function i(a){var b=u.paths,c;return b&&(c=a.match(G))&&w(b[c[1]])&&(a=b[c[1]]+c[2]),a}function j(a){var b=u.vars;return b&&a.indexOf("{")>-1&&(a=a.replace(H,function(a,c){return w(b[c])?b[c]:a})),a}function k(a){var b=u.map,c=a;if(b)for(var d=0,e=b.length;e>d;d++){var f=b[d];if(c=y(f)?f(a)||a:a.replace(f[0],f[1]),c!==a)break}return c}function l(a,b){var c,d=a.charAt(0);if(I.test(a))c=a;else if("."===d)c=f((b?e(b):u.cwd)+a);else if("/"===d){var g=u.cwd.match(J);c=g?g[0]+a.substring(1):a}else c=u.base+a;return 0===c.indexOf("//")&&(c=location.protocol+c),c}function m(a,b){if(!a)return"";a=h(a),a=i(a),a=j(a),a=g(a);var c=l(a,b);return c=k(c)}function n(a){return a.hasAttribute?a.src:a.getAttribute("src",4)}function o(a,b,c){var d=K.createElement("script");if(c){var e=y(c)?c(a):c;e&&(d.charset=e)}p(d,b,a),d.async=!0,d.src=a,R=d,Q?P.insertBefore(d,Q):P.appendChild(d),R=null}function p(a,b,c){function d(){a.onload=a.onerror=a.onreadystatechange=null,u.debug||P.removeChild(a),a=null,b()}var e="onload"in a;e?(a.onload=d,a.onerror=function(){B("error",{uri:c,node:a}),d()}):a.onreadystatechange=function(){/loaded|complete/.test(a.readyState)&&d()}}function q(){if(R)return R;if(S&&"interactive"===S.readyState)return S;for(var a=P.getElementsByTagName("script"),b=a.length-1;b>=0;b--){var c=a[b];if("interactive"===c.readyState)return S=c}}function r(a){var b=[];return a.replace(U,"").replace(T,function(a,c,d){d&&b.push(d)}),b}function s(a,b){this.uri=a,this.dependencies=b||[],this.exports=null,this.status=0,this._waitings={},this._remain=0}if(!a.seajs){var t=a.seajs={version:"2.3.0"},u=t.data={},v=c("Object"),w=c("String"),x=Array.isArray||c("Array"),y=c("Function"),z=0,A=u.events={};t.on=function(a,b){var c=A[a]||(A[a]=[]);return c.push(b),t},t.off=function(a,b){if(!a&&!b)return A=u.events={},t;var c=A[a];if(c)if(b)for(var d=c.length-1;d>=0;d--)c[d]===b&&c.splice(d,1);else delete A[a];return t};var B=t.emit=function(a,b){var c=A[a],d;if(c){c=c.slice();for(var e=0,f=c.length;f>e;e++)c[e](b)}return t},C=/[^?#]*\//,D=/\/\.\//g,E=/\/[^/]+\/\.\.\//,F=/([^:/])\/+\//g,G=/^([^/:]+)(\/.+)$/,H=/{([^{]+)}/g,I=/^\/\/.|:\//,J=/^.*?\/\/.*?\//,K=document,L=location.href&&0!==location.href.indexOf("about:")?e(location.href):"",M=K.scripts,N=K.getElementById("seajsnode")||M[M.length-1],O=e(n(N)||L);t.resolve=m;var P=K.head||K.getElementsByTagName("head")[0]||K.documentElement,Q=P.getElementsByTagName("base")[0],R,S;t.request=o;var T=/"(?:\\"|[^"])*"|'(?:\\'|[^'])*'|\/\*[\S\s]*?\*\/|\/(?:\\\/|[^\/\r\n])+\/(?=[^\/])|\/\/.*|\.\s*require|(?:^|[^$])\brequire\s*\(\s*(["'])(.+?)\1\s*\)/g,U=/\\\\/g,V=t.cache={},W,X={},Y={},Z={},$=s.STATUS={FETCHING:1,SAVED:2,LOADING:3,LOADED:4,EXECUTING:5,EXECUTED:6};s.prototype.resolve=function(){for(var a=this,b=a.dependencies,c=[],d=0,e=b.length;e>d;d++)c[d]=s.resolve(b[d],a.uri);return c},s.prototype.load=function(){var a=this;if(!(a.status>=$.LOADING)){a.status=$.LOADING;var c=a.resolve();B("load",c);for(var d=a._remain=c.length,e,f=0;d>f;f++)e=s.get(c[f]),e.status<$.LOADED?e._waitings[a.uri]=(e._waitings[a.uri]||0)+1:a._remain--;if(0===a._remain)return a.onload(),b;var g={};for(f=0;d>f;f++)e=V[c[f]],e.status<$.FETCHING?e.fetch(g):e.status===$.SAVED&&e.load();for(var h in g)g.hasOwnProperty(h)&&g[h]()}},s.prototype.onload=function(){var a=this;a.status=$.LOADED,a.callback&&a.callback();var b=a._waitings,c,d;for(c in b)b.hasOwnProperty(c)&&(d=V[c],d._remain-=b[c],0===d._remain&&d.onload());delete a._waitings,delete a._remain},s.prototype.fetch=function(a){function c(){t.request(g.requestUri,g.onRequest,g.charset)}function d(){delete X[h],Y[h]=!0,W&&(s.save(f,W),W=null);var a,b=Z[h];for(delete Z[h];a=b.shift();)a.load()}var e=this,f=e.uri;e.status=$.FETCHING;var g={uri:f};B("fetch",g);var h=g.requestUri||f;return!h||Y[h]?(e.load(),b):X[h]?(Z[h].push(e),b):(X[h]=!0,Z[h]=[e],B("request",g={uri:f,requestUri:h,onRequest:d,charset:u.charset}),g.requested||(a?a[g.requestUri]=c:c()),b)},s.prototype.exec=function(){function a(b){return s.get(a.resolve(b)).exec()}var c=this;if(c.status>=$.EXECUTING)return c.exports;c.status=$.EXECUTING;var e=c.uri;a.resolve=function(a){return s.resolve(a,e)},a.async=function(b,c){return s.use(b,c,e+"_async_"+d()),a};var f=c.factory,g=y(f)?f(a,c.exports={},c):f;return g===b&&(g=c.exports),delete c.factory,c.exports=g,c.status=$.EXECUTED,B("exec",c),g},s.resolve=function(a,b){var c={id:a,refUri:b};return B("resolve",c),c.uri||t.resolve(c.id,b)},s.define=function(a,c,d){var e=arguments.length;1===e?(d=a,a=b):2===e&&(d=c,x(a)?(c=a,a=b):c=b),!x(c)&&y(d)&&(c=r(""+d));var f={id:a,uri:s.resolve(a),deps:c,factory:d};if(!f.uri&&K.attachEvent){var g=q();g&&(f.uri=g.src)}B("define",f),f.uri?s.save(f.uri,f):W=f},s.save=function(a,b){var c=s.get(a);c.status<$.SAVED&&(c.id=b.id||a,c.dependencies=b.deps||[],c.factory=b.factory,c.status=$.SAVED,B("save",c))},s.get=function(a,b){return V[a]||(V[a]=new s(a,b))},s.use=function(b,c,d){var e=s.get(d,x(b)?b:[b]);e.callback=function(){for(var b=[],d=e.resolve(),f=0,g=d.length;g>f;f++)b[f]=V[d[f]].exec();c&&c.apply(a,b),delete e.callback},e.load()},t.use=function(a,b){return s.use(a,b,u.cwd+"_use_"+d()),t},s.define.cmd={},a.define=s.define,t.Module=s,u.fetchedList=Y,u.cid=d,t.require=function(a){var b=s.get(s.resolve(a));return b.status<$.EXECUTING&&(b.onload(),b.exec()),b.exports},u.base=O,u.dir=O,u.cwd=L,u.charset="utf-8",t.config=function(a){for(var b in a){var c=a[b],d=u[b];if(d&&v(d))for(var e in c)d[e]=c[e];else x(d)?c=d.concat(c):"base"===b&&("/"!==c.slice(-1)&&(c+="/"),c=l(c)),u[b]=c}return B("config",a),t}}}(this); diff --git a/package.json b/package.json index eaf1521e..53259b83 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "description": "A powerful mind map editor", "main": "kityminder.editor.js", "scripts": { - "test": "grunt test", + "init": "git submodule init && git submodule update && npm i -g wr && npm install -g less && npm install -g bower && bower install", "dev": "npm run watch-less", "watch-less": "wr --exec \"lessc --source-map less/editor.less kityminder.editor.css\" less" },