gbpptx 0.1.0 → 0.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.
- package/README.md +214 -0
- package/package.json +14 -4
- package/src/index.js +16 -8
- package/src/kernel/model.js +396 -89
- package/src/kernel/parts.js +15 -11
- package/src/kernel/pptx.js +17 -12
- package/src/kernel/print.js +16 -14
- package/src/kernel/read.js +747 -157
- package/src/kernel/roundtrip.js +123 -19
- package/src/kernel/text.js +133 -28
- package/src/kernel/write.js +160 -49
- package/web/app/slides-app.js +2079 -477
- package/web/app/ui/backstage.js +255 -0
- package/web/app/ui/canvas.js +619 -141
- package/web/app/ui/color-panel.js +27 -9
- package/web/app/ui/dialogs.js +42 -3
- package/web/app/ui/file-io.js +66 -23
- package/web/app/ui/format-pane.js +427 -0
- package/web/app/ui/icons.js +129 -0
- package/web/app/ui/menu.js +26 -42
- package/web/app/ui/page-view.js +135 -64
- package/web/app/ui/present.js +257 -65
- package/web/app/ui/ribbon.js +878 -0
- package/web/app/ui/slide-pane.js +189 -0
- package/web/app/ui/statusbar.js +93 -0
- package/web/app/ui/titlebar.js +101 -0
- package/web/app/ui/transition.js +30 -0
- package/web/index.html +1 -0
- package/web/serve.mjs +1 -1
- package/web/styles/office.css +644 -0
- package/web/styles/slides.css +184 -177
- package/src/kernel/menus.js +0 -123
- package/web/app/ui/inspector.js +0 -209
- package/web/app/ui/slides-bar.js +0 -63
- package/web/app/ui/toolbar.js +0 -200
package/web/styles/slides.css
CHANGED
|
@@ -1,212 +1,219 @@
|
|
|
1
|
-
/* [文件] gbpptx
|
|
1
|
+
/* [文件] gbpptx·幻灯片渲染与通用控件(页/对象/选中框/浮层/菜单/色板/模态/通知) */
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
body {
|
|
5
|
-
color: var(--dt-text);
|
|
6
|
-
background: var(--dt-bg-2);
|
|
7
|
-
font-family: 'Microsoft YaHei', -apple-system, 'Segoe UI', sans-serif;
|
|
8
|
-
font-size: 14px;
|
|
9
|
-
}
|
|
10
|
-
#app { height: 100%; min-height: 0; }
|
|
11
|
-
button { font-family: inherit; font-size: inherit; color: inherit; }
|
|
12
|
-
|
|
13
|
-
/* ==================== 外壳 ==================== */
|
|
3
|
+
[hidden] { display: none !important; }
|
|
14
4
|
|
|
15
|
-
|
|
16
|
-
.sl-head {
|
|
17
|
-
display: flex; align-items: center; gap: 8px;
|
|
18
|
-
padding: 4px 10px; border-bottom: 1px solid var(--dt-border); font-size: 13px;
|
|
19
|
-
}
|
|
20
|
-
.sl-head__title { font-weight: 600; }
|
|
21
|
-
.sl-head__path { color: var(--dt-text-tertiary); font-size: 12px; }
|
|
22
|
-
.sl-head__dirty { color: var(--dt-warning); }
|
|
23
|
-
.sl-head__spacer { flex: 1; }
|
|
24
|
-
.sl-head__auto { display: inline-flex; align-items: center; gap: 4px; color: var(--dt-text-secondary); font-size: 12px; cursor: pointer; }
|
|
5
|
+
/* ==================== 幻灯片页与对象 ==================== */
|
|
25
6
|
|
|
26
|
-
.sl-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
7
|
+
.sl-page {
|
|
8
|
+
position: relative;
|
|
9
|
+
width: 960px;
|
|
10
|
+
height: 540px;
|
|
11
|
+
overflow: hidden;
|
|
12
|
+
background: #fff;
|
|
13
|
+
color: #202124;
|
|
14
|
+
user-select: none;
|
|
15
|
+
font-family: 'Microsoft YaHei', 'Segoe UI', sans-serif;
|
|
31
16
|
}
|
|
32
|
-
.sl-
|
|
33
|
-
.sl-
|
|
34
|
-
.sl-
|
|
35
|
-
|
|
36
|
-
|
|
17
|
+
.sl-obj { position: absolute; box-sizing: border-box; }
|
|
18
|
+
.sl-obj[contenteditable='true'] { user-select: text; }
|
|
19
|
+
.sl-obj--shape { display: flex; align-items: stretch; }
|
|
20
|
+
.sl-obj--shape > .sl-shape-svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
|
|
21
|
+
.sl-obj--shape .sl-shape-text {
|
|
22
|
+
position: relative; z-index: 1; width: 100%; height: 100%; box-sizing: border-box;
|
|
23
|
+
padding: 6px 8px; display: flex; flex-direction: column; white-space: pre-wrap;
|
|
24
|
+
word-break: break-word; overflow: hidden;
|
|
37
25
|
}
|
|
38
|
-
.sl-
|
|
39
|
-
.sl-
|
|
40
|
-
|
|
41
|
-
|
|
26
|
+
.sl-obj--shape .sl-shape-text > div { min-height: .1em; }
|
|
27
|
+
.sl-obj--image img { display: block; width: 100%; height: 100%; }
|
|
28
|
+
.sl-obj--image { overflow: hidden; }
|
|
29
|
+
.sl-obj--line > .sl-line-svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
|
|
30
|
+
.sl-obj.has-shadow .sl-shape-svg path,
|
|
31
|
+
.sl-obj.has-shadow > img { filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.35)); }
|
|
32
|
+
|
|
33
|
+
.sl-textbox { width: 100%; height: 100%; box-sizing: border-box; }
|
|
34
|
+
.sl-text {
|
|
35
|
+
width: 100%; box-sizing: border-box; outline: none; white-space: pre-wrap;
|
|
36
|
+
word-break: break-word; overflow-wrap: anywhere; user-select: none;
|
|
42
37
|
}
|
|
43
|
-
.sl-
|
|
44
|
-
.sl-
|
|
38
|
+
.sl-text[contenteditable='true'], .sl-shape-text[contenteditable='true'] { user-select: text; cursor: text; }
|
|
39
|
+
.sl-text div, .sl-text p { margin: 0; }
|
|
40
|
+
.sl-text ul, .sl-text ol { margin: 0; padding-left: 1.45em; }
|
|
41
|
+
.sl-text li { margin: 0; }
|
|
42
|
+
.sl-text b, .sl-text strong { font-weight: 700; }
|
|
43
|
+
.sl-text i, .sl-text em { font-style: italic; }
|
|
45
44
|
|
|
46
|
-
.sl-
|
|
47
|
-
.sl-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
.sl-notes__label { padding: 4px 10px; color: var(--dt-text-secondary); font-size: 12px; }
|
|
51
|
-
.sl-notes textarea {
|
|
52
|
-
width: 100%; min-height: 64px; max-height: 160px; resize: vertical; box-sizing: border-box;
|
|
53
|
-
padding: 6px 10px; border: none; outline: none; background: transparent; color: var(--dt-text); font-size: 13px;
|
|
45
|
+
.sl-table { width: 100%; height: 100%; border-collapse: collapse; table-layout: fixed; }
|
|
46
|
+
.sl-table td {
|
|
47
|
+
padding: 4px 8px; vertical-align: top; white-space: pre-wrap; word-break: break-word;
|
|
48
|
+
overflow: hidden; line-height: 1.25; box-sizing: border-box;
|
|
54
49
|
}
|
|
50
|
+
.sl-table td[contenteditable='true'] { outline: 2px solid var(--pp-accent, #c43e1c); outline-offset: -2px; background: #fff; }
|
|
55
51
|
|
|
56
|
-
.sl-
|
|
57
|
-
|
|
58
|
-
|
|
52
|
+
.sl-obj.is-editing { outline: 1.5px solid var(--pp-accent, #c43e1c); outline-offset: 1px; }
|
|
53
|
+
.sl-obj.is-flash { animation: pp-flash 0.85s ease; }
|
|
54
|
+
@keyframes pp-flash {
|
|
55
|
+
0%, 100% { outline: 0 solid rgba(196, 62, 28, 0); }
|
|
56
|
+
30% { outline: 3px solid rgba(196, 62, 28, 0.95); outline-offset: 3px; }
|
|
59
57
|
}
|
|
60
|
-
.
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
display: flex; align-items: center; gap: 12px; height: 28px; padding: 0 10px;
|
|
64
|
-
border-top: 1px solid var(--dt-border); color: var(--dt-text-secondary); font-size: 12px;
|
|
58
|
+
.pp-empty-hint {
|
|
59
|
+
position: absolute; left: 8px; top: 6px; color: rgba(120, 120, 120, 0.75);
|
|
60
|
+
font-size: 14px; pointer-events: none; white-space: nowrap;
|
|
65
61
|
}
|
|
66
|
-
.sl-statusbar__spacer { flex: 1; }
|
|
67
|
-
.sl-statusbar__btn { padding: 2px 8px; border: none; border-radius: 4px; background: transparent; color: var(--dt-text-secondary); font-size: 12px; cursor: pointer; }
|
|
68
|
-
.sl-statusbar__btn:hover { background: var(--dt-hover); }
|
|
69
62
|
|
|
70
|
-
/* ====================
|
|
63
|
+
/* ==================== 画布叠加层 ==================== */
|
|
71
64
|
|
|
72
|
-
.
|
|
73
|
-
|
|
74
|
-
|
|
65
|
+
.pp-canvas__inner { position: relative; transform-origin: 0 0; }
|
|
66
|
+
.pp-canvas__inner > .sl-page { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
|
|
67
|
+
.pp-grid {
|
|
68
|
+
position: absolute; inset: 0; z-index: 4; pointer-events: none;
|
|
69
|
+
background-image:
|
|
70
|
+
linear-gradient(to right, rgba(0, 0, 0, 0.06) 1px, transparent 1px),
|
|
71
|
+
linear-gradient(to bottom, rgba(0, 0, 0, 0.06) 1px, transparent 1px);
|
|
72
|
+
background-size: 20px 20px;
|
|
75
73
|
}
|
|
76
|
-
.
|
|
77
|
-
.
|
|
78
|
-
.
|
|
79
|
-
.
|
|
80
|
-
.
|
|
81
|
-
|
|
82
|
-
|
|
74
|
+
.pp-static-guides { position: absolute; inset: 0; z-index: 6; pointer-events: none; }
|
|
75
|
+
.pp-static-guides__v { position: absolute; left: 50%; top: 0; bottom: 0; width: 0; border-left: 1px dashed rgba(196, 62, 28, 0.45); }
|
|
76
|
+
.pp-static-guides__h { position: absolute; top: 50%; left: 0; right: 0; height: 0; border-top: 1px dashed rgba(196, 62, 28, 0.45); }
|
|
77
|
+
.pp-guides { position: absolute; inset: 0; z-index: 30; pointer-events: none; overflow: visible; }
|
|
78
|
+
.pp-guide { position: absolute; background: #00a4ef; }
|
|
79
|
+
.pp-guide--v { width: 1px; }
|
|
80
|
+
.pp-guide--h { height: 1px; }
|
|
81
|
+
.pp-marquee {
|
|
82
|
+
position: absolute; z-index: 31; border: 1px solid var(--pp-accent, #c43e1c);
|
|
83
|
+
background: rgba(196, 62, 28, 0.08); pointer-events: none;
|
|
83
84
|
}
|
|
84
|
-
.
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
.sl-table { width: 100%; height: 100%; border-collapse: collapse; table-layout: fixed; }
|
|
88
|
-
.sl-table td { border: 1px solid var(--dt-border-strong); padding: 2px 6px; vertical-align: top; white-space: pre-wrap; word-break: break-word; }
|
|
89
|
-
|
|
90
|
-
/* 正文通用排版(渲染层与就地编辑器共用一份口径) */
|
|
91
|
-
.sl-text { width: 100%; height: 100%; line-height: 1.35; word-break: break-word; white-space: pre-wrap; outline: none; }
|
|
92
|
-
.sl-text div, .sl-text p { margin: 0 0 .35em; }
|
|
93
|
-
.sl-text ul, .sl-text ol { margin: 0 0 .35em; padding-left: 1.4em; }
|
|
94
|
-
.sl-text li { margin: 0; }
|
|
95
|
-
.sl-text img { display: block; max-width: 100%; max-height: 100%; object-fit: contain; margin: .2em 0; }
|
|
96
|
-
|
|
97
|
-
/* ==================== 画布选中框与手柄 ==================== */
|
|
98
|
-
|
|
99
|
-
.sl-sel { position: absolute; box-sizing: border-box; border: 1px solid var(--dt-accent); pointer-events: none; z-index: 20; }
|
|
100
|
-
.sl-sel__handle {
|
|
101
|
-
position: absolute; width: 9px; height: 9px; box-sizing: border-box; border: 1px solid var(--dt-accent);
|
|
102
|
-
background: #fff; pointer-events: auto;
|
|
85
|
+
.pp-sel {
|
|
86
|
+
position: absolute; z-index: 40; box-sizing: border-box; border: 1px solid var(--pp-accent, #c43e1c);
|
|
87
|
+
pointer-events: none;
|
|
103
88
|
}
|
|
104
|
-
.
|
|
105
|
-
.
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
.
|
|
111
|
-
.
|
|
112
|
-
.
|
|
113
|
-
|
|
114
|
-
|
|
89
|
+
.pp-sel.is-multi { border-style: dashed; }
|
|
90
|
+
.pp-sel__handle {
|
|
91
|
+
position: absolute; width: calc(9px * var(--pp-inv, 1)); height: calc(9px * var(--pp-inv, 1));
|
|
92
|
+
box-sizing: border-box; background: #fff; border: 1px solid var(--pp-accent, #c43e1c);
|
|
93
|
+
pointer-events: auto; transform: translate(-50%, -50%);
|
|
94
|
+
}
|
|
95
|
+
.pp-sel__handle[data-dir='nw'] { left: 0; top: 0; cursor: nwse-resize; }
|
|
96
|
+
.pp-sel__handle[data-dir='n'] { left: 50%; top: 0; cursor: ns-resize; }
|
|
97
|
+
.pp-sel__handle[data-dir='ne'] { left: 100%; top: 0; cursor: nesw-resize; }
|
|
98
|
+
.pp-sel__handle[data-dir='e'] { left: 100%; top: 50%; cursor: ew-resize; }
|
|
99
|
+
.pp-sel__handle[data-dir='se'] { left: 100%; top: 100%; cursor: nwse-resize; }
|
|
100
|
+
.pp-sel__handle[data-dir='s'] { left: 50%; top: 100%; cursor: ns-resize; }
|
|
101
|
+
.pp-sel__handle[data-dir='sw'] { left: 0; top: 100%; cursor: nesw-resize; }
|
|
102
|
+
.pp-sel__handle[data-dir='w'] { left: 0; top: 50%; cursor: ew-resize; }
|
|
103
|
+
.pp-sel__rotate {
|
|
104
|
+
position: absolute; left: 50%; width: calc(16px * var(--pp-inv, 1)); height: calc(16px * var(--pp-inv, 1));
|
|
105
|
+
margin-left: calc(-8px * var(--pp-inv, 1)); border-radius: 50%; background: #fff;
|
|
106
|
+
border: 1px solid var(--pp-accent, #c43e1c); cursor: grab; pointer-events: auto;
|
|
107
|
+
}
|
|
108
|
+
.pp-sel__rotate::after {
|
|
109
|
+
content: '↻'; display: block; text-align: center; line-height: calc(14px * var(--pp-inv, 1));
|
|
110
|
+
font-size: calc(11px * var(--pp-inv, 1)); color: var(--pp-accent, #c43e1c);
|
|
115
111
|
}
|
|
116
|
-
.sl-sel__rotate::after { content: '↻'; font-size: 11px; line-height: 14px; display: block; text-align: center; color: var(--dt-accent); }
|
|
117
|
-
.sl-obj.is-editing { outline: 1px dashed var(--dt-accent); outline-offset: 1px; }
|
|
118
|
-
.sl-canvas-holder .sl-page { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
|
|
119
|
-
|
|
120
|
-
/* 文本框就地编辑 */
|
|
121
|
-
.sl-editor { outline: none; cursor: text; }
|
|
122
112
|
|
|
123
|
-
/* ====================
|
|
113
|
+
/* ==================== 浮层 / 菜单 ==================== */
|
|
124
114
|
|
|
125
115
|
.gb-popup {
|
|
126
|
-
position: fixed; z-index:
|
|
127
|
-
background:
|
|
116
|
+
position: fixed; z-index: 3000; overflow-y: auto; border: 1px solid #d1cfcd; border-radius: 4px;
|
|
117
|
+
background: #fff; box-shadow: 0 8px 26px rgba(0, 0, 0, 0.18); color: #201f1e;
|
|
128
118
|
}
|
|
129
|
-
.gb-menu__list { min-width:
|
|
130
|
-
.gb-
|
|
131
|
-
.gb-
|
|
132
|
-
.gb-menu__item
|
|
119
|
+
.gb-menu__list { min-width: 178px; padding: 3px; }
|
|
120
|
+
.gb-menu__list--compact { min-width: 120px; }
|
|
121
|
+
.gb-menu__header { padding: 6px 10px 4px; color: #797775; font-size: 11px; font-weight: 600; letter-spacing: .02em; }
|
|
122
|
+
.gb-menu__item {
|
|
123
|
+
display: flex; align-items: center; gap: 7px; padding: 6px 9px; border-radius: 3px;
|
|
124
|
+
font-size: 12.5px; white-space: nowrap; cursor: pointer; color: #201f1e;
|
|
125
|
+
}
|
|
126
|
+
.gb-menu__item:hover { background: #f3f2f1; }
|
|
127
|
+
.gb-menu__item.is-disabled { color: #b4b2af; cursor: default; }
|
|
133
128
|
.gb-menu__item.is-disabled:hover { background: transparent; }
|
|
134
|
-
.gb-
|
|
135
|
-
.gb-
|
|
129
|
+
.gb-menu__item.is-danger { color: #c43e1c; }
|
|
130
|
+
.gb-menu__item.is-danger:hover { background: #fdeae6; }
|
|
131
|
+
.gb-menu__lead { width: 16px; display: inline-flex; justify-content: center; color: #605e5c; }
|
|
132
|
+
.gb-menu__item.is-active .gb-menu__lead { color: var(--pp-accent, #c43e1c); }
|
|
133
|
+
.gb-menu__dot { width: 12px; height: 12px; border-radius: 3px; border: 1px solid #c8c6c4; }
|
|
136
134
|
.gb-menu__label { flex: 1; }
|
|
137
|
-
.gb-menu__shortcut { color:
|
|
138
|
-
.gb-menu__arrow { color:
|
|
139
|
-
.gb-menu__sep { height: 1px; margin:
|
|
140
|
-
|
|
141
|
-
.sl-menubar { display: flex; align-items: center; gap: 2px; padding: 2px 8px; border-bottom: 1px solid var(--dt-border); }
|
|
142
|
-
.sl-menubar__btn { padding: 3px 10px; border: none; border-radius: 4px; background: transparent; color: var(--dt-text); font-size: 13px; cursor: pointer; }
|
|
143
|
-
.sl-menubar__btn:hover, .sl-menubar__btn.is-open { background: var(--dt-hover); }
|
|
144
|
-
|
|
145
|
-
.sl-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; min-height: 44px; padding: 4px 8px; border-bottom: 1px solid var(--dt-border); background: var(--dt-bg-2); }
|
|
146
|
-
.sl-toolbar__group { display: flex; align-items: center; gap: 1px; }
|
|
147
|
-
.sl-toolbar__sep { width: 1px; height: 18px; margin: 0 6px; background: var(--dt-border-strong); }
|
|
148
|
-
.sl-toolbtn { width: 28px; height: 28px; display: grid; place-items: center; border: 1px solid transparent; border-radius: 4px; background: transparent; color: var(--dt-text-secondary); cursor: pointer; }
|
|
149
|
-
.sl-toolbtn:hover { background: var(--dt-hover); color: var(--dt-text); }
|
|
150
|
-
.sl-toolbtn.is-active { background: var(--dt-accent-soft); color: var(--dt-accent); }
|
|
151
|
-
.sl-toolbtn:disabled { opacity: .4; cursor: default; }
|
|
152
|
-
.sl-select { display: inline-flex; align-items: center; gap: 4px; height: 26px; padding: 0 6px; border: 1px solid var(--dt-border-strong); border-radius: 4px; background: var(--dt-bg); color: var(--dt-text); font-size: 12px; cursor: pointer; }
|
|
153
|
-
.sl-select__label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
154
|
-
.sl-select__caret { color: var(--dt-text-tertiary); }
|
|
155
|
-
|
|
156
|
-
.gb-btn { padding: 4px 12px; border: 1px solid var(--dt-border-strong); border-radius: 6px; background: var(--dt-bg); color: var(--dt-text); font-size: 13px; cursor: pointer; }
|
|
157
|
-
.gb-btn:hover { border-color: var(--dt-accent); background: var(--dt-accent-soft); }
|
|
158
|
-
.gb-btn--primary { border-color: var(--dt-accent); background: var(--dt-accent); color: var(--dt-on-accent); }
|
|
159
|
-
.gb-iconbtn { width: 24px; height: 24px; display: grid; place-items: center; border: 1px solid transparent; border-radius: 4px; background: transparent; color: var(--dt-text-secondary); cursor: pointer; }
|
|
160
|
-
.gb-iconbtn:hover { background: var(--dt-hover); }
|
|
161
|
-
.gb-input { height: 28px; padding: 0 8px; border: 1px solid var(--dt-border-strong); border-radius: 4px; background: var(--dt-bg); color: var(--dt-text); font-size: 13px; outline: none; }
|
|
162
|
-
.gb-input:focus { border-color: var(--dt-accent); }
|
|
163
|
-
|
|
164
|
-
.gb-color { width: 232px; padding: 10px; }
|
|
165
|
-
.gb-color__grid { display: grid; gap: 3px; }
|
|
166
|
-
.gb-color__swatch { width: 18px; height: 18px; border: 1px solid var(--dt-border-strong); border-radius: 3px; cursor: pointer; }
|
|
167
|
-
.gb-color__swatch.is-active { outline: 2px solid var(--dt-accent); outline-offset: 1px; }
|
|
168
|
-
.gb-color__custom { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
|
|
169
|
-
.gb-color__actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
|
|
170
|
-
|
|
171
|
-
.gb-modal-overlay { position: fixed; inset: 0; z-index: 1200; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,.32); }
|
|
172
|
-
.gb-modal { max-height: 86vh; display: flex; flex-direction: column; border: 1px solid var(--dt-border); border-radius: 8px; background: var(--dt-surface); box-shadow: var(--dt-shadow-window); }
|
|
173
|
-
.gb-modal__head { display: flex; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--dt-border); }
|
|
174
|
-
.gb-modal__title { flex: 1; font-size: 14px; font-weight: 600; }
|
|
175
|
-
.gb-modal__body { padding: 14px; overflow-y: auto; }
|
|
176
|
-
.gb-modal__foot { display: flex; justify-content: flex-end; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--dt-border); }
|
|
177
|
-
.gb-field { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
|
|
178
|
-
.gb-field__label { width: 88px; color: var(--dt-text-secondary); font-size: 12px; }
|
|
179
|
-
.gb-field .gb-input { flex: 1; min-width: 0; }
|
|
180
|
-
.gb-modal__foot .gb-modal__close { border: none; background: none; color: var(--dt-text-secondary); font-size: 14px; cursor: pointer; }
|
|
181
|
-
|
|
182
|
-
.sl-inspector .gb-field { padding: 0 10px; }
|
|
183
|
-
.sl-inspector .sl-field-title { padding: 10px 10px 4px; color: var(--dt-text-secondary); font-size: 12px; font-weight: 600; }
|
|
135
|
+
.gb-menu__shortcut { color: #a19f9d; font-size: 10.5px; }
|
|
136
|
+
.gb-menu__arrow { color: #a19f9d; }
|
|
137
|
+
.gb-menu__sep { height: 1px; margin: 3px 2px; background: #edebe9; }
|
|
184
138
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
.
|
|
188
|
-
.
|
|
189
|
-
|
|
190
|
-
|
|
139
|
+
.gb-color { width: 236px; padding: 10px; }
|
|
140
|
+
.gb-color__title { margin-bottom: 7px; color: #605e5c; font-size: 11.5px; font-weight: 600; }
|
|
141
|
+
.gb-color__grid { display: grid; gap: 3px; }
|
|
142
|
+
.gb-color__swatch {
|
|
143
|
+
width: 18px; height: 18px; padding: 0; border: 1px solid #d1cfcd; border-radius: 2px;
|
|
144
|
+
cursor: pointer;
|
|
191
145
|
}
|
|
192
|
-
.
|
|
193
|
-
.
|
|
146
|
+
.gb-color__swatch:hover { outline: 1px solid var(--pp-accent, #c43e1c); }
|
|
147
|
+
.gb-color__swatch.is-active { outline: 2px solid var(--pp-accent, #c43e1c); outline-offset: 1px; }
|
|
148
|
+
.gb-color__custom { display: flex; align-items: center; gap: 8px; margin-top: 9px; }
|
|
149
|
+
.gb-color__custom input[type='color'] { width: 34px; height: 28px; padding: 0; border: 1px solid #d1cfcd; background: #fff; }
|
|
150
|
+
.gb-color__actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 9px; }
|
|
151
|
+
|
|
152
|
+
.gb-modal-overlay {
|
|
153
|
+
position: fixed; inset: 0; z-index: 4200; display: flex; align-items: center; justify-content: center;
|
|
154
|
+
background: rgba(0, 0, 0, 0.28);
|
|
155
|
+
}
|
|
156
|
+
.gb-modal {
|
|
157
|
+
max-height: 86vh; display: flex; flex-direction: column; border: 1px solid #d1cfcd; border-radius: 5px;
|
|
158
|
+
background: #fff; box-shadow: 0 16px 48px rgba(0, 0, 0, 0.28);
|
|
159
|
+
}
|
|
160
|
+
.gb-modal__head { display: flex; align-items: center; padding: 12px 16px; border-bottom: 1px solid #edebe9; }
|
|
161
|
+
.gb-modal__title { flex: 1; font-size: 15px; font-weight: 600; }
|
|
162
|
+
.gb-modal__body { padding: 16px; overflow-y: auto; font-size: 13px; }
|
|
163
|
+
.gb-modal__foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 16px; border-top: 1px solid #edebe9; }
|
|
164
|
+
.gb-modal__close { border: none; background: none; color: #605e5c; font-size: 14px; cursor: pointer; }
|
|
165
|
+
.gb-modal__message { margin: 0; line-height: 1.65; white-space: pre-wrap; }
|
|
166
|
+
|
|
167
|
+
.gb-btn {
|
|
168
|
+
height: 30px; padding: 0 14px; border: 1px solid #d1cfcd; border-radius: 3px; background: #fff;
|
|
169
|
+
color: #201f1e; font-size: 12.5px; cursor: pointer;
|
|
170
|
+
}
|
|
171
|
+
.gb-btn:hover { border-color: #a19f9d; background: #f8f8f8; }
|
|
172
|
+
.gb-btn--primary { border-color: var(--pp-accent, #c43e1c); background: var(--pp-accent, #c43e1c); color: #fff; }
|
|
173
|
+
.gb-btn--primary:hover { background: #a8341a; border-color: #a8341a; }
|
|
174
|
+
.gb-btn--danger { border-color: #c43e1c; background: #c43e1c; color: #fff; }
|
|
175
|
+
.gb-btn--danger:hover { background: #a8341a; }
|
|
176
|
+
.gb-input {
|
|
177
|
+
height: 30px; padding: 0 8px; border: 1px solid #d1cfcd; border-radius: 3px; background: #fff;
|
|
178
|
+
color: #201f1e; font-size: 12.5px; outline: none; box-sizing: border-box;
|
|
179
|
+
}
|
|
180
|
+
.gb-input:focus { border-color: var(--pp-accent, #c43e1c); box-shadow: 0 0 0 1px var(--pp-accent, #c43e1c) inset; }
|
|
181
|
+
.gb-field { display: flex; align-items: center; gap: 10px; min-height: 32px; }
|
|
182
|
+
.gb-field__label { width: 92px; flex: none; color: #605e5c; font-size: 12px; }
|
|
183
|
+
.gb-field .gb-input { flex: 1; min-width: 0; }
|
|
184
|
+
.gb-check { display: flex; align-items: center; gap: 7px; font-size: 12.5px; cursor: pointer; }
|
|
194
185
|
|
|
195
186
|
/* ==================== 通知 ==================== */
|
|
196
187
|
|
|
197
|
-
.gbdocs-notify-host {
|
|
198
|
-
|
|
188
|
+
.gbdocs-notify-host {
|
|
189
|
+
position: fixed; top: 44px; right: 16px; z-index: 5000; display: flex; flex-direction: column;
|
|
190
|
+
gap: 8px; pointer-events: none;
|
|
191
|
+
}
|
|
192
|
+
.gb-notify {
|
|
193
|
+
display: flex; align-items: center; gap: 9px; min-width: 220px; max-width: 400px;
|
|
194
|
+
padding: 9px 13px; border: 1px solid #d1cfcd; border-left: 4px solid var(--pp-accent, #c43e1c);
|
|
195
|
+
border-radius: 3px; background: #fff; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16);
|
|
196
|
+
font-size: 12.5px; opacity: 0; transform: translateY(-6px);
|
|
197
|
+
transition: opacity .18s ease, transform .18s ease; pointer-events: auto; cursor: pointer;
|
|
198
|
+
}
|
|
199
199
|
.gb-notify.is-in { opacity: 1; transform: translateY(0); }
|
|
200
|
-
.gb-notify__badge {
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
.gb-notify--
|
|
200
|
+
.gb-notify__badge {
|
|
201
|
+
width: 18px; height: 18px; display: grid; place-items: center; border-radius: 50%;
|
|
202
|
+
color: #fff; font-size: 11px; flex-shrink: 0;
|
|
203
|
+
}
|
|
204
|
+
.gb-notify--success { border-left-color: #107c10; }
|
|
205
|
+
.gb-notify--success .gb-notify__badge { background: #107c10; }
|
|
206
|
+
.gb-notify--error { border-left-color: #a4262c; }
|
|
207
|
+
.gb-notify--error .gb-notify__badge { background: #a4262c; }
|
|
208
|
+
.gb-notify--warning { border-left-color: #d18f00; }
|
|
209
|
+
.gb-notify--warning .gb-notify__badge { background: #d18f00; }
|
|
210
|
+
.gb-notify--info { border-left-color: var(--pp-accent, #c43e1c); }
|
|
211
|
+
.gb-notify--info .gb-notify__badge { background: var(--pp-accent, #c43e1c); }
|
|
205
212
|
.gb-notify__text { word-break: break-word; }
|
|
206
213
|
|
|
207
214
|
/* ==================== 打印 ==================== */
|
|
208
215
|
|
|
209
216
|
@media print {
|
|
210
|
-
.
|
|
211
|
-
.
|
|
217
|
+
.pp-titlebar, .pp-ribbon, .pp-slidepane, .pp-formatpane, .pp-statusbar, .pp-notes, .pp-findbar { display: none !important; }
|
|
218
|
+
.pp-app, .pp-main, .pp-center, .pp-canvas { display: block; background: #fff; }
|
|
212
219
|
}
|
package/src/kernel/menus.js
DELETED
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
// [文件] gbpptx·菜单栏结构 —— 文件/编辑/插入/页/格式/设计/视图 七菜单唯一定义处(纯数据,动作经编辑器注入的 ctx 提供;移植 slidesMenus.js)
|
|
2
|
-
/**
|
|
3
|
-
* [设计] 只收录本对象模型能往返的条目(text/image/shape/line/table):参考实现的图表/视频/音频/转场/组合/动画/链接
|
|
4
|
-
* 一律不落条目,禁做点了没反应的死按钮。
|
|
5
|
-
* [设计] items 一律函数——每次打开才求值,勾选态与可用性始终是当下真实状态。
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import { SLIDE_LAYOUTS, THEMES, THEME_KEYS } from './model.js';
|
|
9
|
-
|
|
10
|
-
const ALIGN_KEYS = [
|
|
11
|
-
{ key: 'left', label: '左对齐' },
|
|
12
|
-
{ key: 'centerH', label: '水平居中' },
|
|
13
|
-
{ key: 'right', label: '右对齐' },
|
|
14
|
-
{ key: 'top', label: '上对齐' },
|
|
15
|
-
{ key: 'middle', label: '垂直居中' },
|
|
16
|
-
{ key: 'bottom', label: '下对齐' },
|
|
17
|
-
];
|
|
18
|
-
|
|
19
|
-
const ORDER_KEYS = [
|
|
20
|
-
{ key: 'front', label: '置于顶层' },
|
|
21
|
-
{ key: 'forward', label: '上移一层' },
|
|
22
|
-
{ key: 'backward', label: '下移一层' },
|
|
23
|
-
{ key: 'back', label: '置于底层' },
|
|
24
|
-
];
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* 构建菜单栏结构
|
|
28
|
-
* @param {object} ctx 编辑器注入的动作集合与状态读取器
|
|
29
|
-
* @returns {Array<{key:string,label:string,items:()=>Array}>}
|
|
30
|
-
*/
|
|
31
|
-
export const buildMenus = (ctx) => {
|
|
32
|
-
const { state, file, edit, insert, slide, format, design, view } = ctx;
|
|
33
|
-
|
|
34
|
-
const fileMenu = () => [
|
|
35
|
-
{ label: '新建', shortcut: 'Ctrl+Alt+N', onClick: file.newDoc },
|
|
36
|
-
{ label: '打开…', shortcut: 'Ctrl+O', onClick: file.open },
|
|
37
|
-
{ divided: true },
|
|
38
|
-
{ label: '保存', shortcut: 'Ctrl+S', disabled: !state.hasDoc, onClick: file.save },
|
|
39
|
-
{ label: '另存为…', shortcut: 'Ctrl+Shift+S', disabled: !state.hasDoc, onClick: file.saveAs },
|
|
40
|
-
{ label: '自动保存', checked: state.autosave, onClick: () => file.setAutosave(!state.autosave) },
|
|
41
|
-
{ divided: true },
|
|
42
|
-
{ label: '导入 PowerPoint…', onClick: file.importDoc },
|
|
43
|
-
{ label: '导出', disabled: !state.hasDoc, children: [
|
|
44
|
-
{ label: 'PPTX 文档 (.pptx)', onClick: file.exportPptx },
|
|
45
|
-
{ label: 'PDF 文档 (.pdf)', onClick: file.exportPdf },
|
|
46
|
-
] },
|
|
47
|
-
{ divided: true },
|
|
48
|
-
{ label: '打印 / PDF…', shortcut: 'Ctrl+P', disabled: !state.hasDoc, onClick: file.print },
|
|
49
|
-
];
|
|
50
|
-
|
|
51
|
-
const editMenu = () => [
|
|
52
|
-
{ label: '撤销', shortcut: 'Ctrl+Z', disabled: !state.canUndo, onClick: edit.undo },
|
|
53
|
-
{ label: '重做', shortcut: 'Ctrl+Y', disabled: !state.canRedo, onClick: edit.redo },
|
|
54
|
-
{ divided: true },
|
|
55
|
-
{ label: '剪切', shortcut: 'Ctrl+X', disabled: !state.hasSelection, onClick: edit.cut },
|
|
56
|
-
{ label: '复制', shortcut: 'Ctrl+C', disabled: !state.hasSelection, onClick: edit.copy },
|
|
57
|
-
{ label: '粘贴', shortcut: 'Ctrl+V', disabled: !state.canPaste, onClick: edit.paste },
|
|
58
|
-
{ divided: true },
|
|
59
|
-
{ label: '删除对象', shortcut: 'Del', disabled: !state.hasSelection, onClick: edit.remove },
|
|
60
|
-
{ label: '全选', shortcut: 'Ctrl+A', onClick: edit.selectAll },
|
|
61
|
-
];
|
|
62
|
-
|
|
63
|
-
const insertMenu = () => [
|
|
64
|
-
{ label: '文本框', onClick: insert.text },
|
|
65
|
-
{ label: '图片…', onClick: insert.image },
|
|
66
|
-
{ label: '形状', children: insert.shapeKinds.map((s) => ({ label: s.label, onClick: () => insert.shape(s.kind) })) },
|
|
67
|
-
{ label: '线条', onClick: insert.line },
|
|
68
|
-
{ label: '箭头', onClick: insert.arrow },
|
|
69
|
-
{ label: '表格', onClick: insert.table },
|
|
70
|
-
{ divided: true },
|
|
71
|
-
{ label: '新建页', shortcut: 'Ctrl+M', onClick: slide.new },
|
|
72
|
-
{ label: '新建页(版式)', children: SLIDE_LAYOUTS.map((l) => ({ label: l.label, onClick: () => slide.newWithLayout(l.key) })) },
|
|
73
|
-
];
|
|
74
|
-
|
|
75
|
-
const slideMenu = () => [
|
|
76
|
-
{ label: '新建页', shortcut: 'Ctrl+M', onClick: slide.new },
|
|
77
|
-
{ label: '复制页', shortcut: 'Ctrl+D', onClick: slide.duplicate },
|
|
78
|
-
{ label: '删除页', disabled: !state.canRemoveSlide, onClick: slide.remove },
|
|
79
|
-
{ divided: true },
|
|
80
|
-
{ label: '上移一页', disabled: !state.canMoveUp, onClick: slide.moveUp },
|
|
81
|
-
{ label: '下移一页', disabled: !state.canMoveDown, onClick: slide.moveDown },
|
|
82
|
-
{ divided: true },
|
|
83
|
-
{ label: '页面背景…', onClick: slide.background },
|
|
84
|
-
];
|
|
85
|
-
|
|
86
|
-
const alignChildren = () => ALIGN_KEYS.map((a) => ({ label: a.label, divided: a.key === 'top', onClick: () => format.align(a.key) }));
|
|
87
|
-
|
|
88
|
-
const formatMenu = () => [
|
|
89
|
-
{ label: '项目符号列表', shortcut: 'Ctrl+Shift+8', checked: state.bulletList, disabled: !state.editing, onClick: format.bullet },
|
|
90
|
-
{ label: '编号列表', shortcut: 'Ctrl+Shift+7', checked: state.numberList, disabled: !state.editing, onClick: format.numbered },
|
|
91
|
-
{ divided: true },
|
|
92
|
-
{ label: '对齐页面', disabled: !state.hasSelection, children: alignChildren() },
|
|
93
|
-
{ label: '层级', disabled: !state.hasSelection, children: ORDER_KEYS.map((o) => ({ label: o.label, onClick: () => format.order(o.key) })) },
|
|
94
|
-
{ divided: true },
|
|
95
|
-
{ label: '复制对象', shortcut: 'Ctrl+D', disabled: !state.hasSelection, onClick: format.duplicate },
|
|
96
|
-
{ label: '删除对象', shortcut: 'Del', disabled: !state.hasSelection, onClick: format.remove },
|
|
97
|
-
];
|
|
98
|
-
|
|
99
|
-
const designMenu = () => [
|
|
100
|
-
...THEME_KEYS.map((key) => ({ label: THEMES[key].label, checked: state.theme === key, onClick: () => design.theme(key) })),
|
|
101
|
-
];
|
|
102
|
-
|
|
103
|
-
const viewMenu = () => [
|
|
104
|
-
{ label: '放大', shortcut: 'Ctrl+=', onClick: view.zoomIn },
|
|
105
|
-
{ label: '缩小', shortcut: 'Ctrl+-', onClick: view.zoomOut },
|
|
106
|
-
{ label: '重置缩放', shortcut: 'Ctrl+0', onClick: view.zoomReset },
|
|
107
|
-
{ divided: true },
|
|
108
|
-
{ label: '放映', shortcut: 'F5', onClick: view.present },
|
|
109
|
-
{ label: '从第一页放映', onClick: view.presentFromStart },
|
|
110
|
-
{ divided: true },
|
|
111
|
-
{ label: '演讲者备注', checked: state.notesVisible, onClick: view.toggleNotes },
|
|
112
|
-
];
|
|
113
|
-
|
|
114
|
-
return [
|
|
115
|
-
{ key: 'file', label: '文件', items: fileMenu },
|
|
116
|
-
{ key: 'edit', label: '编辑', items: editMenu },
|
|
117
|
-
{ key: 'insert', label: '插入', items: insertMenu },
|
|
118
|
-
{ key: 'slide', label: '页', items: slideMenu },
|
|
119
|
-
{ key: 'format', label: '格式', items: formatMenu },
|
|
120
|
-
{ key: 'design', label: '设计', items: designMenu },
|
|
121
|
-
{ key: 'view', label: '视图', items: viewMenu },
|
|
122
|
-
];
|
|
123
|
-
};
|