simple-boot-front 1.0.101 → 1.0.104

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.
package/README.MD CHANGED
@@ -30,20 +30,20 @@ npm start
30
30
  # directory structure
31
31
  ```
32
32
  ┌─ assets
33
- ├──dist (out put directory)
34
- ├──src (source)
35
- ├──pages (your pages)
33
+ ├─ dist (out put directory)
34
+ ├─ src (source)
35
+ ├─ pages (your pages)
36
36
  │ │ ├ home.ts (sample page)
37
37
  │ │ └ user.ts (sample page)
38
- ├──index.css (index route page css)
39
- ├──index.html (index route page template)
40
- └──index.ts (simple-boot-fornt start and route point)
41
- ├──types (typescript type)
38
+ ├─ index.css (index route page css)
39
+ ├─ index.html (index route page template)
40
+ └─ index.ts (simple-boot-fornt start and route point)
41
+ ├─ types (typescript type)
42
42
  │ └ index.d.ts (type definition)
43
- ├──index.html start (point html)
44
- ├──package.json (project config)
45
- ├──rollup.config.js (rollup bundler config)
46
- └──tsconfig.json (typescript config)
43
+ ├─ index.html start (point html)
44
+ ├─ package.json (project config)
45
+ ├─ rollup.config.js (rollup bundler config)
46
+ └─ tsconfig.json (typescript config)
47
47
  ```
48
48
 
49
49
  ## source
