|
|
@ -138,10 +138,7 @@ export default class Component extends Node {
|
|
|
|
statements.push(`var ${name_initial_data} = ${initialPropString};`);
|
|
|
|
statements.push(`var ${name_initial_data} = ${initialPropString};`);
|
|
|
|
|
|
|
|
|
|
|
|
const setParentFromChildOnChange = new CodeBuilder();
|
|
|
|
const setParentFromChildOnChange = new CodeBuilder();
|
|
|
|
const setParentFromChildOnInit = new CodeBuilder();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const setStoreFromChildOnChange = new CodeBuilder();
|
|
|
|
const setStoreFromChildOnChange = new CodeBuilder();
|
|
|
|
const setStoreFromChildOnInit = new CodeBuilder();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bindings.forEach((binding: Binding) => {
|
|
|
|
bindings.forEach((binding: Binding) => {
|
|
|
|
let { name: key } = getObject(binding.value);
|
|
|
|
let { name: key } = getObject(binding.value);
|
|
|
@ -196,11 +193,6 @@ export default class Component extends Node {
|
|
|
|
setFromChild
|
|
|
|
setFromChild
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
(isStoreProp ? setStoreFromChildOnInit : setParentFromChildOnInit).addConditional(
|
|
|
|
|
|
|
|
`!${name_updating}.${binding.name}`,
|
|
|
|
|
|
|
|
setFromChild
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// TODO could binding.dependencies.length ever be 0?
|
|
|
|
// TODO could binding.dependencies.length ever be 0?
|
|
|
|
if (binding.dependencies.length) {
|
|
|
|
if (binding.dependencies.length) {
|
|
|
|
updates.push(deindent`
|
|
|
|
updates.push(deindent`
|
|
|
@ -237,16 +229,7 @@ export default class Component extends Node {
|
|
|
|
|
|
|
|
|
|
|
|
beforecreate = deindent`
|
|
|
|
beforecreate = deindent`
|
|
|
|
#component.root._beforecreate.push(function() {
|
|
|
|
#component.root._beforecreate.push(function() {
|
|
|
|
var childState = ${name}.get(), ${initialisers};
|
|
|
|
${name}._bind({ ${bindings.map(b => `${b.name}: 1`).join(', ')} }, ${name}.get());
|
|
|
|
${!setStoreFromChildOnInit.isEmpty() && deindent`
|
|
|
|
|
|
|
|
${setStoreFromChildOnInit}
|
|
|
|
|
|
|
|
#component.store.set(newStoreState);
|
|
|
|
|
|
|
|
`}
|
|
|
|
|
|
|
|
${!setParentFromChildOnInit.isEmpty() && deindent`
|
|
|
|
|
|
|
|
${setParentFromChildOnInit}
|
|
|
|
|
|
|
|
#component._set(newState);
|
|
|
|
|
|
|
|
`}
|
|
|
|
|
|
|
|
${name_updating} = {};
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
`;
|
|
|
|
`;
|
|
|
|
} else if (initialProps.length) {
|
|
|
|
} else if (initialProps.length) {
|
|
|
|