|
|
|
|
@ -343,6 +343,8 @@ function serialize_dynamic_element_attributes(attributes, context, element_id) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// TODO why are we always treating this as a spread? needs docs, if that's not an error
|
|
|
|
|
|
|
|
|
|
let needs_isolation = false;
|
|
|
|
|
let is_reactive = false;
|
|
|
|
|
|
|
|
|
|
@ -365,23 +367,11 @@ function serialize_dynamic_element_attributes(attributes, context, element_id) {
|
|
|
|
|
attribute.type === 'SpreadAttribute' && attribute.metadata.contains_call_expression;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const isolated = b.stmt(
|
|
|
|
|
b.call(
|
|
|
|
|
'$.spread_dynamic_element_attributes_effect',
|
|
|
|
|
element_id,
|
|
|
|
|
b.thunk(b.array(values)),
|
|
|
|
|
b.literal(context.state.analysis.css.hash)
|
|
|
|
|
)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
if (needs_isolation) {
|
|
|
|
|
context.state.init.push(isolated);
|
|
|
|
|
return false;
|
|
|
|
|
} else if (is_reactive) {
|
|
|
|
|
if (needs_isolation || is_reactive) {
|
|
|
|
|
const id = context.state.scope.generate('spread_attributes');
|
|
|
|
|
context.state.init.push(b.let(id));
|
|
|
|
|
context.state.update.push(
|
|
|
|
|
b.stmt(
|
|
|
|
|
|
|
|
|
|
const update = b.stmt(
|
|
|
|
|
b.assignment(
|
|
|
|
|
'=',
|
|
|
|
|
b.id(id),
|
|
|
|
|
@ -393,10 +383,17 @@ function serialize_dynamic_element_attributes(attributes, context, element_id) {
|
|
|
|
|
b.literal(context.state.analysis.css.hash)
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
if (needs_isolation) {
|
|
|
|
|
context.state.init.push(serialize_update(update));
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
context.state.update.push(update);
|
|
|
|
|
return true;
|
|
|
|
|
} else {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
context.state.init.push(
|
|
|
|
|
b.stmt(
|
|
|
|
|
b.call(
|
|
|
|
|
@ -410,7 +407,6 @@ function serialize_dynamic_element_attributes(attributes, context, element_id) {
|
|
|
|
|
);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Serializes an assignment to an element property by adding relevant statements to either only
|
|
|
|
|
|