New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

simple-boot-front

Package Overview
Dependencies
Maintainers
1
Versions
117
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

simple-boot-front - npm Package Compare versions

Comparing version 1.0.25 to 1.0.26

util/node/NodeUtils.d.ts

9

module/Module.d.ts

@@ -13,3 +13,3 @@ import { Renderer } from '../render/Renderer';

private id;
_scope?: Scope;
_scopes: Map<string, Scope>;
_option: {

@@ -28,3 +28,2 @@ template: string;

private init;
renderString(): string;
getValue<T = any>(name: string, value?: any): T;

@@ -47,5 +46,4 @@ setValue(name: string, value?: any): void;

onFinish(): void;
private get scope();
setScope(wrap?: boolean): Scope | undefined;
renderToScope(varName: string): void;
render(selector?: string): void;
renderWrap(selector?: string): void;

@@ -56,5 +54,6 @@ private findModuleField;

procAttr<T extends HTMLElement>(element: Element | null, attrName: string, f: (h: T, value: string | null) => void): void;
renderWrapString(): string;
get templateWrapString(): string;
getTemplateWrapScopeString(scope: Scope): string;
get templateString(): string;
exist(): boolean;
}

@@ -16,2 +16,7 @@ var __extends = (this && this.__extends) || (function () {

})();
var __spreadArray = (this && this.__spreadArray) || function (to, from) {
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
to[j] = from[i];
return to;
};
import { Renderer } from '../render/Renderer';

@@ -38,2 +43,3 @@ import { fromEvent } from 'rxjs';

_this._navigation = _navigation;
_this._scopes = new Map();
_this.value = option.value;

@@ -57,6 +63,2 @@ _this._option = {

};
Module.prototype.renderString = function () {
var _a;
return ((_a = this._renderer) === null || _a === void 0 ? void 0 : _a.renderString(this._option.template, this)) || '';
};
Module.prototype.getValue = function (name, value) {

@@ -194,23 +196,17 @@ var thisAny = this;

};
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) {
Module.prototype.setScope = function (wrap) {
var _a;
(_a = this._renderer) === null || _a === void 0 ? void 0 : _a.renderToScope(this.scope, this, varName);
if (wrap === void 0) { wrap = true; }
var scope = (_a = this._renderer) === null || _a === void 0 ? void 0 : _a.compileScope(wrap ? this.templateWrapString : this.templateString, this);
if (scope) {
this._scopes.set(scope.uuid, scope);
}
return scope;
};
Module.prototype.render = function (selector) {
var _a;
if (selector === void 0) { selector = 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(); });
Module.prototype.renderToScope = function (varName) {
var _this = this;
this._scopes.forEach(function (it) {
var _a;
(_a = _this._renderer) === null || _a === void 0 ? void 0 : _a.renderToScope(it, _this, varName);
});
};

@@ -220,3 +216,6 @@ Module.prototype.renderWrap = function (selector) {

if (selector === void 0) { selector = this.selector; }
(_a = this._renderer) === null || _a === void 0 ? void 0 : _a.renderToByScope(this.scope, selector, this.renderWrapString());
if (this._scopes.size <= 0) {
this.setScope();
}
(_a = this._renderer) === null || _a === void 0 ? void 0 : _a.renderToByScopes.apply(_a, __spreadArray([selector], Array.from(this._scopes.values())));
this._onChangedRender();

@@ -252,6 +251,2 @@ this.renderd(this.selector);

};
Module.prototype.renderWrapString = function () {
var _a;
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", {

@@ -264,2 +259,12 @@ get: function () {

});
Module.prototype.getTemplateWrapScopeString = function (scope) {
return "<" + this._option.wrapElement + " id=\"" + this.id + "\" scope=\"" + scope.uuid + "\">" + (this._option.template || '') + "</" + this._option.wrapElement + ">";
};
Object.defineProperty(Module.prototype, "templateString", {
get: function () {
return this._option.template || '';
},
enumerable: false,
configurable: true
});
Module.prototype.exist = function () {

@@ -266,0 +271,0 @@ var _a;

{
"name": "simple-boot-front",
"version": "1.0.25",
"version": "1.0.26",
"main": "SimpleApplication.js",

@@ -5,0 +5,0 @@ "license": "MIT",

@@ -17,7 +17,3 @@ import { ScopeObject } from './ScopeObject';

}, position?: ScopePosition);
execResult(): string;
executeFragment(): {
fragment: DocumentFragment;
scopeObjects: ScopeObject[];
};
executeFragment(): DocumentFragment;
exec(obj?: any): {

@@ -24,0 +20,0 @@ object: ScopeObject;

@@ -17,6 +17,2 @@ import { ScopeObject } from './ScopeObject';

}
Scope.prototype.execResult = function () {
var result = this.raws;
return result;
};
Scope.prototype.executeFragment = function () {

@@ -28,4 +24,3 @@ var templateElement = document.createElement('template');

var _a, _b, _c;
it.exec();
var childScopeObject = it.scopeResult;
var childScopeObject = it.exec().result;
var nodeIterator = document.createNodeIterator(rawFragment, NodeFilter.SHOW_COMMENT, {

@@ -38,12 +33,8 @@ acceptNode: function (node) {

});
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);
}
;
var 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);
});
var scopeObjects = [];
return { fragment: rawFragment, scopeObjects: scopeObjects };
return rawFragment;
};

