kempo 3.2.1 → 4.2.0

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.
Files changed (39) hide show
  1. package/dist/components/Component.js +1 -1
  2. package/dist/components/Dialog.js +1 -1
  3. package/dist/components/LazyComponent.js +1 -1
  4. package/dist/components/Split.js +1 -1
  5. package/dist/components/Toast.js +1 -0
  6. package/dist/utils/Server.js +1 -0
  7. package/dist/utils/drag.js +1 -1
  8. package/dist/utils/fs-utils.js +1 -0
  9. package/dist/utils/minify.js +1 -0
  10. package/dist/utils/watchWindowSize.js +1 -0
  11. package/docs/components/split.html +19 -0
  12. package/docs/components/toast.html +330 -0
  13. package/docs/icons/error.svg +1 -0
  14. package/docs/icons/warning.svg +1 -0
  15. package/docs/kempo/components/Component.js +1 -1
  16. package/docs/kempo/components/Dialog.js +1 -1
  17. package/docs/kempo/components/LazyComponent.js +1 -1
  18. package/docs/kempo/components/Split.js +1 -1
  19. package/docs/kempo/components/Toast.js +1 -0
  20. package/docs/kempo/utils/Server.js +1 -0
  21. package/docs/kempo/utils/drag.js +1 -1
  22. package/docs/kempo/utils/fs-utils.js +1 -0
  23. package/docs/kempo/utils/minify.js +1 -0
  24. package/docs/kempo/utils/watchWindowSize.js +1 -0
  25. package/docs/nav.inc.html +2 -1
  26. package/docs/utils/Server.html +119 -0
  27. package/icons/error.svg +1 -0
  28. package/icons/warning.svg +1 -0
  29. package/package.json +2 -4
  30. package/scripts/build.js +8 -8
  31. package/scripts/docs.js +20 -20
  32. package/src/components/Dialog.js +11 -1
  33. package/src/components/Split.js +38 -13
  34. package/src/components/Toast.js +424 -0
  35. package/src/utils/Server.js +189 -0
  36. package/src/utils/fs-utils.js +41 -0
  37. package/src/utils/watchWindowSize.js +15 -0
  38. package/test/index.js +27 -16
  39. package/scripts/test.js +0 -31
package/test/index.js CHANGED
@@ -1,25 +1,36 @@
1
- import express from 'express';
1
+ import { Server } from '../src/utils/Server.js';
2
2
  import fs from 'fs/promises';
3
- import path from 'path';
4
3
  import cli from '../src/utils/cli.js';
5
4
 
6
5
  const {
7
- port = 8084
6
+ port = 8084
8
7
  } = cli();
9
8
 
10
- const app = express();
9
+ const server = new Server();
11
10
 
12
- app.use(express.static('test'));
13
- app.use('/kempo', express.static('kempo'));
14
- app.get('/api/tests', async (_, res) => {
15
- const tests = {};
16
- const categories = await fs.readdir('./test/tests/');
17
- for(let i = 0; i < categories.length; i++){
18
- tests[categories[i]] = (await fs.readdir(`./test/tests/${categories[i]}/`)).map( t => t.slice(0, t.length - 8));
19
- }
20
- res.json(tests);
21
- });
11
+ server
12
+ .static('/', './test')
13
+ .static('/kempo', './kempo')
14
+ .get('/api/tests', async (req, res) => {
15
+ try {
16
+ const tests = {};
17
+ const categories = await fs.readdir('./test/tests/');
18
+ for(let i = 0; i < categories.length; i++){
19
+ tests[categories[i]] = (await fs.readdir(`./test/tests/${categories[i]}/`))
20
+ .map(t => t.slice(0, t.length - 8));
21
+ }
22
+ res.writeHead(200, { 'Content-Type': 'application/json' });
23
+ res.end(JSON.stringify(tests));
24
+ } catch (err) {
25
+ res.writeHead(500, { 'Content-Type': 'application/json' });
26
+ res.end(JSON.stringify({ error: err.message }));
27
+ }
28
+ });
22
29
 
23
- app.listen(port, () => {
30
+ try {
31
+ await server.listen(port);
24
32
  console.log(`Tests Running on: http://localhost:${port}`);
25
- });
33
+ } catch (err) {
34
+ console.error('Failed to start server:', err.message);
35
+ process.exit(1);
36
+ }
package/scripts/test.js DELETED
@@ -1,31 +0,0 @@
1
- import express from 'express';
2
- import { dirname, join } from 'path';
3
- import { fileURLToPath } from 'url';
4
- import {
5
- getArgs,
6
- runChildNodeProcess
7
- } from '../src/utils/cli.js';
8
-
9
- const __filename = fileURLToPath(import.meta.url);
10
- const __dirname = dirname(__filename);
11
-
12
- const options = getArgs({
13
- p: 'port',
14
- b: 'build',
15
- s: 'src'
16
- });
17
-
18
- const {
19
- port = 8084,
20
- build = true
21
- } = options;
22
-
23
- const app = express();
24
-
25
- app.use('/kempo', express.static('src'));
26
- app.use('/icons', express.static('icons'));
27
- app.use(express.static('test'));
28
-
29
- app.listen(port, () => {
30
- console.log(`Docs Running on: http://localhost:${port}`);
31
- });