Skip to content

Commit

Permalink
Update build
Browse files Browse the repository at this point in the history
  • Loading branch information
freeman14 committed Oct 24, 2016
1 parent 298315b commit 38f8353
Show file tree
Hide file tree
Showing 2 changed files with 226 additions and 29 deletions.
15 changes: 3 additions & 12 deletions dist/ng-helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -863,9 +863,10 @@
(0, _classCallCheck3.default)(this, HelperController);

this.$scope = $scope;

// Allowed events from parrent iFrame
this.events = {
'component': this.loadComponent,
'model': this.loadModel
'component': this.loadComponent
};
}

Expand All @@ -887,16 +888,6 @@
value: function $onDestroy() {
this.postMessageListener();
}
}, {
key: 'loadModel',
value: function loadModel(model) {
if (model) {
for (var k in model) {
this[k] = model[k];
}
}
this.$scope.$apply();
}
}, {
key: 'loadComponent',
value: function loadComponent(component) {
Expand Down
240 changes: 223 additions & 17 deletions dist/sb.js
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,192 @@
/* 292 */,
/* 293 */,
/* 294 */,
/* 295 */,
/* 295 */
/***/ function(module, exports) {

// shim for using process in browser
var process = module.exports = {};

// cached from whatever global is present so that test runners that stub it
// don't break things. But we need to wrap it in a try catch in case it is
// wrapped in strict mode code which doesn't define any globals. It's inside a
// function because try/catches deoptimize in certain engines.

var cachedSetTimeout;
var cachedClearTimeout;

function defaultSetTimout() {
throw new Error('setTimeout has not been defined');
}
function defaultClearTimeout () {
throw new Error('clearTimeout has not been defined');
}
(function () {
try {
if (typeof setTimeout === 'function') {
cachedSetTimeout = setTimeout;
} else {
cachedSetTimeout = defaultSetTimout;
}
} catch (e) {
cachedSetTimeout = defaultSetTimout;
}
try {
if (typeof clearTimeout === 'function') {
cachedClearTimeout = clearTimeout;
} else {
cachedClearTimeout = defaultClearTimeout;
}
} catch (e) {
cachedClearTimeout = defaultClearTimeout;
}
} ())
function runTimeout(fun) {
if (cachedSetTimeout === setTimeout) {
//normal enviroments in sane situations
return setTimeout(fun, 0);
}
// if setTimeout wasn't available but was latter defined
if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
cachedSetTimeout = setTimeout;
return setTimeout(fun, 0);
}
try {
// when when somebody has screwed with setTimeout but no I.E. maddness
return cachedSetTimeout(fun, 0);
} catch(e){
try {
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
return cachedSetTimeout.call(null, fun, 0);
} catch(e){
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
return cachedSetTimeout.call(this, fun, 0);
}
}


}
function runClearTimeout(marker) {
if (cachedClearTimeout === clearTimeout) {
//normal enviroments in sane situations
return clearTimeout(marker);
}
// if clearTimeout wasn't available but was latter defined
if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
cachedClearTimeout = clearTimeout;
return clearTimeout(marker);
}
try {
// when when somebody has screwed with setTimeout but no I.E. maddness
return cachedClearTimeout(marker);
} catch (e){
try {
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
return cachedClearTimeout.call(null, marker);
} catch (e){
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
// Some versions of I.E. have different rules for clearTimeout vs setTimeout
return cachedClearTimeout.call(this, marker);
}
}



}
var queue = [];
var draining = false;
var currentQueue;
var queueIndex = -1;

function cleanUpNextTick() {
if (!draining || !currentQueue) {
return;
}
draining = false;
if (currentQueue.length) {
queue = currentQueue.concat(queue);
} else {
queueIndex = -1;
}
if (queue.length) {
drainQueue();
}
}

function drainQueue() {
if (draining) {
return;
}
var timeout = runTimeout(cleanUpNextTick);
draining = true;

var len = queue.length;
while(len) {
currentQueue = queue;
queue = [];
while (++queueIndex < len) {
if (currentQueue) {
currentQueue[queueIndex].run();
}
}
queueIndex = -1;
len = queue.length;
}
currentQueue = null;
draining = false;
runClearTimeout(timeout);
}

process.nextTick = function (fun) {
var args = new Array(arguments.length - 1);
if (arguments.length > 1) {
for (var i = 1; i < arguments.length; i++) {
args[i - 1] = arguments[i];
}
}
queue.push(new Item(fun, args));
if (queue.length === 1 && !draining) {
runTimeout(drainQueue);
}
};

// v8 likes predictible objects
function Item(fun, array) {
this.fun = fun;
this.array = array;
}
Item.prototype.run = function () {
this.fun.apply(null, this.array);
};
process.title = 'browser';
process.browser = true;
process.env = {};
process.argv = [];
process.version = ''; // empty string to avoid regexp issues
process.versions = {};

function noop() {}

process.on = noop;
process.addListener = noop;
process.once = noop;
process.off = noop;
process.removeListener = noop;
process.removeAllListeners = noop;
process.emit = noop;

process.binding = function (name) {
throw new Error('process.binding is not supported');
};

process.cwd = function () { return '/' };
process.chdir = function (dir) {
throw new Error('process.chdir is not supported');
};
process.umask = function() { return 0; };


/***/ },
/* 296 */,
/* 297 */,
/* 298 */,
Expand Down Expand Up @@ -32782,7 +32967,7 @@