@@ -50,0 +41,0 @@ Scope.prototype.exec = function (obj) {

@@ -15,3 +15,3 @@ import { RandomUtils } from '../../util/random/RandomUtils';

var endComment = document.createComment('scope end ' + this.uuid);
return new ScopeResultSet(this, templateElement.content, startComment, endComment);
return new ScopeResultSet(this.uuid, this, templateElement.content, startComment, endComment);
};

@@ -22,3 +22,3 @@ ScopeObject.prototype.eval = function (str) {

ScopeObject.prototype.scopeEval = function (scope, script) {
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)();
return Function("\"use strict\";\n const write = (str) => {\n this.writes += str;\n }\n const module = (module) => {\n if (module) {\n const scope = module.setScope(false);\n // console.log('scope Eval', module, scope);\n this.writes += (module?.getTemplateWrapScopeString(scope) ?? '');\n }\n }\n " + script + "\n ").bind(scope)();
};

@@ -25,0 +25,0 @@ return ScopeObject;

import { ScopeObject } from './ScopeObject';
export declare class ScopeResultSet {
uuid: string;
object: ScopeObject;

@@ -8,3 +9,3 @@ fragment: DocumentFragment;

childNodes: ChildNode[];
constructor(object: ScopeObject, fragment: DocumentFragment, startComment: Comment, endComment: Comment);
constructor(uuid: string, object: ScopeObject, fragment: DocumentFragment, startComment: Comment, endComment: Comment);
}
var ScopeResultSet = (function () {
function ScopeResultSet(object, fragment, startComment, endComment) {
function ScopeResultSet(uuid, object, fragment, startComment, endComment) {
this.uuid = uuid;
this.object = object;

@@ -4,0 +5,0 @@ this.fragment = fragment;

import { Scope } from './Scope';
import { Runnable } from '../../run/Runnable';
export declare class SimCompiler implements Runnable {
private raws;
raws: string;
private obj;

@@ -6,0 +6,0 @@ config: {

@@ -5,2 +5,3 @@ import { Module } from '../module/Module';

import { Scope } from './compile/Scope';
import { ScopeResultSet } from './compile/ScopeResultSet';
export declare class Renderer {

@@ -10,6 +11,6 @@ private option;

compileScope(template: string, obj: any, compiler?: SimCompiler): Scope | undefined;
renderString(template: string, obj: any, compiler?: SimCompiler): string;
render(module: Module | string): void;
renderToScope(scope: Scope, module: Module, varName: string): boolean;
renderToByScope(scope: Scope, selector: string, module?: Module | string): void;
renderToByScopes(selector: string, ...scopes: Scope[]): void;
renderToByScopeResultSet(scopeResultSet: ScopeResultSet, selector: string): void;
renderTo(selector: string, module?: Module | string): void;

@@ -16,0 +17,0 @@ prependStyle(selector: string, style: string | undefined): void;

@@ -14,2 +14,3 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {

import { SimCompiler } from './compile/SimCompiler';
import { DomUtils } from '../util/dom/DomUtils';
var Renderer = (function () {

@@ -23,11 +24,6 @@ function Renderer(option) {

};
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()) || '';
};
Renderer.prototype.render = function (module) {
var targetElement = document.querySelector(this.option.selector);
if (targetElement && module instanceof Module) {
targetElement.innerHTML = module.renderString();
targetElement.innerHTML = module.templateString;
module._onChangedRender();

@@ -43,5 +39,2 @@ }

var _a, _b;
if (!it.scopeResult) {
it.exec();
}
if (it.scopeResult) {

@@ -59,24 +52,35 @@ it.scopeResult.childNodes.forEach(function (it) { return it.remove(); });

};
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();
Renderer.prototype.renderToByScopes = function (selector) {
var scopes = [];
for (var _i = 1; _i < arguments.length; _i++) {
scopes[_i - 1] = arguments[_i];
}
else if (targetElement && typeof module === 'string') {
targetElement.innerHTML = '';
targetElement.appendChild(scope.executeFragment().fragment);
}
scopes.forEach(function (scope) {
var _a;
var targetElement = (_a = document.querySelector(selector + ("[scope='" + scope.uuid + "']"))) !== null && _a !== void 0 ? _a : document.querySelector(selector);
if (targetElement) {
targetElement.innerHTML = '';
targetElement.appendChild(scope.executeFragment());
}
});
};
Renderer.prototype.renderToByScopeResultSet = function (scopeResultSet, selector) {
DomUtils.selectorElements(selector).forEach(function (it) {
it.innerHTML = '';
it.appendChild(scopeResultSet.fragment);
});
};
Renderer.prototype.renderTo = function (selector, module) {
if (module === void 0) { module = this.option.selector; }
var targetElement = document.querySelector(selector);
if (targetElement && module instanceof Module) {
targetElement.innerHTML = module.renderString();
var targetElements = DomUtils.selectorElements(selector);
if (targetElements.length > 0 && module instanceof Module) {
targetElements.forEach(function (it) {
it.innerHTML = module.templateString;
});
module._onChangedRender();
}
else if (targetElement && typeof module === 'string') {
targetElement.innerHTML = module;
else if (targetElements.length > 0 && typeof module === 'string') {
targetElements.forEach(function (it) {
it.innerHTML = module;
});
}

@@ -83,0 +87,0 @@ };

@@ -6,2 +6,4 @@ export declare type Attr = {

export declare class DomUtils {
static selectorElements(selector: string, element?: Element | Document): Element[];
static selectorNodes(selector: string, element?: Element | Document): NodeListOf<Element>;
static removeAttribute(result: HTMLElement, attrs: string[]): void;

@@ -8,0 +10,0 @@ static setAttribute(result: HTMLElement, attrs: string[]): void;

var DomUtils = (function () {
function DomUtils() {
}
DomUtils.selectorElements = function (selector, element) {
if (element === void 0) { element = document; }
return Array.prototype.slice.call(element.querySelectorAll(selector));
};
DomUtils.selectorNodes = function (selector, element) {
if (element === void 0) { element = document; }
return element.querySelectorAll(selector);
};
DomUtils.removeAttribute = function (result, attrs) {

@@ -5,0 +13,0 @@ attrs.forEach(function (it) {

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc