simple-boot-front
Advanced tools
Comparing version 1.0.23 to 1.0.24
@@ -5,13 +5,24 @@ import { Renderer } from '../render/Renderer'; | ||
import { Navigation } from '../service/Navigation'; | ||
import { Scope } from '../render/compile/Scope'; | ||
export declare class Module extends SimBase implements LifeCycle { | ||
selector: string; | ||
template: string; | ||
wrapElement: string; | ||
private _renderer; | ||
private _navigation; | ||
router_outlet_selector: string | undefined; | ||
private router_outlet_id; | ||
styleImports: string[] | undefined; | ||
id: string; | ||
constructor(selector?: string, template?: string, wrapElement?: string, _renderer?: Renderer | undefined, _navigation?: Navigation | undefined); | ||
router_outlet_selector?: string; | ||
private router_outlet_id?; | ||
private id; | ||
_scope?: Scope; | ||
_option: { | ||
template: string; | ||
styleImports: string[]; | ||
wrapElement: string; | ||
}; | ||
value: any; | ||
constructor(selector?: string, option?: { | ||
template?: string; | ||
styleImports?: string[]; | ||
wrapElement?: string; | ||
value?: any; | ||
}, _renderer?: Renderer | undefined, _navigation?: Navigation | undefined); | ||
private init; | ||
renderString(): string; | ||
@@ -35,4 +46,7 @@ getValue<T = any>(name: string, value?: any): T; | ||
onFinish(): void; | ||
private get scope(); | ||
renderToScope(varName: string): void; | ||
render(selector?: string): void; | ||
renderWrap(selector?: string): void; | ||
private findModuleField; | ||
renderd(selector: string): void; | ||
@@ -42,4 +56,4 @@ transStyle(selector: string): void; | ||
renderWrapString(): string; | ||
get templateWrapString(): string; | ||
exist(): boolean; | ||
toString(): string; | ||
} |
@@ -27,22 +27,33 @@ var __extends = (this && this.__extends) || (function () { | ||
__extends(Module, _super); | ||
function Module(selector, template, wrapElement, _renderer, _navigation) { | ||
function Module(selector, option, _renderer, _navigation) { | ||
if (selector === void 0) { selector = ''; } | ||
if (template === void 0) { template = '{%write(this.value)%}'; } | ||
if (wrapElement === void 0) { wrapElement = 'div'; } | ||
if (option === void 0) { option = {}; } | ||
if (_renderer === void 0) { _renderer = (_a = SimGlobal.application) === null || _a === void 0 ? void 0 : _a.simstanceManager.getOrNewSim(Renderer); } | ||
if (_navigation === void 0) { _navigation = (_b = SimGlobal.application) === null || _b === void 0 ? void 0 : _b.simstanceManager.getOrNewSim(Navigation); } | ||
var _a, _b; | ||
var _a, _b, _c, _d, _e; | ||
var _this = _super.call(this) || this; | ||
_this.selector = selector; | ||
_this.template = template; | ||
_this.wrapElement = wrapElement; | ||
_this._renderer = _renderer; | ||
_this._navigation = _navigation; | ||
_this.value = option.value; | ||
_this._option = { | ||
template: (_c = option.template) !== null && _c !== void 0 ? _c : '<!--%write(this.value)%-->', | ||
styleImports: (_d = option.styleImports) !== null && _d !== void 0 ? _d : [], | ||
wrapElement: (_e = option.wrapElement) !== null && _e !== void 0 ? _e : 'span' | ||
}; | ||
_this.id = "___Module___" + _this.selector + "_" + RandomUtils.uuid(); | ||
_this.selector = "#" + _this.id; | ||
_this.init(); | ||
return _this; | ||
} | ||
Module.prototype.init = function () { | ||
if (this._option.template.search('\\[router-outlet\\]')) { | ||
this.router_outlet_id = "___Module___router-outlet_" + this.id + "_" + RandomUtils.uuid(); | ||
this.router_outlet_selector = "#" + this.router_outlet_id; | ||
this._option.template = this._option.template.replace('[router-outlet]', " id='" + this.router_outlet_id + "' "); | ||
} | ||
}; | ||
Module.prototype.renderString = function () { | ||
var _a; | ||
return ((_a = this._renderer) === null || _a === void 0 ? void 0 : _a.renderString(this.template, this)) || ''; | ||
return ((_a = this._renderer) === null || _a === void 0 ? void 0 : _a.renderString(this._option.template, this)) || ''; | ||
}; | ||
@@ -115,7 +126,2 @@ Module.prototype.getValue = function (name, value) { | ||
Module.prototype._onInit = function () { | ||
if (this.template.search('\\[router-outlet\\]')) { | ||
this.router_outlet_id = "___Module___router-outlet_" + this.id + "_" + RandomUtils.uuid(); | ||
this.router_outlet_selector = "#" + this.router_outlet_id; | ||
this.template = this.template.replace('[router-outlet]', " id='" + this.router_outlet_id + "' "); | ||
} | ||
this.onInit(); | ||
@@ -187,7 +193,24 @@ }; | ||
}; | ||
Object.defineProperty(Module.prototype, "scope", { | ||
get: function () { | ||
var _a; | ||
if (!this._scope) { | ||
this._scope = (_a = this._renderer) === null || _a === void 0 ? void 0 : _a.compileScope(this.templateWrapString, this); | ||
} | ||
return this._scope; | ||
}, | ||
enumerable: false, | ||
configurable: true | ||
}); | ||
Module.prototype.renderToScope = function (varName) { | ||
var _a; | ||
(_a = this._renderer) === null || _a === void 0 ? void 0 : _a.renderToScope(this.scope, this, varName); | ||
}; | ||
Module.prototype.render = function (selector) { | ||
var _a; | ||
if (selector === void 0) { selector = this.selector; } | ||
(_a = this._renderer) === null || _a === void 0 ? void 0 : _a.renderTo(selector, this); | ||
console.log('module render', selector, '\\n', this.selector); | ||
(_a = this._renderer) === null || _a === void 0 ? void 0 : _a.renderToByScope(this.scope, selector, this); | ||
this.renderd(this.selector); | ||
this.findModuleField().forEach(function (it) { return it.renderWrap(); }); | ||
}; | ||
@@ -197,6 +220,18 @@ Module.prototype.renderWrap = function (selector) { | ||
if (selector === void 0) { selector = this.selector; } | ||
(_a = this._renderer) === null || _a === void 0 ? void 0 : _a.renderTo(selector, this.renderWrapString()); | ||
(_a = this._renderer) === null || _a === void 0 ? void 0 : _a.renderToByScope(this.scope, selector, this.renderWrapString()); | ||
this._onChangedRender(); | ||
this.renderd(this.selector); | ||
this.findModuleField().forEach(function (it) { return it.renderWrap(); }); | ||
}; | ||
Module.prototype.findModuleField = function () { | ||
var inModuleVars = []; | ||
for (var key in this) { | ||
if (this[key] instanceof Module) { | ||
var targetModule = this[key]; | ||
inModuleVars.push(targetModule); | ||
console.log('key-->', this.selector, key); | ||
} | ||
} | ||
return inModuleVars; | ||
}; | ||
Module.prototype.renderd = function (selector) { | ||
@@ -207,3 +242,3 @@ this.transStyle(selector); | ||
var _a, _b; | ||
var join = (_a = this.styleImports) === null || _a === void 0 ? void 0 : _a.map(function (it) { | ||
var join = (_a = this._option.styleImports) === null || _a === void 0 ? void 0 : _a.map(function (it) { | ||
var regExp = new RegExp('\\/\\*\\[module\\-selector\\]\\*\\/', 'gi'); | ||
@@ -221,4 +256,11 @@ return it.replace(regExp, selector + ' '); | ||
var _a; | ||
return "<" + this.wrapElement + " id=\"" + this.id + "\">" + (((_a = this._renderer) === null || _a === void 0 ? void 0 : _a.renderString(this.template, this)) || '') + "</" + this.wrapElement + ">"; | ||
return "<" + this._option.wrapElement + " id=\"" + this.id + "\">" + (((_a = this._renderer) === null || _a === void 0 ? void 0 : _a.renderString(this._option.template, this)) || '') + "</" + this._option.wrapElement + ">"; | ||
}; | ||
Object.defineProperty(Module.prototype, "templateWrapString", { | ||
get: function () { | ||
return "<" + this._option.wrapElement + " id=\"" + this.id + "\">" + (this._option.template || '') + "</" + this._option.wrapElement + ">"; | ||
}, | ||
enumerable: false, | ||
configurable: true | ||
}); | ||
Module.prototype.exist = function () { | ||
@@ -228,5 +270,2 @@ var _a; | ||
}; | ||
Module.prototype.toString = function () { | ||
return this.renderWrapString(); | ||
}; | ||
return Module; | ||
@@ -233,0 +272,0 @@ }(SimBase)); |
{ | ||
"name": "simple-boot-front", | ||
"version": "1.0.23", | ||
"version": "1.0.24", | ||
"main": "SimpleApplication.js", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -29,3 +29,2 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { | ||
SimProxyHandler.prototype.set = function (obj, prop, value) { | ||
var _this = this; | ||
var _a, _b; | ||
@@ -36,28 +35,15 @@ value = (_a = this.simstanceManager) === null || _a === void 0 ? void 0 : _a.proxy(value, Module); | ||
try { | ||
var targetSelector = "module-isolate='" + prop + "'"; | ||
var elementNodeListOf = obj.findChildAttributeElements(targetSelector); | ||
if (elementNodeListOf && elementNodeListOf.length > 0) { | ||
var temp = document.createElement('div'); | ||
temp.innerHTML = obj.template; | ||
var tempElements_1 = temp.querySelectorAll("[" + targetSelector + "]"); | ||
elementNodeListOf.forEach(function (it, key) { | ||
_this.renderer.renderInnerHTML(it, tempElements_1[key].innerHTML, obj); | ||
obj.addEvent(it); | ||
}); | ||
return true; | ||
} | ||
} | ||
catch (e) { | ||
} | ||
try { | ||
var sim = (_b = this.simstanceManager) === null || _b === void 0 ? void 0 : _b.getOrNewSim(obj.constructor); | ||
if (sim) { | ||
sim.render(); | ||
console.log('proxy --> sim, ', 'props:', prop, 'scope:', sim._scope); | ||
sim.renderToScope(prop); | ||
} | ||
else { | ||
obj.render(); | ||
console.log('proxy --> else, ', 'props:', prop, 'scope:', obj._scope); | ||
obj.renderToScope(prop); | ||
} | ||
} | ||
catch (e) { | ||
obj.render(); | ||
console.log('proxy --> catch, ', 'props:', prop, 'scope:', obj._scope); | ||
obj.renderToScope(prop); | ||
} | ||
@@ -64,0 +50,0 @@ } |
@@ -1,2 +0,2 @@ | ||
simple-boot-front [v1.0.23] | ||
simple-boot-front [v1.0.24] | ||
=========== | ||
@@ -108,3 +108,3 @@ | ||
<h5 class="card-title">set module</h5> | ||
<div>set variable: {%write(this.title)%}</div> | ||
<div>set variable: <!--%write(this.title)%--></div> | ||
<div>input module variable: <input type="text" module-event-keyup="changeText"></div> | ||
@@ -117,3 +117,3 @@ </div> | ||
<h5>event click change "module-event-click"</h5> | ||
{%write(this.numbers)%} | ||
<!--%module(this.numbers)%--> | ||
<button class="btn btn-info" module-event-click="changeData">change</button> | ||
@@ -132,6 +132,4 @@ </div> | ||
<div class="card-body"> | ||
<h5>variable isolate "module-isolate"</h5> | ||
<div module-isolate="data"> | ||
{%write(this.data)%} | ||
</div> | ||
<h5>variable module</h5> | ||
<!--%module(this.data)%--> | ||
data link change event <input type="text" module-link="data"> | ||
@@ -142,3 +140,3 @@ </div> | ||
<div> | ||
{%write(this.thisData)%} | ||
<!--%write(this.thisData)%--> | ||
thisData <button module-event-click="thisDataChange"> this data change</button> | ||
@@ -152,10 +150,12 @@ </div> | ||
## View template engine | ||
- ### Update view only for parts where the value has changed. | ||
```html | ||
<div>{%write(this.data)%}</div> | ||
<div><!--%write(this.data)%--></div> | ||
<div><!--%module(this.aModule)%--></div> | ||
<div> | ||
{% | ||
<!--% | ||
for (let i of this.datas) { | ||
write('<li>' + i + '</li>'); | ||
} | ||
%} | ||
%--> | ||
</div> | ||
@@ -232,3 +232,3 @@ ``` | ||
export class AppInfo extends Module { | ||
template = '<div><h3>info</h3>{%write(this.datas)%}</div>'; | ||
template = '<div><h3>info</h3><!--%write(this.datas)%--></div>'; | ||
datas = 'default data'; | ||
@@ -274,7 +274,2 @@ data(i: Intent) { | ||
``` | ||
- **module-isolate**: Partial reloading scope | ||
- value: target variable name | ||
- ```html | ||
<div module-isolate="data">{%write(this.data)%}</div> | ||
``` | ||
- **router-active-class**: url === href attribute => class add | ||
@@ -281,0 +276,0 @@ - value: add and remove class name |
import { ScopeObject } from './ScopeObject'; | ||
import { ScopePosition } from './ScopePosition'; | ||
import { ScopeResultSet } from './ScopeResultSet'; | ||
export declare class Scope { | ||
@@ -6,9 +8,20 @@ private raws; | ||
private config; | ||
private position; | ||
childs: Scope[]; | ||
usingVars: string[]; | ||
uuid: string; | ||
scopeResult?: ScopeResultSet; | ||
constructor(raws: string, obj: any, config?: { | ||
start: string; | ||
end: string; | ||
}); | ||
}, position?: ScopePosition); | ||
execResult(): string; | ||
exec(): ScopeObject; | ||
executeFragment(): { | ||
fragment: DocumentFragment; | ||
scopeObjects: ScopeObject[]; | ||
}; | ||
exec(obj?: any): { | ||
object: ScopeObject; | ||
result: ScopeResultSet; | ||
}; | ||
private run; | ||
@@ -15,0 +28,0 @@ indexOf(data: string, searchString: string, position?: number): number; |
import { ScopeObject } from './ScopeObject'; | ||
import { ScopePosition } from './ScopePosition'; | ||
import { RandomUtils } from '../../util/random/RandomUtils'; | ||
var Scope = (function () { | ||
function Scope(raws, obj, config) { | ||
function Scope(raws, obj, config, position) { | ||
if (config === void 0) { config = { start: '{%', end: '%}' }; } | ||
if (position === void 0) { position = new ScopePosition(0, raws.length); } | ||
this.raws = raws; | ||
this.obj = obj; | ||
this.config = config; | ||
this.position = position; | ||
this.childs = []; | ||
this.usingVars = []; | ||
this.uuid = RandomUtils.uuid(); | ||
this.run(); | ||
} | ||
Scope.prototype.execResult = function () { | ||
var _this = this; | ||
var result = this.raws; | ||
return result; | ||
}; | ||
Scope.prototype.executeFragment = function () { | ||
var templateElement = document.createElement('template'); | ||
templateElement.innerHTML = this.raws; | ||
var rawFragment = templateElement.content; | ||
console.log('executeFragment ', rawFragment.childNodes.length); | ||
this.childs.forEach(function (it) { | ||
var scopeObject = it.exec(); | ||
result = result.replace(_this.config.start + it.raws + _this.config.end, scopeObject.writes); | ||
var _a, _b, _c; | ||
it.exec(); | ||
var childScopeObject = it.scopeResult; | ||
var nodeIterator = document.createNodeIterator(rawFragment, NodeFilter.SHOW_COMMENT, { | ||
acceptNode: function (node) { | ||
var coment = node.data; | ||
var b = coment.startsWith('%') && coment.endsWith('%') && coment === ('%' + it.raws + '%'); | ||
return b ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_REJECT; | ||
} | ||
}); | ||
var currentNode; | ||
while (currentNode = nodeIterator.nextNode()) { | ||
(_a = currentNode === null || currentNode === void 0 ? void 0 : currentNode.parentNode) === null || _a === void 0 ? void 0 : _a.insertBefore(childScopeObject.startComment, currentNode); | ||
(_b = currentNode === null || currentNode === void 0 ? void 0 : currentNode.parentNode) === null || _b === void 0 ? void 0 : _b.insertBefore(childScopeObject.endComment, currentNode.nextSibling); | ||
(_c = currentNode === null || currentNode === void 0 ? void 0 : currentNode.parentNode) === null || _c === void 0 ? void 0 : _c.replaceChild(childScopeObject.fragment, currentNode); | ||
} | ||
; | ||
}); | ||
return result; | ||
var scopeObjects = []; | ||
return { fragment: rawFragment, scopeObjects: scopeObjects }; | ||
}; | ||
Scope.prototype.exec = function () { | ||
Scope.prototype.exec = function (obj) { | ||
if (obj === void 0) { obj = this.obj; } | ||
var scopeObject = new ScopeObject(); | ||
var target = Object.assign(scopeObject, this.obj); | ||
target.eval(this.raws); | ||
return target; | ||
var object = Object.assign(scopeObject, obj); | ||
this.scopeResult = object.executeResultSet(this.raws); | ||
return { object: object, result: this.scopeResult }; | ||
}; | ||
Scope.prototype.run = function () { | ||
var targetRaws = this.raws; | ||
var varRegexStr = 'this\\.([a-zA-Z_$.]*)'; | ||
var varRegex = RegExp(varRegexStr, 'gm'); | ||
var varExec = varRegex.exec(targetRaws); | ||
this.usingVars = []; | ||
while (varExec) { | ||
this.usingVars.push(varExec[1]); | ||
varExec = varRegex.exec(varExec.input); | ||
} | ||
var i = this.indexOf(targetRaws, this.config.start); | ||
while (i !== -1) { | ||
var startIdx = i; | ||
var endIdex = this.tailIndexOf(targetRaws, this.config.end, i); | ||
while (endIdex !== -1) { | ||
var sub = targetRaws.substring(startIdx, endIdex); | ||
var endIdx = this.tailIndexOf(targetRaws, this.config.end, i); | ||
while (endIdx !== -1) { | ||
var sub = targetRaws.substring(startIdx, endIdx); | ||
var matchStart = sub.match(RegExp(this.config.start, 'gm')) || []; | ||
var matchEnd = sub.match(RegExp(this.config.end, 'gm')) || []; | ||
if (matchStart.length === matchEnd.length) { | ||
this.childs.push(new Scope(sub.substring(this.config.start.length, sub.length - this.config.end.length), this.obj, this.config)); | ||
var scope = new Scope(sub.substring(this.config.start.length, sub.length - this.config.end.length), this.obj, this.config, new ScopePosition(startIdx, endIdx)); | ||
this.childs.push(scope); | ||
break; | ||
} | ||
endIdex = this.tailIndexOf(targetRaws, this.config.end, endIdex); | ||
endIdx = this.tailIndexOf(targetRaws, this.config.end, endIdx); | ||
} | ||
if (endIdex !== -1) { | ||
i = this.indexOf(targetRaws, this.config.start, endIdex); | ||
if (endIdx !== -1) { | ||
i = this.indexOf(targetRaws, this.config.start, endIdx); | ||
} | ||
@@ -45,0 +83,0 @@ else { |
@@ -0,6 +1,10 @@ | ||
import { ScopeResultSet } from './ScopeResultSet'; | ||
export declare class ScopeObject { | ||
uuid: string; | ||
[name: string]: any; | ||
writes: string; | ||
eval(str: string): any; | ||
scopeEval(scope: any, script: string): any; | ||
constructor(uuid?: string); | ||
executeResultSet(code: string): ScopeResultSet; | ||
private eval; | ||
private scopeEval; | ||
} |
@@ -0,5 +1,17 @@ | ||
import { RandomUtils } from '../../util/random/RandomUtils'; | ||
import { ScopeResultSet } from './ScopeResultSet'; | ||
var ScopeObject = (function () { | ||
function ScopeObject() { | ||
function ScopeObject(uuid) { | ||
if (uuid === void 0) { uuid = RandomUtils.uuid(); } | ||
this.uuid = uuid; | ||
this.writes = ''; | ||
} | ||
ScopeObject.prototype.executeResultSet = function (code) { | ||
this.eval(code); | ||
var templateElement = document.createElement('template'); | ||
templateElement.innerHTML = this.writes; | ||
var startComment = document.createComment('scope start ' + this.uuid); | ||
var endComment = document.createComment('scope end ' + this.uuid); | ||
return new ScopeResultSet(this, templateElement.content, startComment, endComment); | ||
}; | ||
ScopeObject.prototype.eval = function (str) { | ||
@@ -9,3 +21,3 @@ return this.scopeEval(this, str); | ||
ScopeObject.prototype.scopeEval = function (scope, script) { | ||
return Function("\"use strict\";\n const write = (str) => {\n this.writes += str;\n }\n " + script + "\n ").bind(scope)(); | ||
return Function("\"use strict\";\n const write = (str) => {\n this.writes += str;\n }\n const module = (module) => {\n // this.writes += module._option.template;\n if (module.renderWrapString) {\n this.writes += module.renderWrapString();\n }\n // module.renderWrap();\n // console.log('--module sub' ,module);\n }\n " + script + "\n ").bind(scope)(); | ||
}; | ||
@@ -12,0 +24,0 @@ return ScopeObject; |
import { Scope } from './Scope'; | ||
import { ScopePosition } from './ScopePosition'; | ||
var SimCompiler = (function () { | ||
function SimCompiler(raws, obj, config) { | ||
if (config === void 0) { config = { start: '{%', end: '%}' }; } | ||
if (config === void 0) { config = { start: '<!--%', end: '%-->' }; } | ||
this.raws = raws; | ||
@@ -10,3 +11,3 @@ this.obj = obj; | ||
SimCompiler.prototype.run = function () { | ||
this.root = new Scope(this.raws, this.obj, this.config); | ||
this.root = new Scope(this.raws, this.obj, this.config, new ScopePosition(0, this.raws.length)); | ||
return this; | ||
@@ -13,0 +14,0 @@ }; |
import { Module } from '../module/Module'; | ||
import { SimOption } from '../option/SimOption'; | ||
import { SimCompiler } from './compile/SimCompiler'; | ||
import { Scope } from './compile/Scope'; | ||
export declare class Renderer { | ||
private option; | ||
constructor(option: SimOption); | ||
renderString(template: string, obj: any): string; | ||
compileScope(template: string, obj: any, compiler?: SimCompiler): Scope | undefined; | ||
renderString(template: string, obj: any, compiler?: SimCompiler): string; | ||
render(module: Module | string): void; | ||
renderInnerHTML(element: Element, template: string, data: any): void; | ||
renderToScope(scope: Scope, module: Module, varName: string): boolean; | ||
renderToByScope(scope: Scope, selector: string, module?: Module | string): void; | ||
renderTo(selector: string, module?: Module | string): void; | ||
@@ -10,0 +14,0 @@ prependStyle(selector: string, style: string | undefined): void; |
@@ -18,4 +18,9 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { | ||
} | ||
Renderer.prototype.renderString = function (template, obj) { | ||
var root = new SimCompiler(template, obj).run().root; | ||
Renderer.prototype.compileScope = function (template, obj, compiler) { | ||
if (compiler === void 0) { compiler = new SimCompiler(template, obj); } | ||
return compiler.run().root; | ||
}; | ||
Renderer.prototype.renderString = function (template, obj, compiler) { | ||
if (compiler === void 0) { compiler = new SimCompiler(template, obj); } | ||
var root = compiler.run().root; | ||
return (root === null || root === void 0 ? void 0 : root.execResult()) || ''; | ||
@@ -33,5 +38,34 @@ }; | ||
}; | ||
Renderer.prototype.renderInnerHTML = function (element, template, data) { | ||
element.innerHTML = this.renderString(template, data); | ||
Renderer.prototype.renderToScope = function (scope, module, varName) { | ||
var targets = scope.childs.filter(function (it) { return it.usingVars.includes(varName); }); | ||
targets.forEach(function (it) { | ||
var _a, _b; | ||
if (!it.scopeResult) { | ||
it.exec(); | ||
} | ||
if (it.scopeResult) { | ||
it.scopeResult.childNodes.forEach(function (it) { return it.remove(); }); | ||
var startComment_1 = it.scopeResult.startComment; | ||
var endComment = it.scopeResult.endComment; | ||
it.exec(module); | ||
it.scopeResult.childNodes.forEach(function (cit) { var _a; return (_a = startComment_1.parentNode) === null || _a === void 0 ? void 0 : _a.insertBefore(cit, startComment_1.nextSibling); }); | ||
(_a = startComment_1.parentNode) === null || _a === void 0 ? void 0 : _a.replaceChild(it.scopeResult.startComment, startComment_1); | ||
(_b = endComment.parentNode) === null || _b === void 0 ? void 0 : _b.replaceChild(it.scopeResult.endComment, endComment); | ||
} | ||
}); | ||
return false; | ||
}; | ||
Renderer.prototype.renderToByScope = function (scope, selector, module) { | ||
if (module === void 0) { module = this.option.selector; } | ||
var targetElement = document.querySelector(selector); | ||
if (targetElement && module instanceof Module) { | ||
targetElement.innerHTML = ''; | ||
targetElement.appendChild(scope.executeFragment().fragment); | ||
module._onChangedRender(); | ||
} | ||
else if (targetElement && typeof module === 'string') { | ||
targetElement.innerHTML = ''; | ||
targetElement.appendChild(scope.executeFragment().fragment); | ||
} | ||
}; | ||
Renderer.prototype.renderTo = function (selector, module) { | ||
@@ -38,0 +72,0 @@ if (module === void 0) { module = this.option.selector; } |
@@ -78,2 +78,3 @@ import 'reflect-metadata'; | ||
if (targetSelector === void 0) { targetSelector = (_a = this.option) === null || _a === void 0 ? void 0 : _a.selector; } | ||
console.log('renderRouterModule router --->', targetSelector); | ||
if (module && !module.exist()) { | ||
@@ -89,2 +90,3 @@ module._onInit(); | ||
RouterManager.prototype.render = function (module, targetSelector) { | ||
console.log('render router --->', targetSelector); | ||
if (module) { | ||
@@ -91,0 +93,0 @@ module._onInit(); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
185940
146
2606
311
1