gbpptx 0.2.0 → 0.3.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.
- package/README.md +220 -214
- package/package.json +4 -3
- package/src/kernel/model.js +1 -2
- package/src/kernel/parts.js +11 -15
- package/src/kernel/print.js +14 -16
- package/web/app/main.js +8 -8
- package/web/app/slides/arrange.js +101 -0
- package/web/app/slides/clipboard.js +93 -0
- package/web/app/slides/file.js +243 -0
- package/web/app/slides/find.js +199 -0
- package/web/app/slides/history.js +100 -0
- package/web/app/slides/keys.js +174 -0
- package/web/app/slides/menus.js +105 -0
- package/web/app/slides/objects.js +254 -0
- package/web/app/slides/render.js +183 -0
- package/web/app/slides/shared.js +85 -0
- package/web/app/slides/slides.js +103 -0
- package/web/app/slides/table.js +102 -0
- package/web/app/slides/text.js +418 -0
- package/web/app/slides/view.js +130 -0
- package/web/app/slides-app.js +285 -2446
- package/web/app/ui/backstage.js +255 -255
- package/web/app/ui/canvas.js +762 -755
- package/web/app/ui/color-panel.js +58 -76
- package/web/app/ui/dialogs.js +120 -159
- package/web/app/ui/file-io.js +116 -132
- package/web/app/ui/format-pane.js +427 -427
- package/web/app/ui/icons.js +129 -129
- package/web/app/ui/menu.js +75 -89
- package/web/app/ui/notify.js +45 -45
- package/web/app/ui/page-view.js +221 -221
- package/web/app/ui/popup.js +80 -80
- package/web/app/ui/present.js +292 -292
- package/web/app/ui/ribbon.js +878 -878
- package/web/app/ui/slide-pane.js +189 -189
- package/web/app/ui/statusbar.js +93 -93
- package/web/app/ui/text-styles.js +84 -84
- package/web/app/ui/titlebar.js +173 -66
- package/web/app/ui/transition.js +30 -30
- package/web/index.html +23 -22
- package/web/serve.mjs +20 -67
- package/web/styles/office.css +642 -644
- package/web/styles/slides.css +210 -219
- package/web/styles/tokens.css +154 -155
- package/src/kernel/util/escape.js +0 -21
- package/src/kernel/util/id.js +0 -13
package/web/serve.mjs
CHANGED
|
@@ -1,67 +1,20 @@
|
|
|
1
|
-
// [文件] gbpptx·serve ——
|
|
2
|
-
// 用法:node web/serve.mjs [端口] → http://localhost:5274/web/
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
'.png': 'image/png',
|
|
22
|
-
'.webp': 'image/webp',
|
|
23
|
-
'.ico': 'image/x-icon',
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
function resolvePath(urlPath) {
|
|
27
|
-
const decoded = decodeURIComponent(urlPath.split('?')[0]);
|
|
28
|
-
if (decoded.startsWith('/vendor/gbooxml/')) {
|
|
29
|
-
const rest = decoded.slice('/vendor/gbooxml/'.length);
|
|
30
|
-
const target = normalize(join(OOXML_ROOT, rest));
|
|
31
|
-
return target.startsWith(OOXML_ROOT + sep) || target === OOXML_ROOT ? target : null;
|
|
32
|
-
}
|
|
33
|
-
const rest = decoded === '/' ? 'web/index.html' : decoded.replace(/^\/+/, '');
|
|
34
|
-
const target = normalize(join(ROOT, rest));
|
|
35
|
-
return target.startsWith(ROOT) ? target : null;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
const server = createServer(async (req, res) => {
|
|
39
|
-
let target = resolvePath(req.url || '/');
|
|
40
|
-
try {
|
|
41
|
-
if (!target) throw new Error('forbidden');
|
|
42
|
-
let info = await stat(target).catch(() => null);
|
|
43
|
-
if (info?.isDirectory()) {
|
|
44
|
-
target = join(target, 'index.html');
|
|
45
|
-
info = await stat(target).catch(() => null);
|
|
46
|
-
}
|
|
47
|
-
if (!info?.isFile()) {
|
|
48
|
-
res.writeHead(404, { 'Content-Type': 'text/plain; charset=utf-8' });
|
|
49
|
-
res.end('404 Not Found');
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
52
|
-
const body = await readFile(target);
|
|
53
|
-
res.writeHead(200, {
|
|
54
|
-
'Content-Type': MIME[extname(target).toLowerCase()] || 'application/octet-stream',
|
|
55
|
-
'Cache-Control': 'no-store',
|
|
56
|
-
});
|
|
57
|
-
res.end(body);
|
|
58
|
-
} catch (err) {
|
|
59
|
-
res.writeHead(500, { 'Content-Type': 'text/plain; charset=utf-8' });
|
|
60
|
-
res.end(`500 ${err.message}`);
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
server.listen(PORT, () => {
|
|
65
|
-
console.log(`gbpptx 运行中:http://localhost:${PORT}/web/`);
|
|
66
|
-
console.log(`gbOoxml 映射自:${OOXML_ROOT}`);
|
|
67
|
-
});
|
|
1
|
+
// [文件] gbpptx·serve —— 静态服务器(包根为 URL 空间根:/web/ 为应用,/vendor/* 映射到同仓源码包)
|
|
2
|
+
// 用法:node web/serve.mjs [端口] → http://localhost:5274/web/
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
4
|
+
import { startStaticServer } from 'guabiutils/dev-server';
|
|
5
|
+
|
|
6
|
+
const ooxmlSrc = fileURLToPath(new URL('../../gbooxml/src/', import.meta.url));
|
|
7
|
+
const utilsSrc = fileURLToPath(new URL('../../guabiutils/src/', import.meta.url));
|
|
8
|
+
|
|
9
|
+
const { origin } = await startStaticServer({
|
|
10
|
+
root: fileURLToPath(new URL('..', import.meta.url)),
|
|
11
|
+
index: 'web/index.html',
|
|
12
|
+
port: Number(process.argv[2] || process.env.GBPPTX_PORT || 5274),
|
|
13
|
+
mounts: [
|
|
14
|
+
{ prefix: '/vendor/gbooxml/', dir: ooxmlSrc },
|
|
15
|
+
{ prefix: '/vendor/guabiutils/', dir: utilsSrc },
|
|
16
|
+
],
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
console.log(`gbpptx 运行中:${origin}/web/`);
|
|
20
|
+
console.log(`gbooxml 映射自:${ooxmlSrc}`);
|