Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
d2c6131e7c | |||
c9776fc683 | |||
9a77b5722a | |||
28d9d62bb4 |
16
package-lock.json
generated
16
package-lock.json
generated
@ -1,16 +1,17 @@
|
|||||||
{
|
{
|
||||||
"name": "@pushrocks/smartntml",
|
"name": "@pushrocks/smartntml",
|
||||||
"version": "1.0.7",
|
"version": "1.0.9",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "@pushrocks/smartntml",
|
"name": "@pushrocks/smartntml",
|
||||||
"version": "1.0.7",
|
"version": "1.0.9",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@happy-dom/global-registrator": "^4.1.0",
|
"@happy-dom/global-registrator": "^4.1.0",
|
||||||
"@pushrocks/smartpromise": "^3.1.7",
|
"@pushrocks/smartpromise": "^3.1.7",
|
||||||
|
"@types/strip-comments": "^2.0.1",
|
||||||
"lit": "^2.2.5"
|
"lit": "^2.2.5"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
@ -1297,6 +1298,12 @@
|
|||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
|
"node_modules/@types/strip-comments": {
|
||||||
|
"version": "2.0.1",
|
||||||
|
"resolved": "https://verdaccio.lossless.one/@types%2fstrip-comments/-/strip-comments-2.0.1.tgz",
|
||||||
|
"integrity": "sha512-7xjBu+wvKSRHSmgZoRAfUBZMIupd7634b2+uI2qeBDUvfoX+VELjuWCzlL6CF40eG/TGKwU+pqoJfvcvs3fzKA==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
"node_modules/@types/through2": {
|
"node_modules/@types/through2": {
|
||||||
"version": "2.0.36",
|
"version": "2.0.36",
|
||||||
"resolved": "https://verdaccio.lossless.one/@types%2fthrough2/-/through2-2.0.36.tgz",
|
"resolved": "https://verdaccio.lossless.one/@types%2fthrough2/-/through2-2.0.36.tgz",
|
||||||
@ -7147,6 +7154,11 @@
|
|||||||
"integrity": "sha1-gJPuBBam4r8qpjOBCRFLP7/6Dps=",
|
"integrity": "sha1-gJPuBBam4r8qpjOBCRFLP7/6Dps=",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"@types/strip-comments": {
|
||||||
|
"version": "2.0.1",
|
||||||
|
"resolved": "https://verdaccio.lossless.one/@types%2fstrip-comments/-/strip-comments-2.0.1.tgz",
|
||||||
|
"integrity": "sha512-7xjBu+wvKSRHSmgZoRAfUBZMIupd7634b2+uI2qeBDUvfoX+VELjuWCzlL6CF40eG/TGKwU+pqoJfvcvs3fzKA=="
|
||||||
|
},
|
||||||
"@types/through2": {
|
"@types/through2": {
|
||||||
"version": "2.0.36",
|
"version": "2.0.36",
|
||||||
"resolved": "https://verdaccio.lossless.one/@types%2fthrough2/-/through2-2.0.36.tgz",
|
"resolved": "https://verdaccio.lossless.one/@types%2fthrough2/-/through2-2.0.36.tgz",
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@pushrocks/smartntml",
|
"name": "@pushrocks/smartntml",
|
||||||
"version": "1.0.7",
|
"version": "1.0.9",
|
||||||
"private": false,
|
"private": false,
|
||||||
"description": "lit-html for the backend",
|
"description": "lit-html for the backend",
|
||||||
"main": "dist_ts/index.js",
|
"main": "dist_ts/index.js",
|
||||||
@ -22,6 +22,7 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@happy-dom/global-registrator": "^4.1.0",
|
"@happy-dom/global-registrator": "^4.1.0",
|
||||||
"@pushrocks/smartpromise": "^3.1.7",
|
"@pushrocks/smartpromise": "^3.1.7",
|
||||||
|
"@types/strip-comments": "^2.0.1",
|
||||||
"lit": "^2.2.5"
|
"lit": "^2.2.5"
|
||||||
},
|
},
|
||||||
"browserslist": [
|
"browserslist": [
|
||||||
|
@ -3,6 +3,6 @@
|
|||||||
*/
|
*/
|
||||||
export const commitinfo = {
|
export const commitinfo = {
|
||||||
name: '@pushrocks/smartntml',
|
name: '@pushrocks/smartntml',
|
||||||
version: '1.0.7',
|
version: '1.0.9',
|
||||||
description: 'lit-html for the backend'
|
description: 'lit-html for the backend'
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,7 @@ export class Smartntml {
|
|||||||
if (this.smartntmlSingletonDeferred) {
|
if (this.smartntmlSingletonDeferred) {
|
||||||
return this.smartntmlSingletonDeferred.promise;
|
return this.smartntmlSingletonDeferred.promise;
|
||||||
}
|
}
|
||||||
|
this.smartntmlSingletonDeferred = plugins.smartpromise.defer();
|
||||||
const smartntmlInstance = await this.createAndInit();
|
const smartntmlInstance = await this.createAndInit();
|
||||||
this.smartntmlSingletonDeferred.resolve(smartntmlInstance);
|
this.smartntmlSingletonDeferred.resolve(smartntmlInstance);
|
||||||
return this.smartntmlSingletonDeferred.promise;
|
return this.smartntmlSingletonDeferred.promise;
|
||||||
@ -35,9 +36,13 @@ export class Smartntml {
|
|||||||
this.html = lit.html;
|
this.html = lit.html;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async renderTemplateResult(templateResult: litTypes.TemplateResult) {
|
public async renderTemplateResult(templateResult: litTypes.TemplateResult, stripCommentsArg = true) {
|
||||||
const element = document.createElement('div');
|
const element = document.createElement('div');
|
||||||
this.render(templateResult, element);
|
this.render(templateResult, element);
|
||||||
return element.innerHTML;
|
let stringResult = element.innerHTML;
|
||||||
|
if (stripCommentsArg) {
|
||||||
|
stringResult = stringResult.replace(/<!--(.*?)-->/g, '');
|
||||||
|
}
|
||||||
|
return stringResult;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,3 +8,5 @@ import * as smartpromise from '@pushrocks/smartpromise';
|
|||||||
export {
|
export {
|
||||||
smartpromise
|
smartpromise
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// third party scope
|
||||||
|
Reference in New Issue
Block a user