simple-boot-front 1.0.74 → 1.0.75

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,229 +1,229 @@
1
- "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
5
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
- return extendStatics(d, b);
8
- };
9
- return function (d, b) {
10
- if (typeof b !== "function" && b !== null)
11
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
- extendStatics(d, b);
13
- function __() { this.constructor = d; }
14
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
- };
16
- })();
17
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
18
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
19
- return new (P || (P = Promise))(function (resolve, reject) {
20
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
21
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
22
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
23
- step((generator = generator.apply(thisArg, _arguments || [])).next());
24
- });
25
- };
26
- var __generator = (this && this.__generator) || function (thisArg, body) {
27
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
28
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
29
- function verb(n) { return function (v) { return step([n, v]); }; }
30
- function step(op) {
31
- if (f) throw new TypeError("Generator is already executing.");
32
- while (_) try {
33
- 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;
34
- if (y = 0, t) op = [op[0] & 2, t.value];
35
- switch (op[0]) {
36
- case 0: case 1: t = op; break;
37
- case 4: _.label++; return { value: op[1], done: false };
38
- case 5: _.label++; y = op[1]; op = [0]; continue;
39
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
40
- default:
41
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
42
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
43
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
44
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
45
- if (t[2]) _.ops.pop();
46
- _.trys.pop(); continue;
47
- }
48
- op = body.call(thisArg, _);
49
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
50
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
51
- }
52
- };
53
- Object.defineProperty(exports, "__esModule", { value: true });
54
- exports.SimpleBootFront = void 0;
55
- var SimFrontOption_1 = require("./option/SimFrontOption");
56
- var Component_1 = require("./decorators/Component");
57
- var DomRender_1 = require("dom-render/DomRender");
58
- var SimAtomic_1 = require("simple-boot-core/simstance/SimAtomic");
59
- var SimpleApplication_1 = require("simple-boot-core/SimpleApplication");
60
- var Intent_1 = require("simple-boot-core/intent/Intent");
61
- var Navigation_1 = require("./service/Navigation");
62
- var ViewService_1 = require("./service/view/ViewService");
63
- var HttpService_1 = require("./service/HttpService");
64
- var SimstanceManager_1 = require("simple-boot-core/simstance/SimstanceManager");
65
- var IntentManager_1 = require("simple-boot-core/intent/IntentManager");
66
- var RouterManager_1 = require("simple-boot-core/route/RouterManager");
67
- var ScriptUtils_1 = require("dom-render/utils/script/ScriptUtils");
68
- var SimGlobal_1 = require("simple-boot-core/global/SimGlobal");
69
- var RawSet_1 = require("dom-render/RawSet");
70
- var SimpleBootFront = (function (_super) {
71
- __extends(SimpleBootFront, _super);
72
- function SimpleBootFront(rootRouter, option) {
73
- var _this = _super.call(this, rootRouter, option) || this;
74
- _this.rootRouter = rootRouter;
75
- _this.option = option;
76
- _this.domRendoerExcludeProxy = [SimpleApplication_1.SimpleApplication, IntentManager_1.IntentManager, RouterManager_1.RouterManager, SimstanceManager_1.SimstanceManager, SimFrontOption_1.SimFrontOption, Navigation_1.Navigation, ViewService_1.ViewService, HttpService_1.HttpService];
77
- window.__dirname = 'simple-boot-front__dirname';
78
- _this.targetElements = [];
79
- var selectors = Component_1.componentSelectors;
80
- selectors.forEach(function (val, name) {
81
- _this.targetElements.push({
82
- name: name,
83
- callBack: function (element, obj, rawSet) {
84
- var componentObj = _this.simstanceManager.newSim(val);
85
- var set = element.getAttribute('dr-set');
86
- var any;
87
- if (set) {
88
- var comEvalTargetObj_1 = { '$attribute': any = {} };
89
- element.getAttributeNames().forEach(function (it) {
90
- comEvalTargetObj_1['$attribute'][it] = element.getAttribute(it);
91
- });
92
- comEvalTargetObj_1['$innerHTML'] = element.innerHTML;
93
- comEvalTargetObj_1['$element'] = element;
94
- comEvalTargetObj_1[name] = componentObj;
95
- var script = "var " + name + " = this['" + name + "']; var $element = this['$element']; var $innerHTML = this['$innerHTML']; var $attribute = this['$attribute']; " + set + " ";
96
- ScriptUtils_1.ScriptUtils.eval(script, Object.assign(comEvalTargetObj_1, obj));
97
- }
98
- var componentOption = Component_1.getComponent(componentObj);
99
- var fag = _this.option.window.document.createDocumentFragment();
100
- if (componentOption) {
101
- obj.__componentInstances[rawSet.uuid] = componentObj;
102
- var template = _this.option.window.document.createElement('div');
103
- template.innerHTML = _this.getComponentInnerHtml(componentObj);
104
- fag.append(RawSet_1.RawSet.drThisCreate(template, "this.__componentInstances['" + rawSet.uuid + "']", '', true, obj));
105
- }
106
- return fag;
107
- }
108
- });
109
- });
110
- _this.targetAttrs = [{
111
- name: 'component', callBack: function (element, attrValue, obj, rawSet) {
112
- var fag = _this.option.window.document.createDocumentFragment();
113
- if (attrValue) {
114
- var targetObj = ScriptUtils_1.ScriptUtils.eval("return " + attrValue, obj);
115
- var n = element.cloneNode(true);
116
- var innerHTML = _this.getComponentInnerHtml(targetObj);
117
- n.innerHTML = innerHTML;
118
- fag.append(RawSet_1.RawSet.drThisCreate(n, attrValue, '', true, obj));
119
- }
120
- return fag;
121
- }
122
- }];
123
- option.proxy = {
124
- onProxy: function (it) { return _this.createDomRender(it); }
125
- };
126
- return _this;
127
- }
128
- SimpleBootFront.prototype.getComponentInnerHtml = function (targetObj) {
129
- var _a, _b, _c;
130
- var component = Component_1.getComponent(targetObj);
131
- 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(' ');
132
- var template = ((_c = component === null || component === void 0 ? void 0 : component.template) !== null && _c !== void 0 ? _c : '');
133
- return styles + template;
134
- };
135
- SimpleBootFront.prototype.createDomRender = function (obj) {
136
- var component = Component_1.getComponent(obj);
137
- if (component && typeof obj === 'object') {
138
- return DomRender_1.DomRender.run(obj, undefined, {
139
- targetElements: this.targetElements,
140
- targetAttrs: this.targetAttrs,
141
- onAttrInit: function (attrName, attrValue, obj) {
142
- var _a, _b;
143
- if (attrName === 'component') {
144
- var bindObj = ScriptUtils_1.ScriptUtils.evalReturn(attrValue, obj);
145
- (_b = (_a = bindObj) === null || _a === void 0 ? void 0 : _a.onInit) === null || _b === void 0 ? void 0 : _b.call(_a);
146
- }
147
- },
148
- applyEvents: [{
149
- attrName: 'router-link', callBack: function (elements, attrValue, obj) {
150
- elements.addEventListener('click', function (event) {
151
- var _a;
152
- (_a = SimGlobal_1.SimGlobal().application.simstanceManager.getOrNewSim(Navigation_1.Navigation)) === null || _a === void 0 ? void 0 : _a.go(attrValue);
153
- });
154
- }
155
- }],
156
- proxyExcludeTyps: this.domRendoerExcludeProxy
157
- });
158
- }
159
- return obj;
160
- };
161
- SimpleBootFront.prototype.run = function () {
162
- var _this = this;
163
- var _a, _b, _c, _d, _e;
164
- _super.prototype.run.call(this);
165
- this.navigation = this.simstanceManager.getOrNewSim(Navigation_1.Navigation);
166
- var routerAtomic = new SimAtomic_1.SimAtomic(this.rootRouter);
167
- var target = this.option.window.document.querySelector(this.option.selector);
168
- if (target && routerAtomic.value) {
169
- var component = routerAtomic.getConfig(Component_1.ComponentMetadataKey);
170
- var template = this.option.window.document.createElement('template');
171
- 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(' ');
172
- target.innerHTML = styles + " " + ((_c = component === null || component === void 0 ? void 0 : component.template) !== null && _c !== void 0 ? _c : '');
173
- var val = routerAtomic.value;
174
- var domRenderProxy = val._DomRender_proxy;
175
- domRenderProxy.initRender(target);
176
- (_e = (_d = val) === null || _d === void 0 ? void 0 : _d.onInit) === null || _e === void 0 ? void 0 : _e.call(_d);
177
- }
178
- this.option.window.addEventListener('intent', function (event) {
179
- var cevent = event;
180
- _this.publishIntent(new Intent_1.Intent(cevent.detail.uri, cevent.detail.data, event));
181
- });
182
- this.option.window.addEventListener('popstate', function (event) {
183
- var _a;
184
- var intent = new Intent_1.Intent((_a = _this.navigation.path) !== null && _a !== void 0 ? _a : '');
185
- _this.routing(intent).then(function (it) { return __awaiter(_this, void 0, void 0, function () {
186
- var routerChain;
187
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
188
- return __generator(this, function (_k) {
189
- if (((_a = it === null || it === void 0 ? void 0 : it.routerChains) === null || _a === void 0 ? void 0 : _a.length) && ((_b = it === null || it === void 0 ? void 0 : it.routerChains) === null || _b === void 0 ? void 0 : _b.length) > 0) {
190
- (_d = (_c = it === null || it === void 0 ? void 0 : it.routerChains) === null || _c === void 0 ? void 0 : _c.reduce) === null || _d === void 0 ? void 0 : _d.call(_c, function (a, b) {
191
- var _a;
192
- var value = a.value;
193
- (_a = value === null || value === void 0 ? void 0 : value.canActivate) === null || _a === void 0 ? void 0 : _a.call(value, intent, b.value);
194
- return b;
195
- });
196
- }
197
- if (!(it === null || it === void 0 ? void 0 : it.module)) {
198
- routerChain = it === null || it === void 0 ? void 0 : it.routerChains[it.routerChains.length - 1];
199
- (_f = (_e = routerChain === null || routerChain === void 0 ? void 0 : routerChain.value) === null || _e === void 0 ? void 0 : _e.canActivate) === null || _f === void 0 ? void 0 : _f.call(_e, intent, it === null || it === void 0 ? void 0 : it.getModuleInstance());
200
- }
201
- else {
202
- (_j = (_h = (_g = it.router) === null || _g === void 0 ? void 0 : _g.value) === null || _h === void 0 ? void 0 : _h.canActivate) === null || _j === void 0 ? void 0 : _j.call(_h, intent, it.getModuleInstance());
203
- }
204
- this.afterSetting();
205
- return [2];
206
- });
207
- }); });
208
- });
209
- this.option.window.dispatchEvent(new Event('popstate'));
210
- };
211
- SimpleBootFront.prototype.afterSetting = function () {
212
- var _this = this;
213
- this.option.window.document.querySelectorAll('[router-active-class]').forEach(function (it) {
214
- var _a, _b;
215
- var _c, _d;
216
- var link = (_c = it.getAttribute('router-link')) !== null && _c !== void 0 ? _c : '';
217
- var activeClasss = (_d = it.getAttribute('router-active-class')) !== null && _d !== void 0 ? _d : '';
218
- var classs = activeClasss.split(',');
219
- if (_this.navigation.path === link) {
220
- (_a = it.classList).add.apply(_a, classs);
221
- }
222
- else {
223
- (_b = it.classList).remove.apply(_b, classs);
224
- }
225
- });
226
- };
227
- return SimpleBootFront;
228
- }(SimpleApplication_1.SimpleApplication));
229
- exports.SimpleBootFront = SimpleBootFront;
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
17
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
18
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
19
+ return new (P || (P = Promise))(function (resolve, reject) {
20
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
21
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
22
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
23
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
24
+ });
25
+ };
26
+ var __generator = (this && this.__generator) || function (thisArg, body) {
27
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
28
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
29
+ function verb(n) { return function (v) { return step([n, v]); }; }
30
+ function step(op) {
31
+ if (f) throw new TypeError("Generator is already executing.");
32
+ while (_) try {
33
+ 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;
34
+ if (y = 0, t) op = [op[0] & 2, t.value];
35
+ switch (op[0]) {
36
+ case 0: case 1: t = op; break;
37
+ case 4: _.label++; return { value: op[1], done: false };
38
+ case 5: _.label++; y = op[1]; op = [0]; continue;
39
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
40
+ default:
41
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
42
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
43
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
44
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
45
+ if (t[2]) _.ops.pop();
46
+ _.trys.pop(); continue;
47
+ }
48
+ op = body.call(thisArg, _);
49
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
50
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
51
+ }
52
+ };
53
+ Object.defineProperty(exports, "__esModule", { value: true });
54
+ exports.SimpleBootFront = void 0;
55
+ var SimFrontOption_1 = require("./option/SimFrontOption");
56
+ var Component_1 = require("./decorators/Component");
57
+ var DomRender_1 = require("dom-render/DomRender");
58
+ var SimAtomic_1 = require("simple-boot-core/simstance/SimAtomic");
59
+ var SimpleApplication_1 = require("simple-boot-core/SimpleApplication");
60
+ var Intent_1 = require("simple-boot-core/intent/Intent");
61
+ var Navigation_1 = require("./service/Navigation");
62
+ var ViewService_1 = require("./service/view/ViewService");
63
+ var HttpService_1 = require("./service/HttpService");
64
+ var SimstanceManager_1 = require("simple-boot-core/simstance/SimstanceManager");
65
+ var IntentManager_1 = require("simple-boot-core/intent/IntentManager");
66
+ var RouterManager_1 = require("simple-boot-core/route/RouterManager");
67
+ var ScriptUtils_1 = require("dom-render/utils/script/ScriptUtils");
68
+ var SimGlobal_1 = require("simple-boot-core/global/SimGlobal");
69
+ var RawSet_1 = require("dom-render/RawSet");
70
+ var SimpleBootFront = (function (_super) {
71
+ __extends(SimpleBootFront, _super);
72
+ function SimpleBootFront(rootRouter, option) {
73
+ var _this = _super.call(this, rootRouter, option) || this;
74
+ _this.rootRouter = rootRouter;
75
+ _this.option = option;
76
+ _this.domRendoerExcludeProxy = [SimpleApplication_1.SimpleApplication, IntentManager_1.IntentManager, RouterManager_1.RouterManager, SimstanceManager_1.SimstanceManager, SimFrontOption_1.SimFrontOption, Navigation_1.Navigation, ViewService_1.ViewService, HttpService_1.HttpService];
77
+ window.__dirname = 'simple-boot-front__dirname';
78
+ _this.targetElements = [];
79
+ var selectors = Component_1.componentSelectors;
80
+ selectors.forEach(function (val, name) {
81
+ _this.targetElements.push({
82
+ name: name,
83
+ callBack: function (element, obj, rawSet) {
84
+ var componentObj = _this.simstanceManager.newSim(val);
85
+ var set = element.getAttribute('dr-set');
86
+ var any;
87
+ if (set) {
88
+ var comEvalTargetObj_1 = { '$attribute': any = {} };
89
+ element.getAttributeNames().forEach(function (it) {
90
+ comEvalTargetObj_1['$attribute'][it] = element.getAttribute(it);
91
+ });
92
+ comEvalTargetObj_1['$innerHTML'] = element.innerHTML;
93
+ comEvalTargetObj_1['$element'] = element;
94
+ comEvalTargetObj_1[name] = componentObj;
95
+ var script = "var " + name + " = this['" + name + "']; var $element = this['$element']; var $innerHTML = this['$innerHTML']; var $attribute = this['$attribute']; " + set + " ";
96
+ ScriptUtils_1.ScriptUtils.eval(script, Object.assign(comEvalTargetObj_1, obj));
97
+ }
98
+ var componentOption = (0, Component_1.getComponent)(componentObj);
99
+ var fag = _this.option.window.document.createDocumentFragment();
100
+ if (componentOption) {
101
+ obj.__componentInstances[rawSet.uuid] = componentObj;
102
+ var template = _this.option.window.document.createElement('div');
103
+ template.innerHTML = _this.getComponentInnerHtml(componentObj);
104
+ fag.append(RawSet_1.RawSet.drThisCreate(template, "this.__componentInstances['" + rawSet.uuid + "']", '', true, obj));
105
+ }
106
+ return fag;
107
+ }
108
+ });
109
+ });
110
+ _this.targetAttrs = [{
111
+ name: 'component', callBack: function (element, attrValue, obj, rawSet) {
112
+ var fag = _this.option.window.document.createDocumentFragment();
113
+ if (attrValue) {
114
+ var targetObj = ScriptUtils_1.ScriptUtils.eval("return " + attrValue, obj);
115
+ var n = element.cloneNode(true);
116
+ var innerHTML = _this.getComponentInnerHtml(targetObj);
117
+ n.innerHTML = innerHTML;
118
+ fag.append(RawSet_1.RawSet.drThisCreate(n, attrValue, '', true, obj));
119
+ }
120
+ return fag;
121
+ }
122
+ }];
123
+ option.proxy = {
124
+ onProxy: function (it) { return _this.createDomRender(it); }
125
+ };
126
+ return _this;
127
+ }
128
+ SimpleBootFront.prototype.getComponentInnerHtml = function (targetObj) {
129
+ var _a, _b, _c;
130
+ var component = (0, Component_1.getComponent)(targetObj);
131
+ 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(' ');
132
+ var template = ((_c = component === null || component === void 0 ? void 0 : component.template) !== null && _c !== void 0 ? _c : '');
133
+ return styles + template;
134
+ };
135
+ SimpleBootFront.prototype.createDomRender = function (obj) {
136
+ var component = (0, Component_1.getComponent)(obj);
137
+ if (component && typeof obj === 'object') {
138
+ return DomRender_1.DomRender.run(obj, undefined, {
139
+ targetElements: this.targetElements,
140
+ targetAttrs: this.targetAttrs,
141
+ onAttrInit: function (attrName, attrValue, obj) {
142
+ var _a, _b;
143
+ if (attrName === 'component') {
144
+ var bindObj = ScriptUtils_1.ScriptUtils.evalReturn(attrValue, obj);
145
+ (_b = (_a = bindObj) === null || _a === void 0 ? void 0 : _a.onInit) === null || _b === void 0 ? void 0 : _b.call(_a);
146
+ }
147
+ },
148
+ applyEvents: [{
149
+ attrName: 'router-link', callBack: function (elements, attrValue, obj) {
150
+ elements.addEventListener('click', function (event) {
151
+ var _a;
152
+ (_a = (0, SimGlobal_1.SimGlobal)().application.simstanceManager.getOrNewSim(Navigation_1.Navigation)) === null || _a === void 0 ? void 0 : _a.go(attrValue);
153
+ });
154
+ }
155
+ }],
156
+ proxyExcludeTyps: this.domRendoerExcludeProxy
157
+ });
158
+ }
159
+ return obj;
160
+ };
161
+ SimpleBootFront.prototype.run = function () {
162
+ var _this = this;
163
+ var _a, _b, _c, _d, _e;
164
+ _super.prototype.run.call(this);
165
+ this.navigation = this.simstanceManager.getOrNewSim(Navigation_1.Navigation);
166
+ var routerAtomic = new SimAtomic_1.SimAtomic(this.rootRouter);
167
+ var target = this.option.window.document.querySelector(this.option.selector);
168
+ if (target && routerAtomic.value) {
169
+ var component = routerAtomic.getConfig(Component_1.ComponentMetadataKey);
170
+ var template = this.option.window.document.createElement('template');
171
+ 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(' ');
172
+ target.innerHTML = styles + " " + ((_c = component === null || component === void 0 ? void 0 : component.template) !== null && _c !== void 0 ? _c : '');
173
+ var val = routerAtomic.value;
174
+ var domRenderProxy = val._DomRender_proxy;
175
+ domRenderProxy.initRender(target);
176
+ (_e = (_d = val) === null || _d === void 0 ? void 0 : _d.onInit) === null || _e === void 0 ? void 0 : _e.call(_d);
177
+ }
178
+ this.option.window.addEventListener('intent', function (event) {
179
+ var cevent = event;
180
+ _this.publishIntent(new Intent_1.Intent(cevent.detail.uri, cevent.detail.data, event));
181
+ });
182
+ this.option.window.addEventListener('popstate', function (event) {
183
+ var _a;
184
+ var intent = new Intent_1.Intent((_a = _this.navigation.path) !== null && _a !== void 0 ? _a : '');
185
+ _this.routing(intent).then(function (it) { return __awaiter(_this, void 0, void 0, function () {
186
+ var routerChain;
187
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
188
+ return __generator(this, function (_k) {
189
+ if (((_a = it === null || it === void 0 ? void 0 : it.routerChains) === null || _a === void 0 ? void 0 : _a.length) && ((_b = it === null || it === void 0 ? void 0 : it.routerChains) === null || _b === void 0 ? void 0 : _b.length) > 0) {
190
+ (_d = (_c = it === null || it === void 0 ? void 0 : it.routerChains) === null || _c === void 0 ? void 0 : _c.reduce) === null || _d === void 0 ? void 0 : _d.call(_c, function (a, b) {
191
+ var _a;
192
+ var value = a.value;
193
+ (_a = value === null || value === void 0 ? void 0 : value.canActivate) === null || _a === void 0 ? void 0 : _a.call(value, intent, b.value);
194
+ return b;
195
+ });
196
+ }
197
+ if (!(it === null || it === void 0 ? void 0 : it.module)) {
198
+ routerChain = it === null || it === void 0 ? void 0 : it.routerChains[it.routerChains.length - 1];
199
+ (_f = (_e = routerChain === null || routerChain === void 0 ? void 0 : routerChain.value) === null || _e === void 0 ? void 0 : _e.canActivate) === null || _f === void 0 ? void 0 : _f.call(_e, intent, it === null || it === void 0 ? void 0 : it.getModuleInstance());
200
+ }
201
+ else {
202
+ (_j = (_h = (_g = it.router) === null || _g === void 0 ? void 0 : _g.value) === null || _h === void 0 ? void 0 : _h.canActivate) === null || _j === void 0 ? void 0 : _j.call(_h, intent, it.getModuleInstance());
203
+ }
204
+ this.afterSetting();
205
+ return [2];
206
+ });
207
+ }); });
208
+ });
209
+ this.option.window.dispatchEvent(new Event('popstate'));
210
+ };
211
+ SimpleBootFront.prototype.afterSetting = function () {
212
+ var _this = this;
213
+ this.option.window.document.querySelectorAll('[router-active-class]').forEach(function (it) {
214
+ var _a, _b;
215
+ var _c, _d;
216
+ var link = (_c = it.getAttribute('router-link')) !== null && _c !== void 0 ? _c : '';
217
+ var activeClasss = (_d = it.getAttribute('router-active-class')) !== null && _d !== void 0 ? _d : '';
218
+ var classs = activeClasss.split(',');
219
+ if (_this.navigation.path === link) {
220
+ (_a = it.classList).add.apply(_a, classs);
221
+ }
222
+ else {
223
+ (_b = it.classList).remove.apply(_b, classs);
224
+ }
225
+ });
226
+ };
227
+ return SimpleBootFront;
228
+ }(SimpleApplication_1.SimpleApplication));
229
+ exports.SimpleBootFront = SimpleBootFront;
@@ -1,11 +1,11 @@
1
- import { ConstructorType, GenericClassDecorator } from 'simple-boot-core/types/Types';
2
- export declare const componentSelectors: Map<string, ConstructorType<any>>;
3
- export interface ComponentConfig {
4
- selector?: string;
5
- template?: string;
6
- styles?: (string)[];
7
- using?: (ConstructorType<any>)[];
8
- }
9
- export declare const ComponentMetadataKey: unique symbol;
10
- export declare const Component: (config?: ComponentConfig | undefined) => GenericClassDecorator<ConstructorType<any>>;
11
- export declare const getComponent: (target: ConstructorType<any> | Function | any) => ComponentConfig | undefined;
1
+ import { ConstructorType, GenericClassDecorator } from 'simple-boot-core/types/Types';
2
+ export declare const componentSelectors: Map<string, ConstructorType<any>>;
3
+ export interface ComponentConfig {
4
+ selector?: string;
5
+ template?: string;
6
+ styles?: (string)[];
7
+ using?: (ConstructorType<any>)[];
8
+ }
9
+ export declare const ComponentMetadataKey: unique symbol;
10
+ export declare const Component: (config?: ComponentConfig | undefined) => GenericClassDecorator<ConstructorType<any>>;
11
+ export declare const getComponent: (target: ConstructorType<any> | Function | any) => ComponentConfig | undefined;
@@ -1,50 +1,50 @@
1
- "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
5
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
- return extendStatics(d, b);
8
- };
9
- return function (d, b) {
10
- if (typeof b !== "function" && b !== null)
11
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
- extendStatics(d, b);
13
- function __() { this.constructor = d; }
14
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
- };
16
- })();
17
- Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.getComponent = exports.Component = exports.ComponentMetadataKey = exports.componentSelectors = void 0;
19
- var ReflectUtils_1 = require("simple-boot-core/utils/reflect/ReflectUtils");
20
- exports.componentSelectors = new Map();
21
- exports.ComponentMetadataKey = Symbol('Component');
22
- var Component = function (config) {
23
- return function (target) {
24
- if (config === null || config === void 0 ? void 0 : config.selector) {
25
- exports.componentSelectors.set(config === null || config === void 0 ? void 0 : config.selector, target);
26
- }
27
- ReflectUtils_1.ReflectUtils.defineMetadata(exports.ComponentMetadataKey, config, target);
28
- return (function (_super) {
29
- __extends(class_1, _super);
30
- function class_1() {
31
- var _this = _super !== null && _super.apply(this, arguments) || this;
32
- _this.__componentInstances = {};
33
- return _this;
34
- }
35
- return class_1;
36
- }(target));
37
- };
38
- };
39
- exports.Component = Component;
40
- var getComponent = function (target) {
41
- if (target && typeof target === 'object') {
42
- target = target.constructor;
43
- }
44
- try {
45
- return ReflectUtils_1.ReflectUtils.getMetadata(exports.ComponentMetadataKey, target);
46
- }
47
- catch (e) {
48
- }
49
- };
50
- exports.getComponent = getComponent;
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.getComponent = exports.Component = exports.ComponentMetadataKey = exports.componentSelectors = void 0;
19
+ var ReflectUtils_1 = require("simple-boot-core/utils/reflect/ReflectUtils");
20
+ exports.componentSelectors = new Map();
21
+ exports.ComponentMetadataKey = Symbol('Component');
22
+ var Component = function (config) {
23
+ return function (target) {
24
+ if (config === null || config === void 0 ? void 0 : config.selector) {
25
+ exports.componentSelectors.set(config === null || config === void 0 ? void 0 : config.selector, target);
26
+ }
27
+ ReflectUtils_1.ReflectUtils.defineMetadata(exports.ComponentMetadataKey, config, target);
28
+ return (function (_super) {
29
+ __extends(class_1, _super);
30
+ function class_1() {
31
+ var _this = _super !== null && _super.apply(this, arguments) || this;
32
+ _this.__componentInstances = {};
33
+ return _this;
34
+ }
35
+ return class_1;
36
+ }(target));
37
+ };
38
+ };
39
+ exports.Component = Component;
40
+ var getComponent = function (target) {
41
+ if (target && typeof target === 'object') {
42
+ target = target.constructor;
43
+ }
44
+ try {
45
+ return ReflectUtils_1.ReflectUtils.getMetadata(exports.ComponentMetadataKey, target);
46
+ }
47
+ catch (e) {
48
+ }
49
+ };
50
+ exports.getComponent = getComponent;
@@ -1,4 +1,4 @@
1
- export declare abstract class Fetcher {
2
- abstract text(path: string, param?: any, dname?: string): Promise<string | void>;
3
- abstract json<T = any>(url: string, param?: any): Promise<T | void>;
4
- }
1
+ export declare abstract class Fetcher {
2
+ abstract text(path: string, param?: any, dname?: string): Promise<string | void>;
3
+ abstract json<T = any>(url: string, param?: any): Promise<T | void>;
4
+ }
package/fetch/Fetcher.js CHANGED
@@ -1,9 +1,9 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Fetcher = void 0;
4
- var Fetcher = (function () {
5
- function Fetcher() {
6
- }
7
- return Fetcher;
8
- }());
9
- exports.Fetcher = Fetcher;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Fetcher = void 0;
4
+ var Fetcher = (function () {
5
+ function Fetcher() {
6
+ }
7
+ return Fetcher;
8
+ }());
9
+ exports.Fetcher = Fetcher;
@@ -1,7 +1,7 @@
1
- import { LifeCycle } from 'simple-boot-core/cycles/LifeCycle';
2
- export interface FrontLifeCycle extends LifeCycle {
3
- onInit(): void;
4
- onChangedRender(): void;
5
- onInitedChild(): void;
6
- onFinish(): void;
7
- }
1
+ import { LifeCycle } from 'simple-boot-core/cycles/LifeCycle';
2
+ export interface FrontLifeCycle extends LifeCycle {
3
+ onInit(): void;
4
+ onChangedRender(): void;
5
+ onInitedChild(): void;
6
+ onFinish(): void;
7
+ }