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.
package/README.MD CHANGED
@@ -1,252 +1,252 @@
1
- ![Single Page Application Framworks](assets/banner.png)
2
- [![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)
3
-
4
- Single Page Application Framworks for Web
5
-
6
- # [😎 demo page link](https://codesandbox.io/s/example-simple-boot-front-spb5d)
7
-
8
-
9
- ## Our primary goals are
10
- * Provide a radically faster and widely accessible getting started experience for all front end.
11
-
12
- ## 🚀 Quick start cli
13
- ```shell
14
- npm init simple-boot-front projectname
15
- cd projectname
16
- npm run bundle
17
- npm run serve
18
- ```
19
-
20
- - Installation and Getting Started
21
- ```
22
- npm install simple-boot-front
23
- ```
24
-
25
-
26
-
27
-
28
- ## [😃 examples project](./examples)
29
- * #### [parcel-bundler](./examples/parcel-bundler)
30
- * #### [parcel-bundler-js](./examples/parcel-bundler-js) (js version)
31
- * #### [webpack](./examples/parcel-bundler)
32
-
33
-
34
- * Here is a quick teaser of a complete simple-boot-front application in typescript
35
- * index.ts
36
- ```typescript
37
- const option = new SimFrontOption(window, [Advice]).setUrlType(UrlType.path);
38
- const simpleApplication = new SimpleBootFront(AppRouter, option);
39
- simpleApplication.run();
40
- ```
41
-
42
- * index.html
43
- ```html
44
- <!doctype html>
45
- <html>
46
- <head>...</head>
47
- <body id="app"></body>
48
- </html>
49
- ```
50
- * AppRouter.ts
51
- ```typescript
52
- @Sim({scheme: 'layout-router'})
53
- @Component({template, styles: [css]})
54
- @Router({
55
- path: '',
56
- childs: {
57
- '': Index,
58
- '/': Index,
59
- '/user': User
60
- }
61
- })
62
- export class AppRouter implements RouterAction, FrontLifeCycle {
63
- name = 'AppRouter'
64
- data = {name: 'good'}
65
- child?: any
66
-
67
- constructor(private navigation: Navigation, private simOption: SimFrontOption) {
68
- }
69
-
70
- canActivate(url: Intent, module: any) {
71
- console.log('canActivate router--->', url, module)
72
- this.child = module;
73
- }
74
-
75
- onReady(data: HTMLFrameElement): void {
76
- }
77
-
78
- onRenderd(data: HTMLFrameElement): void {
79
- }
80
-
81
- onChangedRender(): void {
82
- }
83
-
84
- onCreate(): void {
85
- }
86
-
87
- onFinish(): void {
88
- }
89
-
90
- onInit(): void {
91
- }
92
-
93
- onInitedChild(): void {
94
- }
95
- }
96
-
97
- ```
98
- * index.ts
99
- ```typescript
100
- @Sim({scheme: 'index'})
101
- Component({
102
- template,
103
- styles: [css]
104
- })
105
- export class Index {
106
- public user?: User;
107
- public data = {name: 'visualkhh'}
108
- onInit() {
109
- console.log('-->')
110
- }
111
-
112
- @PostConstruct
113
- public g(s: User) {
114
-
115
- }
116
- }
117
-
118
-
119
- ```
120
- * index.html
121
- ```html
122
- <h1>index</h1>
123
- ${this.data.name}
124
- <button dr-event-click="this.data.name='vvv'"> change name </button>
125
- ```
126
-
127
- ## View template engine (dom-render)
128
- - https://github.com/visualkhh/dom-render
129
- - ### It's a compiler that takes your declarative components and converts them into efficient JavaScript that surgically updates the DOM.
130
- - ### Update view only for parts where the value has changed.
131
-
132
- ## Module LifeCycle
133
- * onCreate(): Sim onCreate just one call
134
- * onInit(): module load event
135
- * onChangedRender(): change rended in module event
136
- * onInitedChild(): module and child module inited event
137
- * onFinish(): lifecycle finish event
138
-
139
- # Decorator
140
- * @Sim(): Objects managed by the SimpleBootFront framework
141
- - parameter: SimConfig {schema: string}
142
- ```typescript
143
- @Sim({scheme: 'index'})
144
- @Component({
145
- template,
146
- styles: [css]
147
- })
148
- export class Index { }
149
- ```
150
- * @PostConstruct(): Methods that you run for a separate initialization operation after the object is created
151
- ```typescript
152
- @PostConstruct
153
- post(projectService: ProjectService) {
154
- console.log('post Construct and dependency injection')
155
- }
156
- ```
157
- * @Injectable: No Sim Decorator Class Inject Sim
158
- ```typescript
159
- @Injectable()
160
- export class CTitle extends Title {
161
- constructor(public testService: TestService) {
162
- console.log('ctitle constructor-->', this.testService)
163
- }
164
-
165
- cc() {
166
- this.value = this.testService.tail(Math.floor(RandomUtils.random(1, 50)), '---');
167
- }
168
- @PostConstruct
169
- ttt(testService: TestService) {
170
- console.log('poo->', testService)
171
- }
172
- }
173
- ```
174
-
175
- * @After, @Before (AOP)
176
- ```typescript
177
- fire($event: MouseEvent, view: View<Element>) {
178
- console.log('fire method')
179
- this.data = RandomUtils.random(0, 100);
180
- }
181
- @Before({property: 'fire'})
182
- before(obj: any, protoType: Function) {
183
- console.log('before', obj, protoType)
184
- }
185
-
186
- @After({property: 'fire'})
187
- after(obj: any, protoType: Function) {
188
- console.log('after', obj, protoType)
189
- }
190
- ```
191
-
192
- * @ExceptionHandler
193
- ```typescript
194
- @ExceptionHandler()
195
- public exception0(e: any) {
196
- console.log('Advice Global exception:', e)
197
- }
198
- ```
199
-
200
- ## Intent event broker
201
- ```typescript
202
- click() {
203
- intentManager.publish(new Intent('layout://info/data?a=wow&aa=zzz', Math.floor(RandomUtils.random(0, 100))));
204
- // const data = new CustomEvent('intent', {detail: {uri: 'index://showStore', data: {id: ${it.ID}}}}); window.dispatchEvent(data);
205
- //intentManager(new Intent('layout://info/datas', Math.floor(RandomUtils.random(0, 100))));
206
- //intentManager(new Intent('layout://', Math.floor(RandomUtils.random(0, 100)))); // default callback method -> subscribe(i: Intent)
207
- //intentManager(new Intent('://info/datas', Math.floor(RandomUtils.random(0, 100))));
208
- }
209
- ```
210
-
211
- ```typescript
212
- @Sim({scheme: 'layout'})
213
- @Component({
214
- template,
215
- styles: [css]
216
- })
217
- export class App {
218
- info = new AppInfo();
219
- constructor() {}
220
- }
221
- ```
222
- ```typescript
223
- export class AppInfo {
224
- datas = 'default data';
225
- data(i: Intent) {
226
- this.datas = i.data + '->' + i.params.aa
227
- }
228
- }
229
- ```
230
- ## Reserved key word
231
- * html
232
- - attribute
233
- - **router-active-class**: url === href attribute => class add
234
- - value: add and remove class name
235
- ```html
236
- <a router-link="ajax" router-active-class="active">Ajax</a>
237
- ```
238
- - **router-link**:
239
- - value: router link
240
- ```html
241
- <a router-link="ajax">Ajax</a>
242
- ```
243
- - intent
244
- ```typescript
245
- showStore(i: Intent) {
246
- this.datas = i.data + '->' + i.params.aa
247
- }
248
- call -> const data = new CustomEvent('intent', {detail: {uri: 'index://showStore', data: {id: ${it.ID}}}}); window.dispatchEvent(data);
249
- ```
250
- ## License
251
- * MIT
252
- * visualkhh@gmail.com
1
+ ![Single Page Application Framworks](assets/banner.png)
2
+ [![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)
3
+
4
+ Single Page Application Framworks for Web
5
+
6
+ # [😎 demo page link](https://codesandbox.io/s/example-simple-boot-front-spb5d)
7
+
8
+
9
+ ## Our primary goals are
10
+ * Provide a radically faster and widely accessible getting started experience for all front end.
11
+
12
+ ## 🚀 Quick start cli
13
+ ```shell
14
+ npm init simple-boot-front projectname
15
+ cd projectname
16
+ npm run bundle
17
+ npm run serve
18
+ ```
19
+
20
+ - Installation and Getting Started
21
+ ```
22
+ npm install simple-boot-front
23
+ ```
24
+
25
+
26
+
27
+
28
+ ## [😃 examples project](./examples)
29
+ * #### [parcel-bundler](./examples/parcel-bundler)
30
+ * #### [parcel-bundler-js](./examples/parcel-bundler-js) (js version)
31
+ * #### [webpack](./examples/parcel-bundler)
32
+
33
+
34
+ * Here is a quick teaser of a complete simple-boot-front application in typescript
35
+ * index.ts
36
+ ```typescript
37
+ const option = new SimFrontOption(window, [Advice]).setUrlType(UrlType.path);
38
+ const simpleApplication = new SimpleBootFront(AppRouter, option);
39
+ simpleApplication.run();
40
+ ```
41
+
42
+ * index.html
43
+ ```html
44
+ <!doctype html>
45
+ <html>
46
+ <head>...</head>
47
+ <body id="app"></body>
48
+ </html>
49
+ ```
50
+ * AppRouter.ts
51
+ ```typescript
52
+ @Sim({scheme: 'layout-router'})
53
+ @Component({template, styles: [css]})
54
+ @Router({
55
+ path: '',
56
+ childs: {
57
+ '': Index,
58
+ '/': Index,
59
+ '/user': User
60
+ }
61
+ })
62
+ export class AppRouter implements RouterAction, FrontLifeCycle {
63
+ name = 'AppRouter'
64
+ data = {name: 'good'}
65
+ child?: any
66
+
67
+ constructor(private navigation: Navigation, private simOption: SimFrontOption) {
68
+ }
69
+
70
+ canActivate(url: Intent, module: any) {
71
+ console.log('canActivate router--->', url, module)
72
+ this.child = module;
73
+ }
74
+
75
+ onReady(data: HTMLFrameElement): void {
76
+ }
77
+
78
+ onRenderd(data: HTMLFrameElement): void {
79
+ }
80
+
81
+ onChangedRender(): void {
82
+ }
83
+
84
+ onCreate(): void {
85
+ }
86
+
87
+ onFinish(): void {
88
+ }
89
+
90
+ onInit(): void {
91
+ }
92
+
93
+ onInitedChild(): void {
94
+ }
95
+ }
96
+
97
+ ```
98
+ * index.ts
99
+ ```typescript
100
+ @Sim({scheme: 'index'})
101
+ Component({
102
+ template,
103
+ styles: [css]
104
+ })
105
+ export class Index {
106
+ public user?: User;
107
+ public data = {name: 'visualkhh'}
108
+ onInit() {
109
+ console.log('-->')
110
+ }
111
+
112
+ @PostConstruct
113
+ public g(s: User) {
114
+
115
+ }
116
+ }
117
+
118
+
119
+ ```
120
+ * index.html
121
+ ```html
122
+ <h1>index</h1>
123
+ ${this.data.name}
124
+ <button dr-event-click="this.data.name='vvv'"> change name </button>
125
+ ```
126
+
127
+ ## View template engine (dom-render)
128
+ - https://github.com/visualkhh/dom-render
129
+ - ### It's a compiler that takes your declarative components and converts them into efficient JavaScript that surgically updates the DOM.
130
+ - ### Update view only for parts where the value has changed.
131
+
132
+ ## Module LifeCycle
133
+ * onCreate(): Sim onCreate just one call
134
+ * onInit(): module load event
135
+ * onChangedRender(): change rended in module event
136
+ * onInitedChild(): module and child module inited event
137
+ * onFinish(): lifecycle finish event
138
+
139
+ # Decorator
140
+ * @Sim(): Objects managed by the SimpleBootFront framework
141
+ - parameter: SimConfig {schema: string}
142
+ ```typescript
143
+ @Sim({scheme: 'index'})
144
+ @Component({
145
+ template,
146
+ styles: [css]
147
+ })
148
+ export class Index { }
149
+ ```
150
+ * @PostConstruct(): Methods that you run for a separate initialization operation after the object is created
151
+ ```typescript
152
+ @PostConstruct
153
+ post(projectService: ProjectService) {
154
+ console.log('post Construct and dependency injection')
155
+ }
156
+ ```
157
+ * @Injectable: No Sim Decorator Class Inject Sim
158
+ ```typescript
159
+ @Injectable()
160
+ export class CTitle extends Title {
161
+ constructor(public testService: TestService) {
162
+ console.log('ctitle constructor-->', this.testService)
163
+ }
164
+
165
+ cc() {
166
+ this.value = this.testService.tail(Math.floor(RandomUtils.random(1, 50)), '---');
167
+ }
168
+ @PostConstruct
169
+ ttt(testService: TestService) {
170
+ console.log('poo->', testService)
171
+ }
172
+ }
173
+ ```
174
+
175
+ * @After, @Before (AOP)
176
+ ```typescript
177
+ fire($event: MouseEvent, view: View<Element>) {
178
+ console.log('fire method')
179
+ this.data = RandomUtils.random(0, 100);
180
+ }
181
+ @Before({property: 'fire'})
182
+ before(obj: any, protoType: Function) {
183
+ console.log('before', obj, protoType)
184
+ }
185
+
186
+ @After({property: 'fire'})
187
+ after(obj: any, protoType: Function) {
188
+ console.log('after', obj, protoType)
189
+ }
190
+ ```
191
+
192
+ * @ExceptionHandler
193
+ ```typescript
194
+ @ExceptionHandler()
195
+ public exception0(e: any) {
196
+ console.log('Advice Global exception:', e)
197
+ }
198
+ ```
199
+
200
+ ## Intent event broker
201
+ ```typescript
202
+ click() {
203
+ intentManager.publish(new Intent('layout://info/data?a=wow&aa=zzz', Math.floor(RandomUtils.random(0, 100))));
204
+ // const data = new CustomEvent('intent', {detail: {uri: 'index://showStore', data: {id: ${it.ID}}}}); window.dispatchEvent(data);
205
+ //intentManager(new Intent('layout://info/datas', Math.floor(RandomUtils.random(0, 100))));
206
+ //intentManager(new Intent('layout://', Math.floor(RandomUtils.random(0, 100)))); // default callback method -> subscribe(i: Intent)
207
+ //intentManager(new Intent('://info/datas', Math.floor(RandomUtils.random(0, 100))));
208
+ }
209
+ ```
210
+
211
+ ```typescript
212
+ @Sim({scheme: 'layout'})
213
+ @Component({
214
+ template,
215
+ styles: [css]
216
+ })
217
+ export class App {
218
+ info = new AppInfo();
219
+ constructor() {}
220
+ }
221
+ ```
222
+ ```typescript
223
+ export class AppInfo {
224
+ datas = 'default data';
225
+ data(i: Intent) {
226
+ this.datas = i.data + '->' + i.params.aa
227
+ }
228
+ }
229
+ ```
230
+ ## Reserved key word
231
+ * html
232
+ - attribute
233
+ - **router-active-class**: url === href attribute => class add
234
+ - value: add and remove class name
235
+ ```html
236
+ <a router-link="ajax" router-active-class="active">Ajax</a>
237
+ ```
238
+ - **router-link**:
239
+ - value: router link
240
+ ```html
241
+ <a router-link="ajax">Ajax</a>
242
+ ```
243
+ - intent
244
+ ```typescript
245
+ showStore(i: Intent) {
246
+ this.datas = i.data + '->' + i.params.aa
247
+ }
248
+ call -> const data = new CustomEvent('intent', {detail: {uri: 'index://showStore', data: {id: ${it.ID}}}}); window.dispatchEvent(data);
249
+ ```
250
+ ## License
251
+ * MIT
252
+ * visualkhh@gmail.com
@@ -1,22 +1,22 @@
1
- import { SimFrontOption } from './option/SimFrontOption';
2
- import { ConstructorType } from 'simple-boot-core/types/Types';
3
- import { SimpleApplication } from 'simple-boot-core/SimpleApplication';
4
- import { Navigation } from './service/Navigation';
5
- import { HttpService } from './service/HttpService';
6
- import { SimstanceManager } from 'simple-boot-core/simstance/SimstanceManager';
7
- import { IntentManager } from 'simple-boot-core/intent/IntentManager';
8
- import { RouterManager } from 'simple-boot-core/route/RouterManager';
9
- import { TargetElement, TargetAttr } from 'dom-render/Config';
10
- export declare class SimpleBootFront extends SimpleApplication {
11
- rootRouter: ConstructorType<any>;
12
- option: SimFrontOption;
13
- navigation: Navigation;
14
- domRendoerExcludeProxy: (typeof SimFrontOption | typeof SimstanceManager | typeof SimpleApplication | typeof Navigation | typeof HttpService | typeof IntentManager | typeof RouterManager)[];
15
- targetElements: TargetElement[];
16
- targetAttrs: TargetAttr[];
17
- constructor(rootRouter: ConstructorType<any>, option: SimFrontOption);
18
- getComponentInnerHtml(targetObj: any): string;
19
- createDomRender<T extends object>(obj: T): T;
20
- run(): void;
21
- private afterSetting;
22
- }
1
+ import { SimFrontOption } from './option/SimFrontOption';
2
+ import { ConstructorType } from 'simple-boot-core/types/Types';
3
+ import { SimpleApplication } from 'simple-boot-core/SimpleApplication';
4
+ import { Navigation } from './service/Navigation';
5
+ import { HttpService } from './service/HttpService';
6
+ import { SimstanceManager } from 'simple-boot-core/simstance/SimstanceManager';
7
+ import { IntentManager } from 'simple-boot-core/intent/IntentManager';
8
+ import { RouterManager } from 'simple-boot-core/route/RouterManager';
9
+ import { TargetElement, TargetAttr } from 'dom-render/Config';
10
+ export declare class SimpleBootFront extends SimpleApplication {
11
+ rootRouter: ConstructorType<any>;
12
+ option: SimFrontOption;
13
+ navigation: Navigation;
14
+ domRendoerExcludeProxy: (typeof SimFrontOption | typeof SimstanceManager | typeof SimpleApplication | typeof Navigation | typeof HttpService | typeof IntentManager | typeof RouterManager)[];
15
+ targetElements: TargetElement[];
16
+ targetAttrs: TargetAttr[];
17
+ constructor(rootRouter: ConstructorType<any>, option: SimFrontOption);
18
+ getComponentInnerHtml(targetObj: any): string;
19
+ createDomRender<T extends object>(obj: T): T;
20
+ run(): void;
21
+ private afterSetting;
22
+ }