Skip to content

Commit

Permalink
Synchronous ding dings
Browse files Browse the repository at this point in the history
  • Loading branch information
stephband committed Jul 14, 2024
1 parent 54a9dde commit 00e7f70
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 19 deletions.
3 changes: 1 addition & 2 deletions modules/compile/compile-attribute.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,7 @@ export default function compileAttribute(array, element, attribute, path, messag
message = truncate(64, '<'
+ element.tagName.toLowerCase() + ' '
+ name + '="' + source
+ '">')
+ ' (' + message + ')' ;
+ '">') ;
}

// We need the Renderer here just to get .parameterNames. This is a bit
Expand Down
12 changes: 6 additions & 6 deletions modules/compile/compile-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,12 +138,12 @@ const compileNode = overload((targets, node) => toType(node), {

const source = decode(string);
if (window.DEBUG) {
const parent = node.parentElement || { tagName: 'template' };
message = truncate(64, '<'
+ parent.tagName.toLowerCase() + '>'
+ source.trim()
+ '</' + parent.tagName.toLowerCase() + '>')
+ ' (' + message + ')' ;
const parent = node.parentElement;
const tag = parent && parent.tagName.toLowerCase();
message = truncate(64, tag ?
'<' + tag + '>' + source.trim() + '</' + tag + '>' :
source.trim()
);
}

//targets.push(new TextRenderer(path, indexOf(node), source, message, options, node));
Expand Down
14 changes: 4 additions & 10 deletions modules/scope/include.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,11 @@ ${ data.array.map(include('#list-item')) }
**/

import Data from '../../../fn/modules/signal-data.js';
import Template from '../template.js';
import getById from '../dom/get-by-id.js';
import Template from '../template.js';
import requestTemplate from '../request-template.js';
import requestData from '../request-data.js';

function push(template, data, element, parameters, options) {
const renderer = new Template(template, element, parameters, data, options);
//renderer.push(data);
return renderer;
}

function pipe(template, data, element, parameters, options) {
const renderer = new Template(template, element, parameters, options);
data.each((data) => renderer.push(data));
Expand All @@ -51,7 +45,7 @@ export default function include(src, data, element, parameters, options) {

// Support JSON or module URLs
if (dataRequest) {
return dataRequest.then((data) => push(template, data, element, parameters, options));
return dataRequest.then((data) => new Template(template, element, parameters, data, options));
}

// Support a stream of data
Expand All @@ -60,7 +54,7 @@ export default function include(src, data, element, parameters, options) {
}

// Support object or ... ?
return push(template, object || {}, element, parameters, options);
return new Template(template, element, parameters, object, options);
}

// Template is external to document
Expand All @@ -78,7 +72,7 @@ export default function include(src, data, element, parameters, options) {

return Promise
.all([templateRequest, dataRequest])
.then(([template, data]) => push(template, data, element, parameters));
.then(([template, data]) => new Template(template, element, parameters, data, options));
}


2 changes: 1 addition & 1 deletion modules/template.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ export default class Template {
this.parameters = parameters;
this.first = content.childNodes[0];
this.last = content.childNodes[content.childNodes.length - 1];
this.#data = Signal.of(data);
this.#data = Signal.of(Data.of(data));
this.contents = compiled.targets
// We must find targets in cloned content
.map(this.#toRendererParams, this)
Expand Down

0 comments on commit 00e7f70

Please sign in to comment.