malinajs 0.7.0-a6 → 0.7.0-a7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/malina.js +3 -3
  2. package/package.json +1 -1
  3. package/runtime.js +11 -6
package/malina.js CHANGED
@@ -4616,7 +4616,7 @@
4616
4616
  if(n.props) ctx.write(', $localProps');
4617
4617
  ctx.write(') => {', true);
4618
4618
  ctx.indent++;
4619
- if(n.props) ctx.write(true, `let {${n.props.join(', ')}} = $localProps;`);
4619
+ if(n.props) ctx.write(true, `let {${n.props.join(', ')}} = $localProps || {};`);
4620
4620
  ctx.add(n.bind);
4621
4621
 
4622
4622
  if(n.props && this.inuse.apply) ctx.write(true, `return ($localProps) => ({${n.props.join(', ')}} = $localProps, $$apply());`);
@@ -5679,7 +5679,7 @@
5679
5679
  }, (ctx, n) => {
5680
5680
  let dynamicProps = this.inuse.apply && !n.staticProps;
5681
5681
 
5682
- let missed = '', slotName = n.name == 'default' ? 'null' : n.name;
5682
+ let missed = '', slotName = n.name == 'default' ? 'null' : `'${n.name}'`;
5683
5683
  if(dynamicProps) ctx.write(`$runtime.invokeSlot($component, ${slotName}, $context`);
5684
5684
  else ctx.write(`$runtime.invokeSlotBase($component, ${slotName}, $context`);
5685
5685
 
@@ -6296,7 +6296,7 @@
6296
6296
  return { event, fn, rootModifier };
6297
6297
  }
6298
6298
 
6299
- const version = '0.7.0-a6';
6299
+ const version = '0.7.0-a7';
6300
6300
 
6301
6301
 
6302
6302
  async function compile(source, config = {}) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "malinajs",
3
- "version": "0.7.0-a6",
3
+ "version": "0.7.0-a7",
4
4
  "license": "MIT",
5
5
  "scripts": {
6
6
  "prepare": "npm run build",
package/runtime.js CHANGED
@@ -1123,19 +1123,24 @@ function $$eachBlock(label, onlyChild, fn, getKey, bind) {
1123
1123
 
1124
1124
  const invokeSlotBase = ($component, slotName, $context, props, placeholder) => {
1125
1125
  let $slot = $component.$option.slots?.[slotName || 'default'];
1126
- return $slot ? $slot($component, $context, props)[0] : placeholder?.();
1126
+ return $slot ? $slot($component, $context, props) : placeholder?.();
1127
1127
  };
1128
1128
 
1129
1129
  const invokeSlot = ($component, slotName, $context, propsFn, placeholder, cmp) => {
1130
1130
  let $slot = $component.$option.slots?.[slotName || 'default'];
1131
1131
 
1132
1132
  if($slot) {
1133
- let push, $dom,
1134
- w = new WatchObject(propsFn, value => push(value));
1133
+ let push, w = new WatchObject(propsFn, value => push(value));
1135
1134
  Object.assign(w, {value: {}, cmp, idle: true});
1136
1135
  fire(w);
1137
- ([$dom, push] = $slot($component, $context, w.value));
1138
- if(push) current_cd.watchers.push(w);
1136
+ let $dom = $slot($component, $context, w.value);
1137
+ if($dom.$dom) {
1138
+ if($dom.push) {
1139
+ push = $dom.push;
1140
+ current_cd.watchers.push(w);
1141
+ }
1142
+ $dom = $dom.$dom;
1143
+ }
1139
1144
  return $dom;
1140
1145
  } else return placeholder?.();
1141
1146
  };
@@ -1148,7 +1153,7 @@ const makeSlot = (fr, fn) => {
1148
1153
  $onDestroy(() => cd_detach($cd));
1149
1154
  parentCD.component.apply();
1150
1155
  try {
1151
- return [$dom, fn($dom, $context, callerComponent, props)];
1156
+ return {$dom, push: fn($dom, $context, callerComponent, props)};
1152
1157
  } finally {
1153
1158
  current_cd = prev;
1154
1159
  }