@@ -21,9 +21,11 @@ export declare class SimpleBootFront extends SimpleApplication {
21
21
  getComponentInnerHtml(targetObj: any): string;
22
22
  createDomRender<T extends object>(obj: T): T;
23
23
  private initRun;
24
+ initWriteRootRouter(): void;
25
+ writeRootRouter(): SimAtomic<any>;
24
26
  goRouting(url: string): Promise<RouterModule<SimAtomic<Object>, any>>;
25
27
  runRouting(otherInstanceSim?: Map<ConstructorType<any>, any>, url?: string): Promise<RouterModule<SimAtomic<Object>, any> | undefined>;
26
- run(otherInstanceSim?: Map<ConstructorType<any>, any>, url?: string): SimpleBootFront;
28
+ run(otherInstanceSim?: Map<ConstructorType<any>, any>, url?: string): void;
27
29
  private afterSetting;
28
30
  initDomRenderScripts(): void;
29
31
  private initDomRenderTargetElements;
@@ -88,6 +88,7 @@ var SimpleBootFront = (function (_super) {
88
88
  _this.domRenderTargetElements = [];
89
89
  _this.domRenderTargetAttrs = [];
90
90
  _this.domRenderConfig = {
91
+ routerType: 'none',
91
92
  window: option.window,
92
93
  targetElements: _this.domRenderTargetElements,
93
94
  targetAttrs: _this.domRenderTargetAttrs,
@@ -174,34 +175,44 @@ var SimpleBootFront = (function (_super) {
174
175
  };
175
176
  SimpleBootFront.prototype.initRun = function (otherInstanceSim) {
176
177
  var _this = this;
177
- var _a, _b, _c, _d, _e;
178
178
  _super.prototype.run.call(this, otherInstanceSim);
179
179
  this.initDomRenderScripts();
180
180
  this.initDomRenderTargetElements();
181
181
  this.navigation = this.simstanceManager.getOrNewSim(Navigation_1.Navigation);
182
- var routerAtomic = new SimAtomic_1.SimAtomic(this.rootRouter, this.getSimstanceManager());
183
- var target = this.option.window.document.querySelector(this.option.selector);
184
- if (target && routerAtomic.value) {
185
- var component = routerAtomic.getConfig(Component_1.ComponentMetadataKey);
186
- 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(' ');
187
- target.innerHTML = "".concat(styles, " ").concat((_c = component === null || component === void 0 ? void 0 : component.template) !== null && _c !== void 0 ? _c : '');
188
- var val = routerAtomic.value;
189
- var domRenderProxy = val._DomRender_proxy;
190
- domRenderProxy.initRender(target);
191
- (_e = (_d = val) === null || _d === void 0 ? void 0 : _d.onInit) === null || _e === void 0 ? void 0 : _e.call(_d);
192
- }
182
+ this.initWriteRootRouter();
193
183
  this.option.window.addEventListener('intent', function (event) {
194
184
  var cevent = event;
195
185
  _this.publishIntent(new Intent_1.Intent(cevent.detail.uri, cevent.detail.data, event));
196
186
  });
197
187
  this.option.window.addEventListener('popstate', function (event) {
198
- var _a;
199
- var intent = new Intent_1.Intent((_a = _this.navigation.url) !== null && _a !== void 0 ? _a : '');
188
+ var intent = new Intent_1.Intent(_this.navigation.url || '/');
200
189
  _this.routing(intent).then(function (it) {
201
190
  _this.afterSetting();
202
191
  });
203
192
  });
204
193
  };
194
+ SimpleBootFront.prototype.initWriteRootRouter = function () {
195
+ var _a;
196
+ var routerAtomic = this.writeRootRouter();
197
+ var target = this.option.window.document.querySelector(this.option.selector);
198
+ if (target && routerAtomic && routerAtomic.value) {
199
+ var val = routerAtomic.value;
200
+ var domRenderProxy = val._DomRender_proxy;
201
+ domRenderProxy.initRender(target);
202
+ (_a = val === null || val === void 0 ? void 0 : val.onInit) === null || _a === void 0 ? void 0 : _a.call(val);
203
+ }
204
+ };
205
+ SimpleBootFront.prototype.writeRootRouter = function () {
206
+ var _a, _b, _c;
207
+ var routerAtomic = new SimAtomic_1.SimAtomic(this.rootRouter, this.getSimstanceManager());
208
+ var target = this.option.window.document.querySelector(this.option.selector);
209
+ if (target && routerAtomic.value) {
210
+ var component = routerAtomic.getConfig(Component_1.ComponentMetadataKey);
211
+ 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(' ');
212
+ target.innerHTML = "".concat(styles, " ").concat((_c = component === null || component === void 0 ? void 0 : component.template) !== null && _c !== void 0 ? _c : '');
213
+ }
214
+ return routerAtomic;
215
+ };
205
216
  SimpleBootFront.prototype.goRouting = function (url) {
206
217
  var _a;
207
218
  return __awaiter(this, void 0, void 0, function () {
@@ -247,7 +258,6 @@ var SimpleBootFront = (function (_super) {
247
258
  this.navigation.go(url);
248
259
  }
249
260
  this.option.window.dispatchEvent(new Event('popstate'));
250
- return this;
251
261
  };
252
262
  SimpleBootFront.prototype.afterSetting = function () {
253
263
  var _this = this;
@@ -311,7 +321,7 @@ var SimpleBootFront = (function (_super) {
311
321
  var items = RawSet_1.RawSet.createComponentTargetElement(name, function (e, obj, r) {
312
322
  var newSim = _this.simstanceManager.newSim(val);
313
323
  return newSim;
314
- }, component === null || component === void 0 ? void 0 : component.template, component === null || component === void 0 ? void 0 : component.styles, _this.domRenderConfig);
324
+ }, component === null || component === void 0 ? void 0 : component.template, component === null || component === void 0 ? void 0 : component.styles, false, _this.domRenderConfig);
315
325
  _this.domRenderTargetElements.push(items);
316
326
  });
317
327
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "simple-boot-front",
3
- "version": "1.0.101",
3
+ "version": "1.0.104",
4
4
  "main": "SimpleApplication.js",
5
5
  "license": "MIT",
6
6
  "description": "front end SPA frameworks",
@@ -49,16 +49,11 @@
49
49
  },
50
50
  "scripts": {
51
51
  "build": "rm -rf dist && tsc --outDir dist --declarationDir dist",
52
- "dev:serve": "npm run serve --workspace=dev",
53
- "dev-onepage:serve": "npm run serve --workspace=dev-onepage",
54
- "npm-build": "rm -rf dist && tsc --outDir dist --declarationDir dist && cp package-prod.json dist/package.json && cp README.MD dist",
52
+ "npm-build": "rm -rf dist && mkdir dist && cp package-prod.json dist/package.json && cp README.MD dist && tsc --outDir dist --declarationDir dist",
55
53
  "npm-publish": "npm run npm-build && npm publish ./dist",
56
54
  "tsc": "tsc",
57
- "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",
58
- "tsc:root-dist": "npm run setting:root-dist && tsc --outDir ../dist-simple-boot-front --declarationDir ../dist-simple-boot-front",
59
- "tsc:watch": "rm -rf ./dist && mkdir dist && cp package.json dist && tsc --watch --sourceMap true",
60
- "tsc:watch:root-dist": "npm run setting:root-dist && tsc --outDir ../dist-simple-boot-front --declarationDir ../dist-simple-boot-front --watch --sourceMap true",
61
- "tsc:watch:dev": "rm -rf ./dist && mkdir dist && cp package-dev.json dist && tsc --watch --sourceMap true",
55
+ "tsc:watch": "rm -rf ./dist && mkdir dist && cp package.json dist && tsc --watch --outDir dist --declarationDir dist --sourceMap true",
56
+ "build:ts:watch": "rm -rf ./dist && mkdir dist && cp package-prod.json dist/package.json && tsc --watch --outDir dist --declarationDir dist --sourceMap true",
62
57
  "test": "jest --detectOpenHandles --forceExit"
63
58
  },
64
59
  "alias": {},
@@ -77,7 +72,7 @@
77
72
  "typescript": "^4.4.3"
78
73
  },
79
74
  "dependencies": {
80
- "dom-render": "^1.0.70",
81
- "simple-boot-core": "^1.0.29"
75
+ "dom-render": "^1.0.75",
76
+ "simple-boot-core": "^1.0.30"
82
77
  }
83
78
  }
@@ -95,7 +95,7 @@ var Navigation = (function () {
95
95
  this.option.window.history.pushState(data, title, path);
96
96
  }
97
97
  else if (SimFrontOption_1.UrlType.hash === this.option.urlType) {
98
- path = '#' + path.substring(1);
98
+ path = '#' + path;
99
99
  this.option.window.history.pushState(data, title, path);
100
100
  }
101
101
  };