malinajs 0.6.50 → 0.6.53
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.
- package/compile.js +24 -16
- package/malina.js +25 -17
- package/package.json +1 -1
- package/runtime.js +2 -2
package/compile.js
CHANGED
|
@@ -829,7 +829,8 @@ function parse() {
|
|
|
829
829
|
} else continue;
|
|
830
830
|
|
|
831
831
|
return {
|
|
832
|
-
value: source.substring(start + 1, index - 1)
|
|
832
|
+
value: source.substring(start + 1, index - 1),
|
|
833
|
+
raw: source.substring(start, index)
|
|
833
834
|
};
|
|
834
835
|
}
|
|
835
836
|
};
|
|
@@ -846,6 +847,16 @@ function parse() {
|
|
|
846
847
|
const go = (parent) => {
|
|
847
848
|
let textNode = null;
|
|
848
849
|
|
|
850
|
+
const addText = v => {
|
|
851
|
+
if(!textNode) {
|
|
852
|
+
textNode = {
|
|
853
|
+
type: 'text',
|
|
854
|
+
value: ''
|
|
855
|
+
};
|
|
856
|
+
}
|
|
857
|
+
textNode.value += v;
|
|
858
|
+
};
|
|
859
|
+
|
|
849
860
|
const flushText = () => {
|
|
850
861
|
if(!textNode) return;
|
|
851
862
|
parent.body.push(textNode);
|
|
@@ -910,10 +921,12 @@ function parse() {
|
|
|
910
921
|
}
|
|
911
922
|
continue;
|
|
912
923
|
} else if(a === '{') {
|
|
913
|
-
if(['#', '/', ':', '@'].indexOf(source[index + 1]) >= 0) {
|
|
914
|
-
flushText();
|
|
924
|
+
if(['#', '/', ':', '@', '*'].indexOf(source[index + 1]) >= 0) {
|
|
915
925
|
let bind = readBinding();
|
|
916
|
-
if(bind.value
|
|
926
|
+
if(bind.value[0] != '*') flushText();
|
|
927
|
+
if(bind.value[0] == '*') {
|
|
928
|
+
addText(bind.raw);
|
|
929
|
+
} else if(bind.value.match(/^@\w+/)) {
|
|
917
930
|
let tag = {
|
|
918
931
|
type: 'systag',
|
|
919
932
|
value: bind.value
|
|
@@ -1005,13 +1018,7 @@ function parse() {
|
|
|
1005
1018
|
}
|
|
1006
1019
|
}
|
|
1007
1020
|
|
|
1008
|
-
|
|
1009
|
-
textNode = {
|
|
1010
|
-
type: 'text',
|
|
1011
|
-
value: ''
|
|
1012
|
-
};
|
|
1013
|
-
}
|
|
1014
|
-
textNode.value += readNext();
|
|
1021
|
+
addText(readNext());
|
|
1015
1022
|
} flushText();
|
|
1016
1023
|
assert(parent.type === 'root', 'File ends to early');
|
|
1017
1024
|
};
|
|
@@ -4297,6 +4304,7 @@ function makeComponent(node, element) {
|
|
|
4297
4304
|
let value = prop.value;
|
|
4298
4305
|
if(name == '@@') {
|
|
4299
4306
|
forwardAllEvents = true;
|
|
4307
|
+
this.require('$events');
|
|
4300
4308
|
return false;
|
|
4301
4309
|
} else if(name == 'this') {
|
|
4302
4310
|
dynamicComponent = unwrapExp(value);
|
|
@@ -5352,7 +5360,7 @@ function makeFragment(node) {
|
|
|
5352
5360
|
svg: block.svg
|
|
5353
5361
|
})
|
|
5354
5362
|
}, (ctx, n) => {
|
|
5355
|
-
ctx.write(true, `function $fragment_${n.name}($cd, label, $props, $events, $$fragmentSlot) {\n`);
|
|
5363
|
+
ctx.write(true, `function $fragment_${n.name}($cd, $$label, $props, $events, $$fragmentSlot) {\n`);
|
|
5356
5364
|
ctx.indent++;
|
|
5357
5365
|
|
|
5358
5366
|
if(n.props?.length) {
|
|
@@ -5367,7 +5375,7 @@ function makeFragment(node) {
|
|
|
5367
5375
|
|
|
5368
5376
|
ctx.build(n.template);
|
|
5369
5377
|
ctx.build(n.source);
|
|
5370
|
-
ctx.writeLine(`$runtime.insertAfter(label, $parentElement);`);
|
|
5378
|
+
ctx.writeLine(`$runtime.insertAfter($$label, $parentElement);`);
|
|
5371
5379
|
|
|
5372
5380
|
ctx.indent--;
|
|
5373
5381
|
ctx.writeLine('}');
|
|
@@ -5490,15 +5498,15 @@ function attachFragment(node, element) {
|
|
|
5490
5498
|
ctx.write(missed, ',\n');
|
|
5491
5499
|
missed = '';
|
|
5492
5500
|
if(n.slot.source) {
|
|
5493
|
-
ctx.writeLine(`($cd, label) => {`);
|
|
5501
|
+
ctx.writeLine(`($cd, $$label) => {`);
|
|
5494
5502
|
ctx.goIndent(() => {
|
|
5495
5503
|
ctx.build(n.slot.template);
|
|
5496
5504
|
ctx.build(n.slot.source);
|
|
5497
|
-
ctx.writeLine(`$runtime.insertAfter(label, $parentElement);`);
|
|
5505
|
+
ctx.writeLine(`$runtime.insertAfter($$label, $parentElement);`);
|
|
5498
5506
|
});
|
|
5499
5507
|
ctx.write(true, `}`);
|
|
5500
5508
|
} else {
|
|
5501
|
-
ctx.write(true, `($cd, label) => $runtime.insertAfter(label, `);
|
|
5509
|
+
ctx.write(true, `($cd, $$label) => $runtime.insertAfter($$label, `);
|
|
5502
5510
|
ctx.build(n.slot.template);
|
|
5503
5511
|
ctx.write(`)\n`);
|
|
5504
5512
|
}
|
package/malina.js
CHANGED
|
@@ -830,7 +830,8 @@
|
|
|
830
830
|
} else continue;
|
|
831
831
|
|
|
832
832
|
return {
|
|
833
|
-
value: source.substring(start + 1, index - 1)
|
|
833
|
+
value: source.substring(start + 1, index - 1),
|
|
834
|
+
raw: source.substring(start, index)
|
|
834
835
|
};
|
|
835
836
|
}
|
|
836
837
|
};
|
|
@@ -847,6 +848,16 @@
|
|
|
847
848
|
const go = (parent) => {
|
|
848
849
|
let textNode = null;
|
|
849
850
|
|
|
851
|
+
const addText = v => {
|
|
852
|
+
if(!textNode) {
|
|
853
|
+
textNode = {
|
|
854
|
+
type: 'text',
|
|
855
|
+
value: ''
|
|
856
|
+
};
|
|
857
|
+
}
|
|
858
|
+
textNode.value += v;
|
|
859
|
+
};
|
|
860
|
+
|
|
850
861
|
const flushText = () => {
|
|
851
862
|
if(!textNode) return;
|
|
852
863
|
parent.body.push(textNode);
|
|
@@ -911,10 +922,12 @@
|
|
|
911
922
|
}
|
|
912
923
|
continue;
|
|
913
924
|
} else if(a === '{') {
|
|
914
|
-
if(['#', '/', ':', '@'].indexOf(source[index + 1]) >= 0) {
|
|
915
|
-
flushText();
|
|
925
|
+
if(['#', '/', ':', '@', '*'].indexOf(source[index + 1]) >= 0) {
|
|
916
926
|
let bind = readBinding();
|
|
917
|
-
if(bind.value
|
|
927
|
+
if(bind.value[0] != '*') flushText();
|
|
928
|
+
if(bind.value[0] == '*') {
|
|
929
|
+
addText(bind.raw);
|
|
930
|
+
} else if(bind.value.match(/^@\w+/)) {
|
|
918
931
|
let tag = {
|
|
919
932
|
type: 'systag',
|
|
920
933
|
value: bind.value
|
|
@@ -1006,13 +1019,7 @@
|
|
|
1006
1019
|
}
|
|
1007
1020
|
}
|
|
1008
1021
|
|
|
1009
|
-
|
|
1010
|
-
textNode = {
|
|
1011
|
-
type: 'text',
|
|
1012
|
-
value: ''
|
|
1013
|
-
};
|
|
1014
|
-
}
|
|
1015
|
-
textNode.value += readNext();
|
|
1022
|
+
addText(readNext());
|
|
1016
1023
|
} flushText();
|
|
1017
1024
|
assert(parent.type === 'root', 'File ends to early');
|
|
1018
1025
|
};
|
|
@@ -4298,6 +4305,7 @@
|
|
|
4298
4305
|
let value = prop.value;
|
|
4299
4306
|
if(name == '@@') {
|
|
4300
4307
|
forwardAllEvents = true;
|
|
4308
|
+
this.require('$events');
|
|
4301
4309
|
return false;
|
|
4302
4310
|
} else if(name == 'this') {
|
|
4303
4311
|
dynamicComponent = unwrapExp(value);
|
|
@@ -5353,7 +5361,7 @@
|
|
|
5353
5361
|
svg: block.svg
|
|
5354
5362
|
})
|
|
5355
5363
|
}, (ctx, n) => {
|
|
5356
|
-
ctx.write(true, `function $fragment_${n.name}($cd, label, $props, $events, $$fragmentSlot) {\n`);
|
|
5364
|
+
ctx.write(true, `function $fragment_${n.name}($cd, $$label, $props, $events, $$fragmentSlot) {\n`);
|
|
5357
5365
|
ctx.indent++;
|
|
5358
5366
|
|
|
5359
5367
|
if(n.props?.length) {
|
|
@@ -5368,7 +5376,7 @@
|
|
|
5368
5376
|
|
|
5369
5377
|
ctx.build(n.template);
|
|
5370
5378
|
ctx.build(n.source);
|
|
5371
|
-
ctx.writeLine(`$runtime.insertAfter(label, $parentElement);`);
|
|
5379
|
+
ctx.writeLine(`$runtime.insertAfter($$label, $parentElement);`);
|
|
5372
5380
|
|
|
5373
5381
|
ctx.indent--;
|
|
5374
5382
|
ctx.writeLine('}');
|
|
@@ -5491,15 +5499,15 @@
|
|
|
5491
5499
|
ctx.write(missed, ',\n');
|
|
5492
5500
|
missed = '';
|
|
5493
5501
|
if(n.slot.source) {
|
|
5494
|
-
ctx.writeLine(`($cd, label) => {`);
|
|
5502
|
+
ctx.writeLine(`($cd, $$label) => {`);
|
|
5495
5503
|
ctx.goIndent(() => {
|
|
5496
5504
|
ctx.build(n.slot.template);
|
|
5497
5505
|
ctx.build(n.slot.source);
|
|
5498
|
-
ctx.writeLine(`$runtime.insertAfter(label, $parentElement);`);
|
|
5506
|
+
ctx.writeLine(`$runtime.insertAfter($$label, $parentElement);`);
|
|
5499
5507
|
});
|
|
5500
5508
|
ctx.write(true, `}`);
|
|
5501
5509
|
} else {
|
|
5502
|
-
ctx.write(true, `($cd, label) => $runtime.insertAfter(label, `);
|
|
5510
|
+
ctx.write(true, `($cd, $$label) => $runtime.insertAfter($$label, `);
|
|
5503
5511
|
ctx.build(n.slot.template);
|
|
5504
5512
|
ctx.write(`)\n`);
|
|
5505
5513
|
}
|
|
@@ -5890,7 +5898,7 @@
|
|
|
5890
5898
|
return {event, fn};
|
|
5891
5899
|
}
|
|
5892
5900
|
|
|
5893
|
-
const version = '0.6.
|
|
5901
|
+
const version = '0.6.53';
|
|
5894
5902
|
|
|
5895
5903
|
|
|
5896
5904
|
async function compile(source, config = {}) {
|
package/package.json
CHANGED
package/runtime.js
CHANGED
|
@@ -295,12 +295,12 @@ function $tick(fn, uniq) {
|
|
|
295
295
|
_tick_list.push(fn);
|
|
296
296
|
if(_tick_planned.$tick) return;
|
|
297
297
|
_tick_planned.$tick = true;
|
|
298
|
-
|
|
298
|
+
Promise.resolve().then(() => {
|
|
299
299
|
_tick_planned = {};
|
|
300
300
|
let list = _tick_list;
|
|
301
301
|
_tick_list = [];
|
|
302
302
|
list.map(safeCall);
|
|
303
|
-
}
|
|
303
|
+
});
|
|
304
304
|
}
|
|
305
305
|
|
|
306
306
|
function $makeEmitter(option) {
|