// module
exports.push([module.id, "/*\ngithub.com style (c) Vasily Polovnyov <[email protected]>\n*/\n.hljs {\n display: block;\n overflow-x: auto;\n padding: 0.5em;\n color: #333;\n}\n.hljs-comment,\n.hljs-quote {\n color: #998;\n font-style: italic;\n}\n.hljs-keyword,\n.hljs-selector-tag,\n.hljs-subst {\n color: #333;\n font-weight: bold;\n}\n.hljs-number,\n.hljs-literal,\n.hljs-variable,\n.hljs-template-variable,\n.hljs-tag .hljs-attr {\n color: #008080;\n}\n.hljs-string,\n.hljs-doctag {\n color: #d14;\n}\n.hljs-title,\n.hljs-section,\n.hljs-selector-id {\n color: #900;\n font-weight: bold;\n}\n.hljs-subst {\n font-weight: normal;\n}\n.hljs-type,\n.hljs-class .hljs-title {\n color: #458;\n font-weight: bold;\n}\n.hljs-tag,\n.hljs-name,\n.hljs-attribute {\n color: #000080;\n font-weight: normal;\n}\n.hljs-regexp,\n.hljs-link {\n color: #009926;\n}\n.hljs-symbol,\n.hljs-bullet {\n color: #990073;\n}\n.hljs-built_in,\n.hljs-builtin-name {\n color: #0086b3;\n}\n.hljs-meta {\n color: #999;\n font-weight: bold;\n}\n.hljs-deletion {\n background: #fdd;\n}\n.hljs-addition {\n background: #dfd;\n}\n.hljs-emphasis {\n font-style: italic;\n}\n.hljs-strong {\n font-weight: bold;\n}\n", ""]);
exports.push([module.id, "/*\ngithub.com style (c) Vasily Polovnyov <[email protected]>\n*/\n.hljs {\n display: block;\n overflow-x: auto;\n padding: 0.5em;\n color: #333;\n}\n.hljs-comment,\n.hljs-quote {\n color: #998;\n font-style: italic;\n}\n.hljs-keyword,\n.hljs-selector-tag,\n.hljs-subst {\n color: #333;\n font-weight: bold;\n}\n.hljs-number,\n.hljs-literal,\n.hljs-variable,\n.hljs-template-variable,\n.hljs-tag .hljs-attr {\n color: #008080;\n}\n.hljs-string,\n.hljs-doctag {\n color: #d14;\n}\n.hljs-title,\n.hljs-section,\n.hljs-selector-id {\n color: #900;\n font-weight: bold;\n}\n.hljs-subst {\n font-weight: normal;\n}\n.hljs-type,\n.hljs-class .hljs-title {\n color: #458;\n font-weight: bold;\n}\n.hljs-tag,\n.hljs-name,\n.hljs-attribute {\n color: #000080;\n font-weight: normal;\n}\n.hljs-regexp,\n.hljs-link {\n color: #009926;\n}\n.hljs-symbol,\n.hljs-bullet {\n color: #990073;\n}\n.hljs-built_in,\n.hljs-builtin-name {\n color: #0086b3;\n}\n.hljs-meta {\n color: #999;\n font-weight: bold;\n}\n.hljs-deletion {\n background: #fdd;\n}\n.hljs-addition {\n background: #dfd;\n}\n.hljs-emphasis {\n font-style: italic;\n}\n.hljs-strong {\n font-weight: bold;\n}\n.error__message {\n font-size: 18px;\n justify-content: center;\n align-items: center;\n display: flex;\n color: rgba(0, 0, 0, 0.54);\n}\n", ""]);

