simple-boot-front
Advanced tools
Comparing version 1.0.50 to 1.0.51
@@ -5,2 +5,3 @@ import { FrontModuleOption } from './FrontModuleOption'; | ||
import { RootScope, TargetNode } from 'dom-render/RootScope'; | ||
import { Fetcher } from '../fetch/Fetcher'; | ||
export declare type RefModuleItem = { | ||
@@ -13,7 +14,8 @@ dest?: any; | ||
_inputOption: { | ||
template?: string | Promise<string | void>; | ||
styleImports?: (string | Promise<string | void>)[]; | ||
template?: string; | ||
styleImports?: (string)[]; | ||
modules?: { | ||
[name: string]: ConstructorType<FrontModule>; | ||
}; | ||
fetcher?: Fetcher; | ||
value?: any; | ||
@@ -31,11 +33,12 @@ name?: string; | ||
constructor(_inputOption?: { | ||
template?: string | Promise<string | void>; | ||
styleImports?: (string | Promise<string | void>)[]; | ||
template?: string; | ||
styleImports?: (string)[]; | ||
modules?: { | ||
[name: string]: ConstructorType<FrontModule>; | ||
}; | ||
fetcher?: Fetcher; | ||
value?: any; | ||
name?: string; | ||
}); | ||
init(): Promise<FrontModuleOption>; | ||
init(param?: any): Promise<FrontModuleOption>; | ||
getValue<T = any>(name: string, value?: any): T; | ||
@@ -42,0 +45,0 @@ setValue(name: string, value?: any): void; |
@@ -87,3 +87,3 @@ var __extends = (this && this.__extends) || (function () { | ||
} | ||
FrontModule.prototype.init = function () { | ||
FrontModule.prototype.init = function (param) { | ||
var _a, _b, _c; | ||
@@ -96,5 +96,5 @@ return __awaiter(this, void 0, void 0, function () { | ||
if (!this._inputOption.template) return [3, 4]; | ||
if (!(this._inputOption.template instanceof Promise)) return [3, 2]; | ||
if (!(this._inputOption.template.startsWith('fetch://') && this._inputOption.fetcher)) return [3, 2]; | ||
_d = this._option; | ||
return [4, this._inputOption.template]; | ||
return [4, this._inputOption.fetcher.text(this._inputOption.template.replace('fetch://', ''), param)]; | ||
case 1: | ||
@@ -120,6 +120,6 @@ _d.template = (_a = (_g.sent())) !== null && _a !== void 0 ? _a : ''; | ||
sp = this._inputOption.styleImports[i]; | ||
if (!(sp instanceof Promise)) return [3, 7]; | ||
if (!(sp.startsWith('fetch://') && this._inputOption.fetcher)) return [3, 7]; | ||
_e = this._option.styleImports; | ||
_f = i; | ||
return [4, sp]; | ||
return [4, this._inputOption.fetcher.text(sp.replace('fetch://', ''), param)]; | ||
case 6: | ||
@@ -126,0 +126,0 @@ _e[_f] = (_c = (_g.sent())) !== null && _c !== void 0 ? _c : ''; |
{ | ||
"name": "simple-boot-front", | ||
"version": "1.0.50", | ||
"version": "1.0.51", | ||
"main": "SimpleApplication.js", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
![Single Page Application Framworks](assets/banner.png) | ||
[![npm version](https://img.shields.io/badge/npm-v1.0.50-blue)](https://www.npmjs.com/package/simple-boot-front) [![license](https://img.shields.io/badge/license-MIT-green)](LICENSE.md) [![Chat](https://img.shields.io/badge/discord-20%20online-brightgreen?logo=discord)](https://discord.gg/PW56dpns) [![Github](https://img.shields.io/badge/-github-black?logo=github)](https://github.com/visualkhh/simple-boot-front) | ||
[![npm version](https://img.shields.io/badge/npm-v1.0.51-blue)](https://www.npmjs.com/package/simple-boot-front) [![license](https://img.shields.io/badge/license-MIT-green)](LICENSE.md) [![Chat](https://img.shields.io/badge/discord-20%20online-brightgreen?logo=discord)](https://discord.gg/PW56dpns) [![Github](https://img.shields.io/badge/-github-black?logo=github)](https://github.com/visualkhh/simple-boot-front) | ||
@@ -4,0 +4,0 @@ Single Page Application Framworks for Web |
@@ -16,2 +16,38 @@ var __extends = (this && this.__extends) || (function () { | ||
})(); | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
}; | ||
var __generator = (this && this.__generator) || function (thisArg, body) { | ||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; | ||
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; | ||
function verb(n) { return function (v) { return step([n, v]); }; } | ||
function step(op) { | ||
if (f) throw new TypeError("Generator is already executing."); | ||
while (_) try { | ||
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; | ||
if (y = 0, t) op = [op[0] & 2, t.value]; | ||
switch (op[0]) { | ||
case 0: case 1: t = op; break; | ||
case 4: _.label++; return { value: op[1], done: false }; | ||
case 5: _.label++; y = op[1]; op = [0]; continue; | ||
case 7: op = _.ops.pop(); _.trys.pop(); continue; | ||
default: | ||
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } | ||
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } | ||
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } | ||
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } | ||
if (t[2]) _.ops.pop(); | ||
_.trys.pop(); continue; | ||
} | ||
op = body.call(thisArg, _); | ||
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } | ||
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; | ||
} | ||
}; | ||
import { SimpleApplication } from 'simple-boot-core/SimpleApplication'; | ||
@@ -42,12 +78,22 @@ import { SimFrontProxyHandler } from './proxy/SimFrontProxyHandler'; | ||
var intent = new Intent((_a = navigation.path) !== null && _a !== void 0 ? _a : ''); | ||
_this.routing(intent).then(function (it) { | ||
var _a; | ||
var lastRouterSelector = (_a = _this.option) === null || _a === void 0 ? void 0 : _a.selector; | ||
it.routerChains.forEach(function (it) { | ||
var _a; | ||
var moduleObj = (_a = _this.simstanceManager) === null || _a === void 0 ? void 0 : _a.getOrNewSim(it.module); | ||
if (moduleObj instanceof FrontModule) { | ||
moduleObj.init().then(function (_) { | ||
_this.routing(intent).then(function (it) { return __awaiter(_this, void 0, void 0, function () { | ||
var lastRouterSelector, _i, _a, routerChain, moduleObj, option_1, module, option; | ||
var _this = this; | ||
var _b, _c; | ||
return __generator(this, function (_d) { | ||
switch (_d.label) { | ||
case 0: | ||
lastRouterSelector = (_b = this.option) === null || _b === void 0 ? void 0 : _b.selector; | ||
_i = 0, _a = it.routerChains; | ||
_d.label = 1; | ||
case 1: | ||
if (!(_i < _a.length)) return [3, 4]; | ||
routerChain = _a[_i]; | ||
moduleObj = (_c = this.simstanceManager) === null || _c === void 0 ? void 0 : _c.getOrNewSim(routerChain.module); | ||
if (!(moduleObj instanceof FrontModule)) return [3, 3]; | ||
return [4, moduleObj.init({ router: 'true' })]; | ||
case 2: | ||
option_1 = _d.sent(); | ||
if (!document.querySelector("[module-id='" + (moduleObj === null || moduleObj === void 0 ? void 0 : moduleObj.id) + "']")) { | ||
_this.render(moduleObj, document.querySelector(lastRouterSelector)); | ||
this.render(moduleObj, document.querySelector(lastRouterSelector)); | ||
} | ||
@@ -60,13 +106,19 @@ if (moduleObj === null || moduleObj === void 0 ? void 0 : moduleObj._router_outlet_id) { | ||
} | ||
}); | ||
_d.label = 3; | ||
case 3: | ||
_i++; | ||
return [3, 1]; | ||
case 4: | ||
module = it.getModuleInstance(); | ||
return [4, module.init()]; | ||
case 5: | ||
option = _d.sent(); | ||
this.render(module, document.querySelector(lastRouterSelector)); | ||
this.renderd(); | ||
module._onInitedChild(); | ||
it.routerChains.reverse().forEach(function (it) { var _a, _b; return (_b = (_a = _this.simstanceManager) === null || _a === void 0 ? void 0 : _a.getOrNewSim(it.module)) === null || _b === void 0 ? void 0 : _b._onInitedChild(); }); | ||
return [2]; | ||
} | ||
}); | ||
var module = it.getModuleInstance(); | ||
module.init().then(function (_) { | ||
_this.render(module, document.querySelector(lastRouterSelector)); | ||
_this.renderd(); | ||
module._onInitedChild(); | ||
it.routerChains.reverse().forEach(function (it) { var _a, _b; return (_b = (_a = _this.simstanceManager) === null || _a === void 0 ? void 0 : _a.getOrNewSim(it.module)) === null || _b === void 0 ? void 0 : _b._onInitedChild(); }); | ||
}); | ||
}); | ||
}); }); | ||
}); | ||
@@ -73,0 +125,0 @@ window.dispatchEvent(new Event('popstate')); |
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
80616
40
1475