Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function applyMergedProperties(obj, key, value, values) {
var baseValue = values[key] || obj[key];
Ember.assert(`You passed in \`${JSON.stringify(value)}\` as the value for \`${key}\` but \`${key}\` cannot be an Array`, !isArray(value));
if (!baseValue) { return value; }
var newBase = merge({}, baseValue);
var hasFunction = false;
for (var prop in value) {
if (!value.hasOwnProperty(prop)) { continue; }
var propValue = value[prop];
if (isMethod(propValue)) {
// TODO: support for Computed Properties, etc?
hasFunction = true;
newBase[prop] = giveMethodSuper(obj, prop, propValue, baseValue, {});
} else {
newBase[prop] = propValue;
}
}
if (hasFunction) {
function StreamBinding(stream) {
Ember.assert("StreamBinding error: tried to bind to object that is not a stream", stream && stream.isStream);
this.init();
this.stream = stream;
this.senderCallback = undefined;
this.senderContext = undefined;
this.senderValue = undefined;
stream.subscribe(this._onNotify, this);
}
StreamBinding.prototype = create(Stream.prototype);
merge(StreamBinding.prototype, {
valueFn: function() {
return this.stream.value();
},
_onNotify: function() {
this._scheduleSync(undefined, undefined, this);
},
setValue: function(value, callback, context) {
this._scheduleSync(value, callback, context);
},
_scheduleSync: function(value, callback, context) {
if (this.senderCallback === undefined && this.senderContext === undefined) {
this.senderCallback = callback;
this.senderContext = context;
import merge from "ember-metal/merge";
import create from 'ember-metal/platform/create';
import { isGlobal } from "ember-metal/path_cache";
import Stream from "ember-metal/streams/stream";
import SimpleStream from "ember-metal/streams/simple";
function ContextStream(view) {
Ember.assert("ContextStream error: the argument is not a view", view && view.isView);
this.init();
this.view = view;
}
ContextStream.prototype = create(Stream.prototype);
merge(ContextStream.prototype, {
value() {},
_makeChildStream(key, _fullPath) {
var stream;
if (key === '' || key === 'this') {
stream = this.view._baseContext;
} else if (isGlobal(key) && Ember.lookup[key]) {
Ember.deprecate("Global lookup of " + _fullPath + " from a Handlebars template is deprecated.");
stream = new SimpleStream(Ember.lookup[key]);
stream._isGlobal = true;
} else if (key in this.view._keywords) {
stream = new SimpleStream(this.view._keywords[key]);
} else {
stream = new SimpleStream(this.view._baseContext.get(key));
}
this.helperFunction = function helperFunc(params, hash, options, env) {
var param, blockResult, fnResult;
var context = env.data.view;
var handlebarsOptions = {
hash: { },
types: new Array(params.length),
hashTypes: { }
};
merge(handlebarsOptions, options);
merge(handlebarsOptions, env);
handlebarsOptions.hash = {};
if (options.isBlock) {
handlebarsOptions.fn = function() {
blockResult = options.template.render(context, env, options.morph.contextualElement);
};
if (options.inverse) {
handlebarsOptions.inverse = function() {
blockResult = options.inverse.render(context, env, options.morph.contextualElement);
};
}
}
import { get } from "ember-metal/property_get";
import { Mixin } from 'ember-metal/mixin';
import merge from "ember-metal/merge";
import {
cloneStates,
states as viewStates
} from "ember-views/views/states";
var states = cloneStates(viewStates);
merge(states._default, {
rerenderIfNeeded() { return this; }
});
merge(states.inDOM, {
rerenderIfNeeded(view) {
if (view.normalizedValue() !== view._lastNormalizedValue) {
view.rerender();
}
}
});
export default Mixin.create({
_states: states,
normalizedValue() {
var value = this.lazyValue.value();
var valueNormalizer = get(this, 'valueNormalizerFunc');
return valueNormalizer ? valueNormalizer(value) : value;
},
function cloneStates(from) {
var into = {};
into._default = {};
into.preRender = create(into._default);
into.destroying = create(into._default);
into.inBuffer = create(into._default);
into.hasElement = create(into._default);
into.inDOM = create(into.hasElement);
for (var stateName in from) {
if (!from.hasOwnProperty(stateName)) { continue; }
merge(into[stateName], from[stateName]);
}
return into;
};
import merge from "ember-metal/merge";
import {create} from "ember-metal/platform";
import {fmt} from "ember-runtime/system/string";
import _default from "ember-views/views/states/default";
import EmberError from "ember-metal/error";
/**
@module ember
@submodule ember-views
*/
var destroyingError = "You can't call %@ on a view being destroyed";
var destroying = create(_default);
merge(destroying, {
appendChild: function() {
throw new EmberError(fmt(destroyingError, ['appendChild']));
},
rerender: function() {
throw new EmberError(fmt(destroyingError, ['rerender']));
},
destroyElement: function() {
throw new EmberError(fmt(destroyingError, ['destroyElement']));
},
empty: function() {
throw new EmberError(fmt(destroyingError, ['empty']));
},
setElement: function() {
throw new EmberError(fmt(destroyingError, ["set('element', ...)"]));
},
export function createOrUpdateComponent(component, options, createOptions, renderNode, env, attrs = {}) {
let snapshot = takeSnapshot(attrs);
let props = merge({}, options);
let defaultController = View.proto().controller;
let hasSuppliedController = 'controller' in attrs || 'controller' in props;
if (!props.ownerView && options.parentView) {
props.ownerView = options.parentView.ownerView;
}
props.attrs = snapshot;
if (component.create) {
let proto = component.proto();
if (createOptions) {
merge(props, createOptions);
}
mergeBindings(props, shadowedAttrs(proto, snapshot));
import { get } from "ember-metal/property_get";
import { set } from "ember-metal/property_set";
import merge from "ember-metal/merge";
import {
cloneStates,
states as viewStates
} from "ember-views/views/states";
import _MetamorphView from "ember-views/views/metamorph_view";
import { Mixin } from 'ember-metal/mixin';
import run from 'ember-metal/run_loop';
function K() { return this; }
var states = cloneStates(viewStates);
merge(states._default, {
rerenderIfNeeded: K
});
merge(states.inDOM, {
rerenderIfNeeded: function(view) {
if (view.normalizedValue() !== view._lastNormalizedValue) {
view.rerender();
}
}
});
var NormalizedRerenderIfNeededSupport = Mixin.create({
_states: states,
normalizedValue: function() {
var value = this.lazyValue.value();