// exports

Expand Down Expand Up @@ -80424,13 +80609,13 @@
/* 396 */
/***/ function(module, exports) {

module.exports = "<div ui-ace=\"vm.settings\" ng-model=\"vm.component.template\" flex></div>"
module.exports = "<div ng-if=\"!vm.renderError\" ui-ace=\"vm.settings\" ng-model=\"vm.component.template\" flex></div>\n<div class=\"error__message\" ng-if=\"vm.renderError\" flex ng-bing=\"vm.errorMessage\"></div>"

/***/ },
/* 397 */
/***/ function(module, exports, __webpack_require__) {

'use strict';
/* WEBPACK VAR INJECTION */(function(process) {'use strict';

Object.defineProperty(exports, "__esModule", {
value: true
Expand All @@ -80455,17 +80640,24 @@

this.$rootScope = $rootScope;

// Listen for new component data and render it
this.listener = $rootScope.$on('render', function (event, component) {
_this.render(event, component);
});
if (process && process.env && process.env.TYPE === 'react') {
this.errorMessage = 'Sorry but for now SB not support live component editor for React. We work on this. Stay tuned!';
} else {

// ACE editor settings
this.settings = {
mode: 'html',
useWrapMode: true,
onLoad: this.onEditorChange.bind(this)
};
// Listen for new component data and render it
this.listener = $rootScope.$on('render', function (event, component) {
_this.render(event, component);
});

// ACE editor settings
this.settings = {
mode: 'html',
useWrapMode: true,
onLoad: this.onEditorChange.bind(this)
};

this.errorMessage = 'Unable to load template. Are you pass it with string?';
}
}

(0, _createClass3.default)(TemplateController, [{
Expand Down Expand Up @@ -80510,6 +80702,13 @@
key: 'render',
value: function render(event, component) {

if (typeof component.template !== 'string') {
this.renderError = true;
return;
}

this.renderError = false;

// We need original template for prevent changes
// So store original component
this.originalComponent = component;
Expand All @@ -80522,6 +80721,7 @@
}();

exports.default = TemplateController;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(295)))

/***/ },
/* 398 */
Expand Down Expand Up @@ -80598,7 +80798,7 @@
/* 401 */
/***/ function(module, exports) {

module.exports = "<div ui-ace=\"vm.settings\" ng-model=\"vm.model\" flex></div>"
module.exports = "<div ng-if=\"!vm.renderError\" ui-ace=\"vm.settings\" ng-model=\"vm.model\" flex></div>\n<div class=\"error__message\" ng-if=\"vm.renderError\" flex>\n Unable to load the model. Are you pass correct object?\n</div>"

/***/ },
/* 402 */
Expand Down Expand Up @@ -80684,12 +80884,18 @@
}, {
key: 'render',
value: function render(event, component) {

// We need original template for prevent changes
// So store original component
this.originalComponent = component;

// Store model
this.model = (0, _stringify2.default)(component.model, null, Number(4));
try {
// Store model
this.model = (0, _stringify2.default)(component.model, null, Number(4));
this.renderError = false;
} catch (e) {
this.renderError = true;
}
}
}]);
return ModelController;
Expand Down

0 comments on commit 38f8353

Please sign in to comment.