gonia 0.3.4 → 0.3.5
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/dist/client/hydrate.js +12 -7
- package/dist/inject.js +6 -0
- package/dist/server/render.js +1 -0
- package/package.json +1 -1
package/dist/client/hydrate.js
CHANGED
|
@@ -445,16 +445,21 @@ async function processDirectiveElements() {
|
|
|
445
445
|
}
|
|
446
446
|
// 4. Render template if present (can query DOM for <template> elements etc)
|
|
447
447
|
if (options.template) {
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
if (typeof options.template === 'string') {
|
|
451
|
-
html = options.template;
|
|
448
|
+
if (el.hasAttribute('data-g-prerendered')) {
|
|
449
|
+
el.removeAttribute('data-g-prerendered');
|
|
452
450
|
}
|
|
453
451
|
else {
|
|
454
|
-
const
|
|
455
|
-
html
|
|
452
|
+
const attrs = getTemplateAttrs(el);
|
|
453
|
+
let html;
|
|
454
|
+
if (typeof options.template === 'string') {
|
|
455
|
+
html = options.template;
|
|
456
|
+
}
|
|
457
|
+
else {
|
|
458
|
+
const result = options.template(attrs, el);
|
|
459
|
+
html = result instanceof Promise ? await result : result;
|
|
460
|
+
}
|
|
461
|
+
el.innerHTML = html;
|
|
456
462
|
}
|
|
457
|
-
el.innerHTML = html;
|
|
458
463
|
}
|
|
459
464
|
}
|
|
460
465
|
}
|
package/dist/inject.js
CHANGED
|
@@ -87,6 +87,12 @@ function parseFunctionParams(fn) {
|
|
|
87
87
|
export function resolveDependencies(fn, expr, element, evalFn, config, using) {
|
|
88
88
|
const inject = getInjectables(fn);
|
|
89
89
|
const args = inject.map(dep => {
|
|
90
|
+
if (dep.startsWith('_')) {
|
|
91
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
92
|
+
console.warn(`Injectable '${dep}' starts with underscore — passing undefined.`);
|
|
93
|
+
}
|
|
94
|
+
return undefined;
|
|
95
|
+
}
|
|
90
96
|
switch (dep) {
|
|
91
97
|
case '$expr':
|
|
92
98
|
return expr;
|
package/dist/server/render.js
CHANGED
|
@@ -397,6 +397,7 @@ export async function render(html, state, registry) {
|
|
|
397
397
|
templateHtml = result instanceof Promise ? await result : result;
|
|
398
398
|
}
|
|
399
399
|
item.el.innerHTML = templateHtml;
|
|
400
|
+
item.el.setAttribute('data-g-prerendered', 'true');
|
|
400
401
|
// Index new elements from the template
|
|
401
402
|
indexTree(item.el);
|
|
402
403
|
}
|