simple-boot-front
Advanced tools
Comparing version 1.0.98 to 1.0.99
@@ -0,0 +0,0 @@ import { ConstructorType, GenericClassDecorator } from 'simple-boot-core/types/Types'; |
"use strict"; | ||
var __extends = (this && this.__extends) || (function () { | ||
var extendStatics = function (d, b) { | ||
extendStatics = Object.setPrototypeOf || | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; | ||
return extendStatics(d, b); | ||
}; | ||
return function (d, b) { | ||
if (typeof b !== "function" && b !== null) | ||
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); | ||
extendStatics(d, b); | ||
function __() { this.constructor = d; } | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
}; | ||
})(); | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -30,13 +15,4 @@ exports.getComponent = exports.Component = exports.ComponentMetadataKey = exports.componentSelectors = void 0; | ||
} | ||
ReflectUtils_1.ReflectUtils.defineMetadata(exports.ComponentMetadataKey, config, target); | ||
exports.componentSelectors.set(config.selector.toLowerCase(), target); | ||
ReflectUtils_1.ReflectUtils.defineMetadata(exports.ComponentMetadataKey, config, target); | ||
return (function (_super) { | ||
__extends(class_1, _super); | ||
function class_1() { | ||
var _this = _super !== null && _super.apply(this, arguments) || this; | ||
_this.__componentInstances = {}; | ||
return _this; | ||
} | ||
return class_1; | ||
}(target)); | ||
}; | ||
@@ -43,0 +19,0 @@ }; |
@@ -0,0 +0,0 @@ import { ConstructorType, GenericClassDecorator } from 'simple-boot-core/types/Types'; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ export declare abstract class Fetcher { |
@@ -0,0 +0,0 @@ "use strict"; |
export interface onChangedRender { | ||
onChangedRender(): void; | ||
} |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); |
export interface OnDestroy { | ||
onDestroy(): void; | ||
} |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); |
export interface OnFinish { | ||
onFinish(): void; | ||
} |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); |
@@ -0,3 +1,8 @@ | ||
import { RawSet } from 'dom-render/RawSet'; | ||
export declare type OnInitParameter = { | ||
makerObj: any; | ||
rawSet: RawSet; | ||
}; | ||
export interface OnInit { | ||
onInit(): void; | ||
onInit(...data: any): any; | ||
} |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); |
export interface OnInitedChild { | ||
onInitedChild(): void; | ||
} |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); |
@@ -0,0 +0,0 @@ import { SimOption } from 'simple-boot-core/SimOption'; |
@@ -0,0 +0,0 @@ "use strict"; |
{ | ||
"name": "simple-boot-front", | ||
"version": "1.0.98", | ||
"version": "1.0.99", | ||
"main": "SimpleApplication.js", | ||
@@ -57,8 +57,10 @@ "license": "MIT", | ||
"tsc": "tsc", | ||
"setting:root-dist": "rm -rf ../dist-simple-boot-front && mkdirp ../dist-simple-boot-front && cp package-root-dist.json ../dist-simple-boot-front/package.json", | ||
"tsc:root-dist": "npm run setting:root-dist && tsc --outDir ../dist-simple-boot-front --declarationDir ../dist-simple-boot-front", | ||
"tsc:watch": "rm -rf ./dist && mkdir dist && cp package.json dist && tsc --watch --sourceMap true", | ||
"tsc:watch:root-dist": "npm run setting:root-dist && tsc --outDir ../dist-simple-boot-front --declarationDir ../dist-simple-boot-front --watch --sourceMap true", | ||
"tsc:watch:dev": "rm -rf ./dist && mkdir dist && cp package-dev.json dist && tsc --watch --sourceMap true", | ||
"test": "jest --detectOpenHandles --forceExit" | ||
}, | ||
"alias": { | ||
}, | ||
"alias": {}, | ||
"devDependencies": { | ||
@@ -76,9 +78,9 @@ "@types/jest": "^26.0.22", | ||
"ts-jest": "^26.5.4", | ||
"typescript": "^4.3.5" | ||
"typescript": "^4.4.3" | ||
}, | ||
"dependencies": { | ||
"dom-render": "^1.0.66", | ||
"simple-boot-core": "^1.0.22", | ||
"dom-render": "^1.0.68", | ||
"simple-boot-core": "^1.0.23", | ||
"reflect-metadata": "^0.1.13" | ||
} | ||
} |
@@ -0,0 +0,0 @@ ![Single Page Application Framworks](assets/banner.png) |
@@ -0,0 +0,0 @@ import { Runnable } from 'simple-boot-core/run/Runnable'; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,2 +1,5 @@ | ||
import { SimFrontOption } from '../option/SimFrontOption'; | ||
export declare class CookieService { | ||
private option; | ||
constructor(option: SimFrontOption); | ||
get(key: string): string | undefined; | ||
@@ -6,4 +9,4 @@ getAll(): { | ||
}; | ||
set(name: string, value: string, exp: number): void; | ||
delete(name: string): void; | ||
set(name: string, value: string, exp?: number): void; | ||
delete(name: string, path?: string): void; | ||
} |
@@ -8,7 +8,12 @@ "use strict"; | ||
}; | ||
var __metadata = (this && this.__metadata) || function (k, v) { | ||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.CookieService = void 0; | ||
var SimDecorator_1 = require("simple-boot-core/decorators/SimDecorator"); | ||
var SimFrontOption_1 = require("../option/SimFrontOption"); | ||
var CookieService = (function () { | ||
function CookieService() { | ||
function CookieService(option) { | ||
this.option = option; | ||
} | ||
@@ -21,3 +26,3 @@ CookieService.prototype.get = function (key) { | ||
var all = {}; | ||
var strings = (_a = document.cookie.split(';')) !== null && _a !== void 0 ? _a : []; | ||
var strings = (_a = this.option.window.document.cookie.split(';')) !== null && _a !== void 0 ? _a : []; | ||
strings.forEach(function (it) { | ||
@@ -32,11 +37,18 @@ var set = it.split('='); | ||
CookieService.prototype.set = function (name, value, exp) { | ||
var date = new Date(); | ||
date.setTime(date.getTime() + exp); | ||
document.cookie = name + '=' + value + ';expires=' + date.toUTCString() + ';path=/'; | ||
if (exp === undefined) { | ||
this.option.window.document.cookie = name + '=' + value + ';path=/'; | ||
} | ||
else { | ||
var date = new Date(); | ||
date.setTime(date.getTime() + exp); | ||
this.option.window.document.cookie = name + '=' + value + ';expires=' + date.toUTCString() + ';path=/'; | ||
} | ||
}; | ||
CookieService.prototype.delete = function (name) { | ||
document.cookie = name + '=; expires=Thu, 01 Jan 1999 00:00:10 GMT;'; | ||
CookieService.prototype.delete = function (name, path) { | ||
if (path === void 0) { path = '/'; } | ||
this.option.window.document.cookie = name + '=; expires=Thu, 01 Jan 1999 00:00:10 GMT;' + " path=".concat(path); | ||
}; | ||
CookieService = __decorate([ | ||
(0, SimDecorator_1.Sim)() | ||
(0, SimDecorator_1.Sim)(), | ||
__metadata("design:paramtypes", [SimFrontOption_1.SimFrontOption]) | ||
], CookieService); | ||
@@ -43,0 +55,0 @@ return CookieService; |
export declare class HttpService { | ||
constructor(); | ||
} |
@@ -0,0 +0,0 @@ "use strict"; |
import { SimFrontOption } from '../option/SimFrontOption'; | ||
export declare class Navigation { | ||
private option; | ||
option: SimFrontOption; | ||
constructor(option: SimFrontOption); | ||
get url(): string; | ||
get path(): string; | ||
get queryParams(): Map<string, string>; | ||
get queryParamsObject(): any; | ||
get pathInfo(): { | ||
@@ -11,3 +13,7 @@ path: string; | ||
}; | ||
go(path: string, data?: {}, title?: string): void; | ||
reload(): void; | ||
pathAndSearch(): string; | ||
goNoPopStateEvent(path: string, data?: any, title?: string): void; | ||
go(path: string, data?: any, title?: string): void; | ||
state(): any; | ||
} |
@@ -15,3 +15,3 @@ "use strict"; | ||
var SimFrontOption_1 = require("../option/SimFrontOption"); | ||
var LocationUtils_1 = require("../utils/window/LocationUtils"); | ||
var LocationUtils_1 = require("dom-render/utils/location/LocationUtils"); | ||
var Navigation = (function () { | ||
@@ -21,9 +21,22 @@ function Navigation(option) { | ||
} | ||
Object.defineProperty(Navigation.prototype, "url", { | ||
get: function () { | ||
var queryParams = this.queryParamsObject; | ||
var queryString = Object.entries(queryParams).map(function (_a) { | ||
var key = _a[0], value = _a[1]; | ||
return "".concat(key, "=").concat(value); | ||
}).join('&'); | ||
var path = this.path; | ||
return path + (queryString.length > 0 ? ('?' + queryString) : ''); | ||
}, | ||
enumerable: false, | ||
configurable: true | ||
}); | ||
Object.defineProperty(Navigation.prototype, "path", { | ||
get: function () { | ||
if (SimFrontOption_1.UrlType.path === this.option.urlType) { | ||
return LocationUtils_1.LocationUtils.path(); | ||
return LocationUtils_1.LocationUtils.path(this.option.window); | ||
} | ||
else if (SimFrontOption_1.UrlType.hash === this.option.urlType) { | ||
return LocationUtils_1.LocationUtils.hashPath(); | ||
return LocationUtils_1.LocationUtils.hashPath(this.option.window); | ||
} | ||
@@ -40,6 +53,6 @@ else { | ||
if (SimFrontOption_1.UrlType.path === this.option.urlType) { | ||
return LocationUtils_1.LocationUtils.pathQueryParams(); | ||
return LocationUtils_1.LocationUtils.pathQueryParams(this.option.window); | ||
} | ||
else if (SimFrontOption_1.UrlType.hash === this.option.urlType) { | ||
return LocationUtils_1.LocationUtils.hashQueryParams(); | ||
return LocationUtils_1.LocationUtils.hashQueryParams(this.option.window); | ||
} | ||
@@ -53,2 +66,17 @@ else { | ||
}); | ||
Object.defineProperty(Navigation.prototype, "queryParamsObject", { | ||
get: function () { | ||
if (SimFrontOption_1.UrlType.path === this.option.urlType) { | ||
return LocationUtils_1.LocationUtils.pathQueryParamsObject(this.option.window); | ||
} | ||
else if (SimFrontOption_1.UrlType.hash === this.option.urlType) { | ||
return LocationUtils_1.LocationUtils.hashQueryParamsObject(this.option.window); | ||
} | ||
else { | ||
return {}; | ||
} | ||
}, | ||
enumerable: false, | ||
configurable: true | ||
}); | ||
Object.defineProperty(Navigation.prototype, "pathInfo", { | ||
@@ -61,14 +89,28 @@ get: function () { | ||
}); | ||
Navigation.prototype.go = function (path, data, title) { | ||
Navigation.prototype.reload = function () { | ||
this.option.window.dispatchEvent(new Event('popstate')); | ||
}; | ||
Navigation.prototype.pathAndSearch = function () { | ||
return this.option.window.location.pathname + this.option.window.location.search; | ||
}; | ||
Navigation.prototype.goNoPopStateEvent = function (path, data, title) { | ||
if (data === void 0) { data = {}; } | ||
if (title === void 0) { title = ''; } | ||
if (SimFrontOption_1.UrlType.path === this.option.urlType) { | ||
history.pushState(data, title, path); | ||
this.option.window.history.pushState(data, title, path); | ||
} | ||
else if (SimFrontOption_1.UrlType.hash === this.option.urlType) { | ||
path = '#' + path.substring(1); | ||
history.pushState(data, title, path); | ||
this.option.window.history.pushState(data, title, path); | ||
} | ||
window.dispatchEvent(new Event('popstate')); | ||
}; | ||
Navigation.prototype.go = function (path, data, title) { | ||
if (data === void 0) { data = {}; } | ||
if (title === void 0) { title = ''; } | ||
this.goNoPopStateEvent(path, data, title); | ||
this.option.window.dispatchEvent(new Event('popstate')); | ||
}; | ||
Navigation.prototype.state = function () { | ||
return this.option.window.history.state; | ||
}; | ||
Navigation = __decorate([ | ||
@@ -75,0 +117,0 @@ (0, SimDecorator_1.Sim)(), |
@@ -0,0 +0,0 @@ import { ScriptRunnable } from '../script/ScriptRunnable'; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ export declare class View<T extends Element> { |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ import { View } from '../../service/view/View'; |
@@ -34,7 +34,7 @@ "use strict"; | ||
var _a; | ||
return (_a = this.e("#" + selector)) !== null && _a !== void 0 ? _a : undefined; | ||
return (_a = this.e("#".concat(selector))) !== null && _a !== void 0 ? _a : undefined; | ||
}; | ||
ViewService.prototype.eC = function (selector) { | ||
var _a; | ||
return (_a = this.e("." + selector)) !== null && _a !== void 0 ? _a : undefined; | ||
return (_a = this.e(".".concat(selector))) !== null && _a !== void 0 ? _a : undefined; | ||
}; | ||
@@ -41,0 +41,0 @@ ViewService = __decorate([ |
import { SimFrontOption } from './option/SimFrontOption'; | ||
import { ConstructorType } from 'simple-boot-core/types/Types'; | ||
import { SimAtomic } from 'simple-boot-core/simstance/SimAtomic'; | ||
import { SimpleApplication } from 'simple-boot-core/SimpleApplication'; | ||
@@ -10,2 +11,3 @@ import { Navigation } from './service/Navigation'; | ||
import { Config, TargetElement, TargetAttr } from 'dom-render/Config'; | ||
import { RouterModule } from 'simple-boot-core/route/RouterModule'; | ||
export declare class SimpleBootFront extends SimpleApplication { | ||
@@ -22,6 +24,11 @@ rootRouter: ConstructorType<any>; | ||
createDomRender<T extends object>(obj: T): T; | ||
run(): void; | ||
private initRun; | ||
goRouting(url: string): Promise<RouterModule<SimAtomic<Object>, any>>; | ||
runRouting(otherInstanceSim?: Map<ConstructorType<any>, any>, url?: string): Promise<RouterModule<SimAtomic<Object>, any>>; | ||
run(otherInstanceSim?: Map<ConstructorType<any>, any>, url?: string): SimpleBootFront; | ||
private afterSetting; | ||
initDomRenderScripts(): void; | ||
private initDomRenderTargetElements; | ||
getSimstanceManager(): SimstanceManager; | ||
go(url: string): void; | ||
} |
@@ -53,2 +53,11 @@ "use strict"; | ||
}; | ||
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { | ||
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { | ||
if (ar || !(i in from)) { | ||
if (!ar) ar = Array.prototype.slice.call(from, 0, i); | ||
ar[i] = from[i]; | ||
} | ||
} | ||
return to.concat(ar || Array.prototype.slice.call(from)); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -70,4 +79,5 @@ exports.SimpleBootFront = void 0; | ||
var ScriptUtils_1 = require("dom-render/utils/script/ScriptUtils"); | ||
var SimGlobal_1 = require("simple-boot-core/global/SimGlobal"); | ||
var RawSet_1 = require("dom-render/RawSet"); | ||
var Types_1 = require("dom-render/types/Types"); | ||
var InjectFrontSituationType_1 = require("./decorators/inject/InjectFrontSituationType"); | ||
var SimpleBootFront = (function (_super) { | ||
@@ -83,2 +93,3 @@ __extends(SimpleBootFront, _super); | ||
_this.domRenderConfig = { | ||
window: option.window, | ||
targetElements: _this.domRenderTargetElements, | ||
@@ -88,17 +99,42 @@ targetAttrs: _this.domRenderTargetAttrs, | ||
var _a, _b, _c; | ||
(_c = (_b = (_a = targetElement === null || targetElement === void 0 ? void 0 : targetElement.__render) === null || _a === void 0 ? void 0 : _a.component) === null || _b === void 0 ? void 0 : _b.onInit) === null || _c === void 0 ? void 0 : _c.call(_b); | ||
var target = (_a = targetElement === null || targetElement === void 0 ? void 0 : targetElement.__render) === null || _a === void 0 ? void 0 : _a.component; | ||
var targetKey = 'onInit'; | ||
var firstCheckMaker = [function (ownerObj, type, idx, saveInjectionConfig) { | ||
if (InjectFrontSituationType_1.InjectFrontSituationType.OPENER === (saveInjectionConfig === null || saveInjectionConfig === void 0 ? void 0 : saveInjectionConfig.config.situationType) && rawSet.point.thisVariableName) { | ||
return new Proxy(ScriptUtils_1.ScriptUtils.evalReturn(rawSet.point.thisVariableName, obj), new Types_1.DomRenderFinalProxy()); | ||
} | ||
}]; | ||
if (rawSet.point.thisVariableName) { | ||
(_b = target === null || target === void 0 ? void 0 : target.onInit) === null || _b === void 0 ? void 0 : _b.call.apply(_b, __spreadArray([target], _this.simstanceManager.getParameterSim({ target: target, targetKey: targetKey, firstCheckMaker: firstCheckMaker }), false)); | ||
} | ||
else { | ||
(_c = target === null || target === void 0 ? void 0 : target.onInit) === null || _c === void 0 ? void 0 : _c.call.apply(_c, __spreadArray([target], _this.simstanceManager.getParameterSim({ target: target, targetKey: targetKey, firstCheckMaker: firstCheckMaker }), false)); | ||
} | ||
}, | ||
onAttrInit: function (attrName, attrValue, obj) { | ||
onAttrInit: function (attrName, attrValue, obj, rawSet) { | ||
var _a, _b; | ||
if (attrName === 'component') { | ||
var bindObj = ScriptUtils_1.ScriptUtils.evalReturn(attrValue, obj); | ||
(_b = (_a = bindObj) === null || _a === void 0 ? void 0 : _a.onInit) === null || _b === void 0 ? void 0 : _b.call(_a); | ||
var target_1 = ScriptUtils_1.ScriptUtils.evalReturn(attrValue, obj); | ||
var targetKey = 'onInit'; | ||
var firstCheckMaker = [function (obj, type, idx, saveInjectionConfig) { | ||
var _a, _b; | ||
if (InjectFrontSituationType_1.InjectFrontSituationType.OPENER === (saveInjectionConfig === null || saveInjectionConfig === void 0 ? void 0 : saveInjectionConfig.config.situationType) && ((_a = target_1 === null || target_1 === void 0 ? void 0 : target_1.__domrender_component_new) === null || _a === void 0 ? void 0 : _a.creator)) { | ||
return (_b = target_1 === null || target_1 === void 0 ? void 0 : target_1.__domrender_component_new) === null || _b === void 0 ? void 0 : _b.creator; | ||
} | ||
}]; | ||
if (rawSet.point.thisVariableName) { | ||
(_a = target_1 === null || target_1 === void 0 ? void 0 : target_1.onInit) === null || _a === void 0 ? void 0 : _a.call.apply(_a, __spreadArray([target_1], _this.simstanceManager.getParameterSim({ target: target_1, targetKey: targetKey, firstCheckMaker: firstCheckMaker }), false)); | ||
} | ||
else { | ||
(_b = target_1 === null || target_1 === void 0 ? void 0 : target_1.onInit) === null || _b === void 0 ? void 0 : _b.call.apply(_b, __spreadArray([target_1], _this.simstanceManager.getParameterSim({ target: target_1, targetKey: targetKey, firstCheckMaker: firstCheckMaker }), false)); | ||
} | ||
} | ||
}, | ||
scripts: { 'application': _this }, | ||
scripts: { application: _this }, | ||
applyEvents: [{ | ||
attrName: 'router-link', callBack: function (elements, attrValue, obj) { | ||
attrName: 'router-link', | ||
callBack: function (elements, attrValue, obj) { | ||
elements.addEventListener('click', function (event) { | ||
var _a; | ||
(_a = (0, SimGlobal_1.SimGlobal)().application.simstanceManager.getOrNewSim(Navigation_1.Navigation)) === null || _a === void 0 ? void 0 : _a.go(attrValue); | ||
(_a = _this.getSimstanceManager().getOrNewSim(Navigation_1.Navigation)) === null || _a === void 0 ? void 0 : _a.go(attrValue); | ||
}); | ||
@@ -109,16 +145,17 @@ } | ||
}; | ||
window.__dirname = 'simple-boot-front__dirname'; | ||
_this.domRenderTargetAttrs.push({ | ||
name: 'component', callBack: function (element, attrValue, obj, rawSet) { | ||
var fag = _this.option.window.document.createDocumentFragment(); | ||
if (attrValue) { | ||
var targetObj = ScriptUtils_1.ScriptUtils.eval("return " + attrValue, obj); | ||
var n = element.cloneNode(true); | ||
var innerHTML = _this.getComponentInnerHtml(targetObj); | ||
n.innerHTML = innerHTML; | ||
fag.append(RawSet_1.RawSet.drThisCreate(n, attrValue, '', true, obj)); | ||
} | ||
return fag; | ||
_this.option.window.__dirname = 'simple-boot-front__dirname'; | ||
var targetAttribute = RawSet_1.RawSet.createComponentTargetAttribute('component', function (element, attrValue, obj, rawSet) { | ||
return ScriptUtils_1.ScriptUtils.eval("return ".concat(attrValue), obj); | ||
}, function (element, attrValue, obj, rawSet) { | ||
if (attrValue) { | ||
var targetObj = ScriptUtils_1.ScriptUtils.eval("return ".concat(attrValue), obj); | ||
var n = element.cloneNode(true); | ||
var innerHTML = _this.getComponentInnerHtml(targetObj); | ||
n.innerHTML = innerHTML; | ||
return RawSet_1.RawSet.drThisCreate(n, attrValue, '', true, obj, _this.option); | ||
} | ||
var fag = _this.option.window.document.createDocumentFragment(); | ||
return fag; | ||
}); | ||
_this.domRenderTargetAttrs.push(targetAttribute); | ||
option.proxy = { | ||
@@ -132,3 +169,3 @@ onProxy: function (it) { return _this.createDomRender(it); } | ||
var component = (0, Component_1.getComponent)(targetObj); | ||
var styles = ((_b = (_a = component === null || component === void 0 ? void 0 : component.styles) === null || _a === void 0 ? void 0 : _a.map(function (it) { return "<style>" + it + "</style>"; })) !== null && _b !== void 0 ? _b : []).join(' '); | ||
var styles = ((_b = (_a = component === null || component === void 0 ? void 0 : component.styles) === null || _a === void 0 ? void 0 : _a.map(function (it) { return "<style>".concat(it, "</style>"); })) !== null && _b !== void 0 ? _b : []).join(' '); | ||
var template = ((_c = component === null || component === void 0 ? void 0 : component.template) !== null && _c !== void 0 ? _c : ''); | ||
@@ -144,16 +181,15 @@ return styles + template; | ||
}; | ||
SimpleBootFront.prototype.run = function () { | ||
SimpleBootFront.prototype.initRun = function (otherInstanceSim) { | ||
var _this = this; | ||
var _a, _b, _c, _d, _e; | ||
_super.prototype.run.call(this); | ||
_super.prototype.run.call(this, otherInstanceSim); | ||
this.initDomRenderScripts(); | ||
this.initDomRenderTargetElements(); | ||
this.navigation = this.simstanceManager.getOrNewSim(Navigation_1.Navigation); | ||
var routerAtomic = new SimAtomic_1.SimAtomic(this.rootRouter); | ||
var routerAtomic = new SimAtomic_1.SimAtomic(this.rootRouter, this.getSimstanceManager()); | ||
var target = this.option.window.document.querySelector(this.option.selector); | ||
if (target && routerAtomic.value) { | ||
var component = routerAtomic.getConfig(Component_1.ComponentMetadataKey); | ||
var template = this.option.window.document.createElement('template'); | ||
var styles = ((_b = (_a = component === null || component === void 0 ? void 0 : component.styles) === null || _a === void 0 ? void 0 : _a.map(function (it) { return "<style>" + it + "</style>"; })) !== null && _b !== void 0 ? _b : []).join(' '); | ||
target.innerHTML = styles + " " + ((_c = component === null || component === void 0 ? void 0 : component.template) !== null && _c !== void 0 ? _c : ''); | ||
var styles = ((_b = (_a = component === null || component === void 0 ? void 0 : component.styles) === null || _a === void 0 ? void 0 : _a.map(function (it) { return "<style>".concat(it, "</style>"); })) !== null && _b !== void 0 ? _b : []).join(' '); | ||
target.innerHTML = "".concat(styles, " ").concat((_c = component === null || component === void 0 ? void 0 : component.template) !== null && _c !== void 0 ? _c : ''); | ||
var val = routerAtomic.value; | ||
@@ -170,11 +206,54 @@ var domRenderProxy = val._DomRender_proxy; | ||
var _a; | ||
var intent = new Intent_1.Intent((_a = _this.navigation.path) !== null && _a !== void 0 ? _a : ''); | ||
_this.routing(intent).then(function (it) { return __awaiter(_this, void 0, void 0, function () { | ||
return __generator(this, function (_a) { | ||
this.afterSetting(); | ||
return [2]; | ||
}); | ||
}); }); | ||
var intent = new Intent_1.Intent((_a = _this.navigation.url) !== null && _a !== void 0 ? _a : ''); | ||
_this.routing(intent).then(function (it) { | ||
_this.afterSetting(); | ||
}); | ||
}); | ||
}; | ||
SimpleBootFront.prototype.goRouting = function (url) { | ||
var _a; | ||
return __awaiter(this, void 0, void 0, function () { | ||
var intent, data; | ||
return __generator(this, function (_b) { | ||
switch (_b.label) { | ||
case 0: | ||
this.navigation.goNoPopStateEvent(url); | ||
intent = new Intent_1.Intent((_a = this.navigation.url) !== null && _a !== void 0 ? _a : ''); | ||
return [4, this.routing(intent)]; | ||
case 1: | ||
data = _b.sent(); | ||
this.afterSetting(); | ||
return [2, data]; | ||
} | ||
}); | ||
}); | ||
}; | ||
SimpleBootFront.prototype.runRouting = function (otherInstanceSim, url) { | ||
var _a; | ||
return __awaiter(this, void 0, void 0, function () { | ||
var intent, data; | ||
return __generator(this, function (_b) { | ||
switch (_b.label) { | ||
case 0: | ||
this.initRun(otherInstanceSim); | ||
if (url) { | ||
this.navigation.goNoPopStateEvent(url); | ||
} | ||
intent = new Intent_1.Intent((_a = this.navigation.url) !== null && _a !== void 0 ? _a : ''); | ||
return [4, this.routing(intent)]; | ||
case 1: | ||
data = _b.sent(); | ||
this.afterSetting(); | ||
return [2, data]; | ||
} | ||
}); | ||
}); | ||
}; | ||
SimpleBootFront.prototype.run = function (otherInstanceSim, url) { | ||
this.initRun(otherInstanceSim); | ||
if (url) { | ||
this.navigation.go(url); | ||
} | ||
this.option.window.dispatchEvent(new Event('popstate')); | ||
return this; | ||
}; | ||
@@ -219,3 +298,3 @@ SimpleBootFront.prototype.afterSetting = function () { | ||
} | ||
var obj = undefined; | ||
var obj; | ||
try { | ||
@@ -229,3 +308,5 @@ obj = simstanceManager.getOrNewSim(val); | ||
var scriptRunnable = obj; | ||
scriptRunnable.rawSets.set(render.rawset, this); | ||
if (render.rawset) { | ||
scriptRunnable.rawSets.set(render.rawset, this); | ||
} | ||
return scriptRunnable.run.apply(scriptRunnable, args); | ||
@@ -240,11 +321,18 @@ }; | ||
var component = (0, Component_1.getComponent)(val); | ||
var items = RawSet_1.RawSet.createComponentTargetElement(name, function (e, o, r) { | ||
var items = RawSet_1.RawSet.createComponentTargetElement(name, function (e, obj, r) { | ||
var newSim = _this.simstanceManager.newSim(val); | ||
return newSim; | ||
}, component === null || component === void 0 ? void 0 : component.template, component === null || component === void 0 ? void 0 : component.styles, _this.domRenderConfig.scripts); | ||
}, component === null || component === void 0 ? void 0 : component.template, component === null || component === void 0 ? void 0 : component.styles, _this.domRenderConfig.scripts, _this.domRenderConfig); | ||
_this.domRenderTargetElements.push(items); | ||
}); | ||
}; | ||
SimpleBootFront.prototype.getSimstanceManager = function () { | ||
return this.simstanceManager; | ||
}; | ||
SimpleBootFront.prototype.go = function (url) { | ||
var _a; | ||
(_a = this.getSimstanceManager().getOrNewSim(Navigation_1.Navigation)) === null || _a === void 0 ? void 0 : _a.go(url); | ||
}; | ||
return SimpleBootFront; | ||
}(SimpleApplication_1.SimpleApplication)); | ||
exports.SimpleBootFront = SimpleBootFront; |
@@ -0,0 +0,0 @@ import { SimError } from 'simple-boot-core/throwable/SimError'; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ import { RouterError } from './RouterError'; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ import { RouterError } from './RouterError'; |
@@ -0,0 +0,0 @@ "use strict"; |
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
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
67889
1179
Updateddom-render@^1.0.68
Updatedsimple-boot-core@^1.0.23