lupine.api 1.1.58 → 1.1.59
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 +3 -3
- package/admin/admin-about.tsx +12 -16
- package/admin/admin-config.tsx +47 -44
- package/admin/admin-css.tsx +3 -3
- package/admin/admin-db.tsx +75 -75
- package/admin/admin-frame-helper.tsx +364 -364
- package/admin/admin-frame.tsx +164 -164
- package/admin/admin-index.tsx +65 -65
- package/admin/admin-login.tsx +111 -111
- package/admin/admin-menu-edit.tsx +637 -637
- package/admin/admin-menu-list.tsx +87 -87
- package/admin/admin-page-edit.tsx +564 -564
- package/admin/admin-page-list.tsx +83 -83
- package/admin/admin-performance.tsx +28 -28
- package/admin/admin-release.tsx +427 -426
- package/admin/admin-resources.tsx +382 -382
- package/admin/admin-shell.tsx +89 -89
- package/admin/admin-table-data.tsx +146 -146
- package/admin/admin-table-list.tsx +230 -230
- package/admin/admin-test-animations.tsx +395 -395
- package/admin/admin-test-component.tsx +823 -808
- package/admin/admin-test-edit.tsx +319 -319
- package/admin/admin-test-themes.tsx +56 -56
- package/admin/admin-tokens.tsx +338 -338
- package/admin/design/admin-design.tsx +174 -174
- package/admin/design/block-grid.tsx +36 -36
- package/admin/design/block-grid1.tsx +21 -21
- package/admin/design/block-paragraph.tsx +19 -19
- package/admin/design/block-title.tsx +19 -19
- package/admin/design/design-block-box.tsx +140 -140
- package/admin/design/drag-data.tsx +24 -24
- package/admin/index.ts +9 -9
- package/admin/package.json +15 -15
- package/admin/tsconfig.json +127 -127
- package/dev/copy-folder.js +32 -32
- package/dev/cp-index-html.js +69 -69
- package/dev/file-utils.js +12 -12
- package/dev/index.js +18 -19
- package/dev/package.json +12 -12
- package/dev/plugin-ifelse.js +168 -168
- package/dev/plugin-ifelse.test.js +37 -37
- package/dev/run-cmd.js +14 -14
- package/dev/send-request.js +12 -12
- package/package.json +55 -55
- package/src/admin-api/admin-api-helper.ts +210 -205
- package/src/admin-api/admin-api.ts +65 -65
- package/src/admin-api/admin-auth.ts +152 -146
- package/src/admin-api/admin-config.ts +94 -84
- package/src/admin-api/admin-csv.ts +94 -94
- package/src/admin-api/admin-db.ts +269 -269
- package/src/admin-api/admin-menu.ts +135 -135
- package/src/admin-api/admin-page.ts +135 -135
- package/src/admin-api/admin-performance.ts +128 -128
- package/src/admin-api/admin-release.ts +703 -700
- package/src/admin-api/admin-resources.ts +318 -318
- package/src/admin-api/admin-token-helper.ts +82 -79
- package/src/admin-api/admin-tokens.ts +90 -90
- package/src/admin-api/index.ts +2 -2
- package/src/admin-api/web-config-api.ts +19 -19
- package/src/api/api-cache.ts +103 -103
- package/src/api/api-helper.ts +44 -44
- package/src/api/api-module.ts +67 -60
- package/src/api/api-router.ts +177 -177
- package/src/api/api-shared-storage.ts +64 -64
- package/src/api/async-storage.ts +5 -5
- package/src/api/debug-service.ts +56 -56
- package/src/api/encode-html.ts +27 -27
- package/src/api/handle-status.ts +75 -75
- package/src/api/index.ts +15 -16
- package/src/api/mini-web-socket.ts +270 -270
- package/src/api/server-content-type.ts +82 -82
- package/src/api/server-render.ts +235 -215
- package/src/api/shell-service.ts +74 -74
- package/src/api/simple-storage.ts +80 -80
- package/src/api/static-server.ts +128 -125
- package/src/api/to-client-delivery.ts +26 -26
- package/src/app/app-cache.ts +55 -55
- package/src/app/app-helper.ts +62 -62
- package/src/app/app-message.ts +109 -109
- package/src/app/app-shared-storage.ts +363 -363
- package/src/app/app-start.ts +136 -136
- package/src/app/cleanup-exit.ts +16 -16
- package/src/app/host-to-path.ts +38 -38
- package/src/app/index.ts +11 -11
- package/src/app/process-dev-requests.ts +130 -130
- package/src/app/web-listener.ts +294 -294
- package/src/app/web-processor.ts +47 -42
- package/src/app/web-server.ts +100 -100
- package/src/common-js/web-env.js +104 -104
- package/src/index.ts +7 -7
- package/src/lang/api-lang-en.ts +26 -26
- package/src/lang/api-lang-zh-cn.ts +27 -27
- package/src/lang/index.ts +2 -2
- package/src/lang/lang-helper.ts +76 -76
- package/src/lang/lang-props.ts +6 -6
- package/src/lib/db/db-helper.ts +23 -23
- package/src/lib/db/db-mysql.ts +249 -250
- package/src/lib/db/db-sqlite.ts +101 -101
- package/src/lib/db/db.spec.ts +28 -28
- package/src/lib/db/db.ts +325 -325
- package/src/lib/db/index.ts +5 -5
- package/src/lib/index.ts +3 -3
- package/src/lib/logger.spec.ts +214 -214
- package/src/lib/logger.ts +281 -281
- package/src/lib/runtime-require.ts +37 -37
- package/src/lib/utils/cookie-util.ts +34 -34
- package/src/lib/utils/crypto.ts +58 -58
- package/src/lib/utils/date-utils.ts +317 -317
- package/src/lib/utils/deep-merge.ts +37 -37
- package/src/lib/utils/delay.ts +12 -12
- package/src/lib/utils/file-setting.ts +55 -55
- package/src/lib/utils/format-bytes.ts +11 -11
- package/src/lib/utils/fs-utils.ts +158 -158
- package/src/lib/utils/get-env.ts +27 -27
- package/src/lib/utils/index.ts +12 -12
- package/src/lib/utils/is-type.ts +48 -48
- package/src/lib/utils/load-env.ts +14 -14
- package/src/lib/utils/pad.ts +6 -6
- package/src/models/api-base.ts +5 -5
- package/src/models/api-module-props.ts +10 -11
- package/src/models/api-router-props.ts +26 -26
- package/src/models/app-cache-props.ts +33 -33
- package/src/models/app-data-props.ts +10 -10
- package/src/models/app-helper-props.ts +6 -6
- package/src/models/app-shared-storage-props.ts +38 -38
- package/src/models/app-start-props.ts +18 -18
- package/src/models/async-storage-props.ts +13 -13
- package/src/models/db-config.ts +30 -30
- package/src/models/host-to-path-props.ts +12 -12
- package/src/models/index.ts +16 -16
- package/src/models/json-object.ts +8 -8
- package/src/models/locals-props.ts +36 -36
- package/src/models/logger-props.ts +84 -84
- package/src/models/simple-storage-props.ts +13 -14
- package/src/models/to-client-delivery-props.ts +6 -6
- package/tsconfig.json +115 -115
- package/dev/plugin-gen-versions.js +0 -20
|
@@ -1,395 +1,395 @@
|
|
|
1
|
-
import {
|
|
2
|
-
RefProps,
|
|
3
|
-
updateStyles,
|
|
4
|
-
ButtonPushAnimation,
|
|
5
|
-
ButtonPushAnimationSize,
|
|
6
|
-
HtmlVar,
|
|
7
|
-
Progress,
|
|
8
|
-
ProgressHookProps,
|
|
9
|
-
Spinner01,
|
|
10
|
-
Spinner02,
|
|
11
|
-
Spinner03,
|
|
12
|
-
SpinnerSize,
|
|
13
|
-
TextGlow,
|
|
14
|
-
TextWave,
|
|
15
|
-
CssProps,
|
|
16
|
-
ToggleButton,
|
|
17
|
-
TogglePlayButton,
|
|
18
|
-
TogglePlayButtonSize,
|
|
19
|
-
TextScale,
|
|
20
|
-
} from 'lupine.components';
|
|
21
|
-
|
|
22
|
-
const TestButton = () => {
|
|
23
|
-
const onClick = async () => {
|
|
24
|
-
dom.value = 'You clicked the button.';
|
|
25
|
-
};
|
|
26
|
-
const ref: RefProps = {
|
|
27
|
-
onLoad: async () => {
|
|
28
|
-
dom.value = 'This value is set in onLoad event.';
|
|
29
|
-
},
|
|
30
|
-
};
|
|
31
|
-
const dom = new HtmlVar('');
|
|
32
|
-
return (
|
|
33
|
-
<div ref={ref} class='row-box pt-m'>
|
|
34
|
-
<button onClick={onClick} class='button-base'>
|
|
35
|
-
Click me!
|
|
36
|
-
</button>
|
|
37
|
-
<div class='pl-m'>{dom.node}</div>
|
|
38
|
-
</div>
|
|
39
|
-
);
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
const TestInput = () => {
|
|
43
|
-
const onInput = async (ev?: any) => {
|
|
44
|
-
// you can get value from: ev.target.value
|
|
45
|
-
dom.value = 'Your input: ' + refInput.current.value;
|
|
46
|
-
};
|
|
47
|
-
const onClick = async () => {
|
|
48
|
-
refInput.current.value = '';
|
|
49
|
-
refInput.current.dispatchEvent(new Event('input'));
|
|
50
|
-
};
|
|
51
|
-
const dom = new HtmlVar('');
|
|
52
|
-
const refInput: RefProps = {};
|
|
53
|
-
return (
|
|
54
|
-
<div>
|
|
55
|
-
<div class='row-box pt-m'>
|
|
56
|
-
<input ref={refInput} class='input-base' type='input' onInput={onInput} />
|
|
57
|
-
<div class='pl-m'>{dom.node}</div>
|
|
58
|
-
</div>
|
|
59
|
-
<div class='row-box pt-m'>
|
|
60
|
-
<button onClick={onClick} class='button-base'>
|
|
61
|
-
Clear Input Value
|
|
62
|
-
</button>
|
|
63
|
-
</div>
|
|
64
|
-
</div>
|
|
65
|
-
);
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
const TestMouse = () => {
|
|
69
|
-
const onClick = (ev: any) => {
|
|
70
|
-
dom.value = `Clicked: x: ${ev.clientX}, y: ${ev.clientY}`;
|
|
71
|
-
};
|
|
72
|
-
const onMMove = (ev: any) => {
|
|
73
|
-
dom.value = `Moving: x: ${ev.clientX}, y: ${ev.clientY}`;
|
|
74
|
-
};
|
|
75
|
-
const dom = new HtmlVar('');
|
|
76
|
-
return (
|
|
77
|
-
<div style={{ border: 'solid 1px red' }} class='row-box p-m' onMouseMove={onMMove}>
|
|
78
|
-
<button onClick={onClick} class='button-base'>
|
|
79
|
-
Move your mouse
|
|
80
|
-
</button>
|
|
81
|
-
<div class='pt-m'>{dom.node}</div>
|
|
82
|
-
</div>
|
|
83
|
-
);
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
// You can use defaultMessageHub, or use the sample here
|
|
87
|
-
type CommunicationProps = {
|
|
88
|
-
update: {
|
|
89
|
-
send: (obj: { id: string; message: string }) => { status: 'ok' | 'error'; message: string };
|
|
90
|
-
receive?: (obj: { id: string; message: string }) => { status: 'ok' | 'error'; message: string };
|
|
91
|
-
};
|
|
92
|
-
};
|
|
93
|
-
const TestCommunication = (props: CommunicationProps) => {
|
|
94
|
-
const onInput = async (ev: any) => {
|
|
95
|
-
const msg = ev.target.value;
|
|
96
|
-
const response = props.update.send({ id: 'msg', message: msg });
|
|
97
|
-
dom.value = `response, status: ${response.status}, msg: ${response.message}`;
|
|
98
|
-
};
|
|
99
|
-
props.update.receive = (obj: { id: string; message: string }) => {
|
|
100
|
-
dom.value = `received message, id: ${obj.id}, msg: ${obj.message}`;
|
|
101
|
-
return { status: 'ok', message: 'echo: ' + obj.message };
|
|
102
|
-
};
|
|
103
|
-
const dom = new HtmlVar('');
|
|
104
|
-
return (
|
|
105
|
-
<div>
|
|
106
|
-
<div class='row-box pt-m'>
|
|
107
|
-
<label class='pr-m'>Send Message: </label>
|
|
108
|
-
<input class='input-base' type='input' onInput={onInput} />
|
|
109
|
-
</div>
|
|
110
|
-
<div class='row-box pt-m'>
|
|
111
|
-
<label class='pr-m'>Received Message: </label>
|
|
112
|
-
<div class='pl-m'>{dom.node}</div>
|
|
113
|
-
</div>
|
|
114
|
-
</div>
|
|
115
|
-
);
|
|
116
|
-
};
|
|
117
|
-
|
|
118
|
-
const TestHtmlVar = () => {
|
|
119
|
-
let count = 0;
|
|
120
|
-
const onClick = () => {
|
|
121
|
-
count++;
|
|
122
|
-
dom.value = defaultContent();
|
|
123
|
-
};
|
|
124
|
-
const defaultContent = () => {
|
|
125
|
-
// <></> is not needed, and here is used to test that <fragment> tag is not added
|
|
126
|
-
return (
|
|
127
|
-
<>
|
|
128
|
-
<div class='row-box pt-m'>
|
|
129
|
-
<label class='pr-m'>Count: {count}</label>
|
|
130
|
-
<button class='button-base' onClick={onClick}>
|
|
131
|
-
Click me
|
|
132
|
-
</button>
|
|
133
|
-
</div>
|
|
134
|
-
</>
|
|
135
|
-
);
|
|
136
|
-
};
|
|
137
|
-
const dom = new HtmlVar(defaultContent());
|
|
138
|
-
const css: CssProps = {
|
|
139
|
-
backgroundColor: '#a1ffe8',
|
|
140
|
-
padding: '10px',
|
|
141
|
-
};
|
|
142
|
-
const ref: RefProps = {};
|
|
143
|
-
return (
|
|
144
|
-
<div ref={ref} css={css}>
|
|
145
|
-
{dom.node}
|
|
146
|
-
</div>
|
|
147
|
-
);
|
|
148
|
-
};
|
|
149
|
-
|
|
150
|
-
const TestMountInnerComponent = () => {
|
|
151
|
-
let count = 0;
|
|
152
|
-
const css: CssProps = {
|
|
153
|
-
backgroundColor: '#a1ffa7',
|
|
154
|
-
padding: '10px',
|
|
155
|
-
};
|
|
156
|
-
const ref: RefProps = {};
|
|
157
|
-
const onClick = () => {
|
|
158
|
-
count++;
|
|
159
|
-
ref.mountInnerComponent!(defaultContent());
|
|
160
|
-
};
|
|
161
|
-
const defaultContent = () => {
|
|
162
|
-
// <></> is not needed, and here is used to test that <fragment> tag is not added
|
|
163
|
-
return (
|
|
164
|
-
<>
|
|
165
|
-
<div class='row-box pt-m'>
|
|
166
|
-
<label class='pr-m'>Count: {count}</label>
|
|
167
|
-
<button class='button-base' onClick={onClick}>
|
|
168
|
-
Click me
|
|
169
|
-
</button>
|
|
170
|
-
</div>
|
|
171
|
-
</>
|
|
172
|
-
);
|
|
173
|
-
};
|
|
174
|
-
return (
|
|
175
|
-
<div ref={ref} css={css}>
|
|
176
|
-
{defaultContent()}
|
|
177
|
-
</div>
|
|
178
|
-
);
|
|
179
|
-
};
|
|
180
|
-
|
|
181
|
-
const TestStyles = () => {
|
|
182
|
-
const css: any = {
|
|
183
|
-
color: 'blue',
|
|
184
|
-
border: '1px solid red',
|
|
185
|
-
'font-size': 20,
|
|
186
|
-
'@keyframes spin': {
|
|
187
|
-
'0%': {
|
|
188
|
-
textShadow: '5px 5px 0 #ff005e, 5px 5px 0 #00d4ff',
|
|
189
|
-
},
|
|
190
|
-
'50%': {
|
|
191
|
-
textShadow: '-5px -5px 0 #00d4ff, -5px -5px 0 #ff005e',
|
|
192
|
-
},
|
|
193
|
-
},
|
|
194
|
-
'.text, .text2': {
|
|
195
|
-
'font-size': '15px',
|
|
196
|
-
animation: 'spin 5s infinite',
|
|
197
|
-
},
|
|
198
|
-
'.text2:hover': {
|
|
199
|
-
color: 'red',
|
|
200
|
-
border: '1px solid green',
|
|
201
|
-
'font-size': '15px',
|
|
202
|
-
},
|
|
203
|
-
'@media screen and (min-width: 768px)': {
|
|
204
|
-
'.text, .text2': {
|
|
205
|
-
color: 'blue',
|
|
206
|
-
'font-size': '20px',
|
|
207
|
-
},
|
|
208
|
-
},
|
|
209
|
-
'@media screen and (min-width: 1024px)': {
|
|
210
|
-
'.text': {
|
|
211
|
-
color: 'orange',
|
|
212
|
-
'font-size': '30px',
|
|
213
|
-
},
|
|
214
|
-
},
|
|
215
|
-
};
|
|
216
|
-
let ref: RefProps = { id: '' };
|
|
217
|
-
const onClick = () => {
|
|
218
|
-
css.color = css.color === 'blue' ? 'green' : 'blue';
|
|
219
|
-
updateStyles(`${ref.id}`, css);
|
|
220
|
-
console.log(`update styles`, css.color, css);
|
|
221
|
-
};
|
|
222
|
-
return (
|
|
223
|
-
<div ref={ref} css={css} style='padding:10px;' class='pt-m' onClick={onClick}>
|
|
224
|
-
Click to change styles, <span class='text'>Change window's width, </span>
|
|
225
|
-
<span class='text2'>Move mouse to here</span>
|
|
226
|
-
</div>
|
|
227
|
-
);
|
|
228
|
-
};
|
|
229
|
-
|
|
230
|
-
const TestProgress = () => {
|
|
231
|
-
const progressHook: ProgressHookProps = {};
|
|
232
|
-
return (
|
|
233
|
-
<div>
|
|
234
|
-
<div class='row-box mb-s'>
|
|
235
|
-
<Progress hook={progressHook} />
|
|
236
|
-
</div>
|
|
237
|
-
<button
|
|
238
|
-
class='button-base button-m m-m'
|
|
239
|
-
onClick={async () => {
|
|
240
|
-
progressHook.onShow?.(true, 'Test Progress');
|
|
241
|
-
for (let i = 0; i < 100; i++) {
|
|
242
|
-
progressHook.onProgress?.(i / 100, 1, 1);
|
|
243
|
-
await new Promise((resolve) => setTimeout(resolve, 10));
|
|
244
|
-
}
|
|
245
|
-
progressHook.onShow?.(false);
|
|
246
|
-
}}
|
|
247
|
-
>
|
|
248
|
-
Test Progress
|
|
249
|
-
</button>
|
|
250
|
-
</div>
|
|
251
|
-
);
|
|
252
|
-
};
|
|
253
|
-
|
|
254
|
-
export const AdminTestAnimationsPage = () => {
|
|
255
|
-
const msg1: CommunicationProps = {
|
|
256
|
-
update: {
|
|
257
|
-
send: (obj: { id: string; message: string }) => {
|
|
258
|
-
return msg2.update.receive!(obj);
|
|
259
|
-
},
|
|
260
|
-
},
|
|
261
|
-
};
|
|
262
|
-
const msg2: CommunicationProps = {
|
|
263
|
-
update: {
|
|
264
|
-
send: (obj: { id: string; message: string }) => {
|
|
265
|
-
return msg1.update.receive!(obj);
|
|
266
|
-
},
|
|
267
|
-
},
|
|
268
|
-
};
|
|
269
|
-
return (
|
|
270
|
-
<div>
|
|
271
|
-
<div>
|
|
272
|
-
<div>Test the Button's onClick event.</div>
|
|
273
|
-
<TestButton />
|
|
274
|
-
</div>
|
|
275
|
-
<div class='pt-m'>
|
|
276
|
-
<br />
|
|
277
|
-
<hr />
|
|
278
|
-
<br />
|
|
279
|
-
<div>Test the Input's onChange event.</div>
|
|
280
|
-
<TestInput />
|
|
281
|
-
</div>
|
|
282
|
-
<div class='pt-m'>
|
|
283
|
-
<br />
|
|
284
|
-
<hr />
|
|
285
|
-
<br />
|
|
286
|
-
<div>Test Mouse event.</div>
|
|
287
|
-
<TestMouse />
|
|
288
|
-
</div>
|
|
289
|
-
<div class='pt-m'>
|
|
290
|
-
<br />
|
|
291
|
-
<hr />
|
|
292
|
-
<br />
|
|
293
|
-
<div>Test Communication between components.</div>
|
|
294
|
-
<TestCommunication update={msg1.update} />
|
|
295
|
-
<TestCommunication update={msg2.update} />
|
|
296
|
-
</div>
|
|
297
|
-
|
|
298
|
-
<div class='pt-m'>
|
|
299
|
-
<br />
|
|
300
|
-
<hr />
|
|
301
|
-
<br />
|
|
302
|
-
<div>Test HtmlVar</div>
|
|
303
|
-
<TestHtmlVar />
|
|
304
|
-
</div>
|
|
305
|
-
|
|
306
|
-
<div class='pt-m'>
|
|
307
|
-
<br />
|
|
308
|
-
<hr />
|
|
309
|
-
<br />
|
|
310
|
-
<div>Test mountInnerComponent</div>
|
|
311
|
-
<TestMountInnerComponent />
|
|
312
|
-
</div>
|
|
313
|
-
|
|
314
|
-
<div class='pt-m'>
|
|
315
|
-
<br />
|
|
316
|
-
<hr />
|
|
317
|
-
<br />
|
|
318
|
-
<div>Test Style.</div>
|
|
319
|
-
<TestStyles />
|
|
320
|
-
</div>
|
|
321
|
-
<div class='pt-m'>
|
|
322
|
-
<br />
|
|
323
|
-
<hr />
|
|
324
|
-
<br />
|
|
325
|
-
<div>Test Text Glow.</div>
|
|
326
|
-
<TextGlow text='This is a sample of Text Glow' />
|
|
327
|
-
</div>
|
|
328
|
-
<div class='pt-m'>
|
|
329
|
-
<br />
|
|
330
|
-
<hr />
|
|
331
|
-
<br />
|
|
332
|
-
<div>Test Text Wave.</div>
|
|
333
|
-
<TextWave text='This is a sample of Text Wave' />
|
|
334
|
-
</div>
|
|
335
|
-
|
|
336
|
-
<div class='pt-m'>
|
|
337
|
-
TextScale
|
|
338
|
-
<TextScale text='This is a sample of Text Scale' />
|
|
339
|
-
</div>
|
|
340
|
-
|
|
341
|
-
<div class='pt-m'>
|
|
342
|
-
TogglePlayButton
|
|
343
|
-
<TogglePlayButton size={TogglePlayButtonSize.Small} />
|
|
344
|
-
<TogglePlayButton size={TogglePlayButtonSize.Medium} />
|
|
345
|
-
<TogglePlayButton size={TogglePlayButtonSize.Large} />
|
|
346
|
-
</div>
|
|
347
|
-
|
|
348
|
-
<div class='pt-m'>
|
|
349
|
-
ToggleButton
|
|
350
|
-
<ToggleButton onText='On' offText='Off' />
|
|
351
|
-
</div>
|
|
352
|
-
|
|
353
|
-
<div class='p2'>
|
|
354
|
-
<div class='row-box mb-s'>
|
|
355
|
-
<Spinner01 size={SpinnerSize.Small} />
|
|
356
|
-
<Spinner01 size={SpinnerSize.Medium} />
|
|
357
|
-
<Spinner01 size={SpinnerSize.Large} />
|
|
358
|
-
<Spinner01 size={SpinnerSize.LargeLarge} />
|
|
359
|
-
</div>
|
|
360
|
-
<div class='row-box mb-s'>
|
|
361
|
-
<Spinner02 size={SpinnerSize.Small} />
|
|
362
|
-
<Spinner02 size={SpinnerSize.Medium} />
|
|
363
|
-
<Spinner02 size={SpinnerSize.Large} />
|
|
364
|
-
<Spinner02 size={SpinnerSize.LargeLarge} />
|
|
365
|
-
</div>
|
|
366
|
-
<div class='row-box mb-s'>
|
|
367
|
-
<Spinner03 size={SpinnerSize.Small} />
|
|
368
|
-
<Spinner03 size={SpinnerSize.Medium} />
|
|
369
|
-
<Spinner03 size={SpinnerSize.Large} />
|
|
370
|
-
<Spinner03 size={SpinnerSize.LargeLarge} />
|
|
371
|
-
</div>
|
|
372
|
-
|
|
373
|
-
<div class='row-box mb-s'>
|
|
374
|
-
<ButtonPushAnimation text='Test ButtonPushAnimation' size={ButtonPushAnimationSize.SmallSmall} />
|
|
375
|
-
</div>
|
|
376
|
-
<div class='row-box mb-s'>
|
|
377
|
-
<ButtonPushAnimation text='Test ButtonPushAnimation' size={ButtonPushAnimationSize.Small} />
|
|
378
|
-
</div>
|
|
379
|
-
<div class='row-box mb-s'>
|
|
380
|
-
<ButtonPushAnimation text='Test ButtonPushAnimation' size={ButtonPushAnimationSize.Medium} />
|
|
381
|
-
</div>
|
|
382
|
-
<div class='row-box mb-s'>
|
|
383
|
-
<ButtonPushAnimation text='Test ButtonPushAnimation' size={ButtonPushAnimationSize.Large} />
|
|
384
|
-
</div>
|
|
385
|
-
<div class='row-box mb-s'>
|
|
386
|
-
<ButtonPushAnimation text='Test ButtonPushAnimation' size={ButtonPushAnimationSize.LargeLarge} />
|
|
387
|
-
</div>
|
|
388
|
-
|
|
389
|
-
<div class='row-box mb-s'>
|
|
390
|
-
<TestProgress />
|
|
391
|
-
</div>
|
|
392
|
-
</div>
|
|
393
|
-
</div>
|
|
394
|
-
);
|
|
395
|
-
};
|
|
1
|
+
import {
|
|
2
|
+
RefProps,
|
|
3
|
+
updateStyles,
|
|
4
|
+
ButtonPushAnimation,
|
|
5
|
+
ButtonPushAnimationSize,
|
|
6
|
+
HtmlVar,
|
|
7
|
+
Progress,
|
|
8
|
+
ProgressHookProps,
|
|
9
|
+
Spinner01,
|
|
10
|
+
Spinner02,
|
|
11
|
+
Spinner03,
|
|
12
|
+
SpinnerSize,
|
|
13
|
+
TextGlow,
|
|
14
|
+
TextWave,
|
|
15
|
+
CssProps,
|
|
16
|
+
ToggleButton,
|
|
17
|
+
TogglePlayButton,
|
|
18
|
+
TogglePlayButtonSize,
|
|
19
|
+
TextScale,
|
|
20
|
+
} from 'lupine.components';
|
|
21
|
+
|
|
22
|
+
const TestButton = () => {
|
|
23
|
+
const onClick = async () => {
|
|
24
|
+
dom.value = 'You clicked the button.';
|
|
25
|
+
};
|
|
26
|
+
const ref: RefProps = {
|
|
27
|
+
onLoad: async () => {
|
|
28
|
+
dom.value = 'This value is set in onLoad event.';
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
const dom = new HtmlVar('');
|
|
32
|
+
return (
|
|
33
|
+
<div ref={ref} class='row-box pt-m'>
|
|
34
|
+
<button onClick={onClick} class='button-base'>
|
|
35
|
+
Click me!
|
|
36
|
+
</button>
|
|
37
|
+
<div class='pl-m'>{dom.node}</div>
|
|
38
|
+
</div>
|
|
39
|
+
);
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
const TestInput = () => {
|
|
43
|
+
const onInput = async (ev?: any) => {
|
|
44
|
+
// you can get value from: ev.target.value
|
|
45
|
+
dom.value = 'Your input: ' + refInput.current.value;
|
|
46
|
+
};
|
|
47
|
+
const onClick = async () => {
|
|
48
|
+
refInput.current.value = '';
|
|
49
|
+
refInput.current.dispatchEvent(new Event('input'));
|
|
50
|
+
};
|
|
51
|
+
const dom = new HtmlVar('');
|
|
52
|
+
const refInput: RefProps = {};
|
|
53
|
+
return (
|
|
54
|
+
<div>
|
|
55
|
+
<div class='row-box pt-m'>
|
|
56
|
+
<input ref={refInput} class='input-base' type='input' onInput={onInput} />
|
|
57
|
+
<div class='pl-m'>{dom.node}</div>
|
|
58
|
+
</div>
|
|
59
|
+
<div class='row-box pt-m'>
|
|
60
|
+
<button onClick={onClick} class='button-base'>
|
|
61
|
+
Clear Input Value
|
|
62
|
+
</button>
|
|
63
|
+
</div>
|
|
64
|
+
</div>
|
|
65
|
+
);
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
const TestMouse = () => {
|
|
69
|
+
const onClick = (ev: any) => {
|
|
70
|
+
dom.value = `Clicked: x: ${ev.clientX}, y: ${ev.clientY}`;
|
|
71
|
+
};
|
|
72
|
+
const onMMove = (ev: any) => {
|
|
73
|
+
dom.value = `Moving: x: ${ev.clientX}, y: ${ev.clientY}`;
|
|
74
|
+
};
|
|
75
|
+
const dom = new HtmlVar('');
|
|
76
|
+
return (
|
|
77
|
+
<div style={{ border: 'solid 1px red' }} class='row-box p-m' onMouseMove={onMMove}>
|
|
78
|
+
<button onClick={onClick} class='button-base'>
|
|
79
|
+
Move your mouse
|
|
80
|
+
</button>
|
|
81
|
+
<div class='pt-m'>{dom.node}</div>
|
|
82
|
+
</div>
|
|
83
|
+
);
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
// You can use defaultMessageHub, or use the sample here
|
|
87
|
+
type CommunicationProps = {
|
|
88
|
+
update: {
|
|
89
|
+
send: (obj: { id: string; message: string }) => { status: 'ok' | 'error'; message: string };
|
|
90
|
+
receive?: (obj: { id: string; message: string }) => { status: 'ok' | 'error'; message: string };
|
|
91
|
+
};
|
|
92
|
+
};
|
|
93
|
+
const TestCommunication = (props: CommunicationProps) => {
|
|
94
|
+
const onInput = async (ev: any) => {
|
|
95
|
+
const msg = ev.target.value;
|
|
96
|
+
const response = props.update.send({ id: 'msg', message: msg });
|
|
97
|
+
dom.value = `response, status: ${response.status}, msg: ${response.message}`;
|
|
98
|
+
};
|
|
99
|
+
props.update.receive = (obj: { id: string; message: string }) => {
|
|
100
|
+
dom.value = `received message, id: ${obj.id}, msg: ${obj.message}`;
|
|
101
|
+
return { status: 'ok', message: 'echo: ' + obj.message };
|
|
102
|
+
};
|
|
103
|
+
const dom = new HtmlVar('');
|
|
104
|
+
return (
|
|
105
|
+
<div>
|
|
106
|
+
<div class='row-box pt-m'>
|
|
107
|
+
<label class='pr-m'>Send Message: </label>
|
|
108
|
+
<input class='input-base' type='input' onInput={onInput} />
|
|
109
|
+
</div>
|
|
110
|
+
<div class='row-box pt-m'>
|
|
111
|
+
<label class='pr-m'>Received Message: </label>
|
|
112
|
+
<div class='pl-m'>{dom.node}</div>
|
|
113
|
+
</div>
|
|
114
|
+
</div>
|
|
115
|
+
);
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
const TestHtmlVar = () => {
|
|
119
|
+
let count = 0;
|
|
120
|
+
const onClick = () => {
|
|
121
|
+
count++;
|
|
122
|
+
dom.value = defaultContent();
|
|
123
|
+
};
|
|
124
|
+
const defaultContent = () => {
|
|
125
|
+
// <></> is not needed, and here is used to test that <fragment> tag is not added
|
|
126
|
+
return (
|
|
127
|
+
<>
|
|
128
|
+
<div class='row-box pt-m'>
|
|
129
|
+
<label class='pr-m'>Count: {count}</label>
|
|
130
|
+
<button class='button-base' onClick={onClick}>
|
|
131
|
+
Click me
|
|
132
|
+
</button>
|
|
133
|
+
</div>
|
|
134
|
+
</>
|
|
135
|
+
);
|
|
136
|
+
};
|
|
137
|
+
const dom = new HtmlVar(defaultContent());
|
|
138
|
+
const css: CssProps = {
|
|
139
|
+
backgroundColor: '#a1ffe8',
|
|
140
|
+
padding: '10px',
|
|
141
|
+
};
|
|
142
|
+
const ref: RefProps = {};
|
|
143
|
+
return (
|
|
144
|
+
<div ref={ref} css={css}>
|
|
145
|
+
{dom.node}
|
|
146
|
+
</div>
|
|
147
|
+
);
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
const TestMountInnerComponent = () => {
|
|
151
|
+
let count = 0;
|
|
152
|
+
const css: CssProps = {
|
|
153
|
+
backgroundColor: '#a1ffa7',
|
|
154
|
+
padding: '10px',
|
|
155
|
+
};
|
|
156
|
+
const ref: RefProps = {};
|
|
157
|
+
const onClick = () => {
|
|
158
|
+
count++;
|
|
159
|
+
ref.mountInnerComponent!(defaultContent());
|
|
160
|
+
};
|
|
161
|
+
const defaultContent = () => {
|
|
162
|
+
// <></> is not needed, and here is used to test that <fragment> tag is not added
|
|
163
|
+
return (
|
|
164
|
+
<>
|
|
165
|
+
<div class='row-box pt-m'>
|
|
166
|
+
<label class='pr-m'>Count: {count}</label>
|
|
167
|
+
<button class='button-base' onClick={onClick}>
|
|
168
|
+
Click me
|
|
169
|
+
</button>
|
|
170
|
+
</div>
|
|
171
|
+
</>
|
|
172
|
+
);
|
|
173
|
+
};
|
|
174
|
+
return (
|
|
175
|
+
<div ref={ref} css={css}>
|
|
176
|
+
{defaultContent()}
|
|
177
|
+
</div>
|
|
178
|
+
);
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
const TestStyles = () => {
|
|
182
|
+
const css: any = {
|
|
183
|
+
color: 'blue',
|
|
184
|
+
border: '1px solid red',
|
|
185
|
+
'font-size': 20,
|
|
186
|
+
'@keyframes spin': {
|
|
187
|
+
'0%': {
|
|
188
|
+
textShadow: '5px 5px 0 #ff005e, 5px 5px 0 #00d4ff',
|
|
189
|
+
},
|
|
190
|
+
'50%': {
|
|
191
|
+
textShadow: '-5px -5px 0 #00d4ff, -5px -5px 0 #ff005e',
|
|
192
|
+
},
|
|
193
|
+
},
|
|
194
|
+
'.text, .text2': {
|
|
195
|
+
'font-size': '15px',
|
|
196
|
+
animation: 'spin 5s infinite',
|
|
197
|
+
},
|
|
198
|
+
'.text2:hover': {
|
|
199
|
+
color: 'red',
|
|
200
|
+
border: '1px solid green',
|
|
201
|
+
'font-size': '15px',
|
|
202
|
+
},
|
|
203
|
+
'@media screen and (min-width: 768px)': {
|
|
204
|
+
'.text, .text2': {
|
|
205
|
+
color: 'blue',
|
|
206
|
+
'font-size': '20px',
|
|
207
|
+
},
|
|
208
|
+
},
|
|
209
|
+
'@media screen and (min-width: 1024px)': {
|
|
210
|
+
'.text': {
|
|
211
|
+
color: 'orange',
|
|
212
|
+
'font-size': '30px',
|
|
213
|
+
},
|
|
214
|
+
},
|
|
215
|
+
};
|
|
216
|
+
let ref: RefProps = { id: '' };
|
|
217
|
+
const onClick = () => {
|
|
218
|
+
css.color = css.color === 'blue' ? 'green' : 'blue';
|
|
219
|
+
updateStyles(`${ref.id}`, css);
|
|
220
|
+
console.log(`update styles`, css.color, css);
|
|
221
|
+
};
|
|
222
|
+
return (
|
|
223
|
+
<div ref={ref} css={css} style='padding:10px;' class='pt-m' onClick={onClick}>
|
|
224
|
+
Click to change styles, <span class='text'>Change window's width, </span>
|
|
225
|
+
<span class='text2'>Move mouse to here</span>
|
|
226
|
+
</div>
|
|
227
|
+
);
|
|
228
|
+
};
|
|
229
|
+
|
|
230
|
+
const TestProgress = () => {
|
|
231
|
+
const progressHook: ProgressHookProps = {};
|
|
232
|
+
return (
|
|
233
|
+
<div>
|
|
234
|
+
<div class='row-box mb-s'>
|
|
235
|
+
<Progress hook={progressHook} />
|
|
236
|
+
</div>
|
|
237
|
+
<button
|
|
238
|
+
class='button-base button-m m-m'
|
|
239
|
+
onClick={async () => {
|
|
240
|
+
progressHook.onShow?.(true, 'Test Progress');
|
|
241
|
+
for (let i = 0; i < 100; i++) {
|
|
242
|
+
progressHook.onProgress?.(i / 100, 1, 1);
|
|
243
|
+
await new Promise((resolve) => setTimeout(resolve, 10));
|
|
244
|
+
}
|
|
245
|
+
progressHook.onShow?.(false);
|
|
246
|
+
}}
|
|
247
|
+
>
|
|
248
|
+
Test Progress
|
|
249
|
+
</button>
|
|
250
|
+
</div>
|
|
251
|
+
);
|
|
252
|
+
};
|
|
253
|
+
|
|
254
|
+
export const AdminTestAnimationsPage = () => {
|
|
255
|
+
const msg1: CommunicationProps = {
|
|
256
|
+
update: {
|
|
257
|
+
send: (obj: { id: string; message: string }) => {
|
|
258
|
+
return msg2.update.receive!(obj);
|
|
259
|
+
},
|
|
260
|
+
},
|
|
261
|
+
};
|
|
262
|
+
const msg2: CommunicationProps = {
|
|
263
|
+
update: {
|
|
264
|
+
send: (obj: { id: string; message: string }) => {
|
|
265
|
+
return msg1.update.receive!(obj);
|
|
266
|
+
},
|
|
267
|
+
},
|
|
268
|
+
};
|
|
269
|
+
return (
|
|
270
|
+
<div>
|
|
271
|
+
<div>
|
|
272
|
+
<div>Test the Button's onClick event.</div>
|
|
273
|
+
<TestButton />
|
|
274
|
+
</div>
|
|
275
|
+
<div class='pt-m'>
|
|
276
|
+
<br />
|
|
277
|
+
<hr />
|
|
278
|
+
<br />
|
|
279
|
+
<div>Test the Input's onChange event.</div>
|
|
280
|
+
<TestInput />
|
|
281
|
+
</div>
|
|
282
|
+
<div class='pt-m'>
|
|
283
|
+
<br />
|
|
284
|
+
<hr />
|
|
285
|
+
<br />
|
|
286
|
+
<div>Test Mouse event.</div>
|
|
287
|
+
<TestMouse />
|
|
288
|
+
</div>
|
|
289
|
+
<div class='pt-m'>
|
|
290
|
+
<br />
|
|
291
|
+
<hr />
|
|
292
|
+
<br />
|
|
293
|
+
<div>Test Communication between components.</div>
|
|
294
|
+
<TestCommunication update={msg1.update} />
|
|
295
|
+
<TestCommunication update={msg2.update} />
|
|
296
|
+
</div>
|
|
297
|
+
|
|
298
|
+
<div class='pt-m'>
|
|
299
|
+
<br />
|
|
300
|
+
<hr />
|
|
301
|
+
<br />
|
|
302
|
+
<div>Test HtmlVar</div>
|
|
303
|
+
<TestHtmlVar />
|
|
304
|
+
</div>
|
|
305
|
+
|
|
306
|
+
<div class='pt-m'>
|
|
307
|
+
<br />
|
|
308
|
+
<hr />
|
|
309
|
+
<br />
|
|
310
|
+
<div>Test mountInnerComponent</div>
|
|
311
|
+
<TestMountInnerComponent />
|
|
312
|
+
</div>
|
|
313
|
+
|
|
314
|
+
<div class='pt-m'>
|
|
315
|
+
<br />
|
|
316
|
+
<hr />
|
|
317
|
+
<br />
|
|
318
|
+
<div>Test Style.</div>
|
|
319
|
+
<TestStyles />
|
|
320
|
+
</div>
|
|
321
|
+
<div class='pt-m'>
|
|
322
|
+
<br />
|
|
323
|
+
<hr />
|
|
324
|
+
<br />
|
|
325
|
+
<div>Test Text Glow.</div>
|
|
326
|
+
<TextGlow text='This is a sample of Text Glow' />
|
|
327
|
+
</div>
|
|
328
|
+
<div class='pt-m'>
|
|
329
|
+
<br />
|
|
330
|
+
<hr />
|
|
331
|
+
<br />
|
|
332
|
+
<div>Test Text Wave.</div>
|
|
333
|
+
<TextWave text='This is a sample of Text Wave' />
|
|
334
|
+
</div>
|
|
335
|
+
|
|
336
|
+
<div class='pt-m'>
|
|
337
|
+
TextScale
|
|
338
|
+
<TextScale text='This is a sample of Text Scale' />
|
|
339
|
+
</div>
|
|
340
|
+
|
|
341
|
+
<div class='pt-m'>
|
|
342
|
+
TogglePlayButton
|
|
343
|
+
<TogglePlayButton size={TogglePlayButtonSize.Small} />
|
|
344
|
+
<TogglePlayButton size={TogglePlayButtonSize.Medium} />
|
|
345
|
+
<TogglePlayButton size={TogglePlayButtonSize.Large} />
|
|
346
|
+
</div>
|
|
347
|
+
|
|
348
|
+
<div class='pt-m'>
|
|
349
|
+
ToggleButton
|
|
350
|
+
<ToggleButton onText='On' offText='Off' />
|
|
351
|
+
</div>
|
|
352
|
+
|
|
353
|
+
<div class='p2'>
|
|
354
|
+
<div class='row-box mb-s'>
|
|
355
|
+
<Spinner01 size={SpinnerSize.Small} />
|
|
356
|
+
<Spinner01 size={SpinnerSize.Medium} />
|
|
357
|
+
<Spinner01 size={SpinnerSize.Large} />
|
|
358
|
+
<Spinner01 size={SpinnerSize.LargeLarge} />
|
|
359
|
+
</div>
|
|
360
|
+
<div class='row-box mb-s'>
|
|
361
|
+
<Spinner02 size={SpinnerSize.Small} />
|
|
362
|
+
<Spinner02 size={SpinnerSize.Medium} />
|
|
363
|
+
<Spinner02 size={SpinnerSize.Large} />
|
|
364
|
+
<Spinner02 size={SpinnerSize.LargeLarge} />
|
|
365
|
+
</div>
|
|
366
|
+
<div class='row-box mb-s'>
|
|
367
|
+
<Spinner03 size={SpinnerSize.Small} />
|
|
368
|
+
<Spinner03 size={SpinnerSize.Medium} />
|
|
369
|
+
<Spinner03 size={SpinnerSize.Large} />
|
|
370
|
+
<Spinner03 size={SpinnerSize.LargeLarge} />
|
|
371
|
+
</div>
|
|
372
|
+
|
|
373
|
+
<div class='row-box mb-s'>
|
|
374
|
+
<ButtonPushAnimation text='Test ButtonPushAnimation' size={ButtonPushAnimationSize.SmallSmall} />
|
|
375
|
+
</div>
|
|
376
|
+
<div class='row-box mb-s'>
|
|
377
|
+
<ButtonPushAnimation text='Test ButtonPushAnimation' size={ButtonPushAnimationSize.Small} />
|
|
378
|
+
</div>
|
|
379
|
+
<div class='row-box mb-s'>
|
|
380
|
+
<ButtonPushAnimation text='Test ButtonPushAnimation' size={ButtonPushAnimationSize.Medium} />
|
|
381
|
+
</div>
|
|
382
|
+
<div class='row-box mb-s'>
|
|
383
|
+
<ButtonPushAnimation text='Test ButtonPushAnimation' size={ButtonPushAnimationSize.Large} />
|
|
384
|
+
</div>
|
|
385
|
+
<div class='row-box mb-s'>
|
|
386
|
+
<ButtonPushAnimation text='Test ButtonPushAnimation' size={ButtonPushAnimationSize.LargeLarge} />
|
|
387
|
+
</div>
|
|
388
|
+
|
|
389
|
+
<div class='row-box mb-s'>
|
|
390
|
+
<TestProgress />
|
|
391
|
+
</div>
|
|
392
|
+
</div>
|
|
393
|
+
</div>
|
|
394
|
+
);
|
|
395
|
+
};
|