@open-press/core 1.2.0 → 1.3.1
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 +2 -2
- package/engine/cli.mjs +1 -1
- package/engine/commands/_shared.mjs +10 -5
- package/engine/commands/deploy.mjs +19 -4
- package/engine/commands/typecheck.mjs +1 -1
- package/engine/document-export.mjs +1 -1
- package/engine/output/page-block.mjs +11 -2
- package/engine/output/public-assets.mjs +41 -6
- package/engine/output/static-server.mjs +84 -24
- package/engine/react/caption-numbering.mjs +2 -2
- package/engine/react/comment-marker.mjs +1 -2
- package/engine/react/document-entry.mjs +64 -11
- package/engine/react/document-export.d.mts +6 -0
- package/engine/react/document-export.mjs +158 -28
- package/engine/react/mdx-compile.mjs +4 -4
- package/engine/react/measurement-css.mjs +3 -3
- package/engine/react/page-folio.mjs +37 -0
- package/engine/react/pagination/allocator.mjs +4 -4
- package/engine/react/pipeline/frame-measurement.mjs +34 -16
- package/engine/react/press-tree-inspection.mjs +43 -13
- package/engine/react/project-asset-endpoint.mjs +45 -11
- package/engine/react/sources/heading-numbering.mjs +2 -2
- package/engine/react/sources/mdx-resolver.mjs +3 -3
- package/engine/react/style-discovery.mjs +60 -11
- package/engine/react/text-source-transform.mjs +18 -4
- package/engine/runtime/config.mjs +22 -22
- package/engine/runtime/file-utils.mjs +57 -13
- package/engine/runtime/inspection.mjs +40 -15
- package/engine/runtime/page-geometry.mjs +6 -6
- package/engine/runtime/source-text-tools.mjs +28 -4
- package/engine/runtime/source-workspace.mjs +6 -9
- package/engine/runtime/validation.mjs +42 -24
- package/package.json +1 -1
- package/src/openpress/app/OpenPressApp.tsx +10 -16
- package/src/openpress/app/OpenPressRuntime.tsx +29 -4
- package/src/openpress/app/WorkspaceGalleryPage.tsx +1 -1
- package/src/openpress/core/PageFolio.tsx +115 -0
- package/src/openpress/core/Press.tsx +5 -10
- package/src/openpress/core/Slide.tsx +11 -0
- package/src/openpress/core/index.tsx +4 -0
- package/src/openpress/core/types.ts +21 -13
- package/src/openpress/core/useSource.ts +1 -1
- package/src/openpress/document-model/workspaceManifestModel.ts +4 -9
- package/src/openpress/reader/PageThumbnailsPanel.tsx +28 -5
- package/src/openpress/reader/SlidePresentationPage.tsx +36 -19
- package/src/openpress/reader/SlidePublicPage.tsx +332 -0
- package/src/openpress/reader/index.ts +1 -0
- package/src/openpress/reader/pageViewportScaleModel.ts +5 -3
- package/src/openpress/reader/usePageViewportScale.ts +9 -5
- package/src/openpress/workbench/Workbench.tsx +46 -164
- package/src/openpress/workbench/actions/DeploymentControl.tsx +1 -1
- package/src/openpress/workbench/actions/ExportControl.tsx +267 -0
- package/src/openpress/workbench/actions/index.ts +1 -1
- package/src/openpress/workbench/actions/useDeploymentWorkbench.ts +7 -2
- package/src/openpress/workbench/hooks/useWorkbenchNavigation.ts +42 -0
- package/src/openpress/workbench/project/ProjectEntryPanel.tsx +2 -278
- package/src/openpress/workbench/shell/WorkbenchToolbarActions.tsx +206 -0
- package/src/styles/openpress/app-shell.css +0 -83
- package/src/styles/openpress/print-route.css +1 -3
- package/src/styles/openpress/project-preview-panel.css +5 -783
- package/src/styles/openpress/public-viewer.css +7 -249
- package/src/styles/openpress/reader-runtime.css +0 -274
- package/src/styles/openpress/slide-presenter.css +150 -0
- package/src/styles/openpress/slide-public-viewer.css +222 -0
- package/src/styles/openpress/workbench-dialog.css +267 -0
- package/src/styles/openpress/workbench-export.css +154 -0
- package/src/styles/openpress/workbench-inline-editor.css +128 -0
- package/src/styles/openpress/workbench-panels.css +0 -88
- package/src/styles/openpress/workbench-search.css +257 -0
- package/src/styles/openpress/workbench-toolbar.css +422 -0
- package/src/styles/openpress/workbench.css +34 -1263
- package/src/styles/openpress/workspace-gallery.css +0 -5
- package/src/styles/openpress.css +7 -1
- package/vite.config.ts +98 -25
- package/src/openpress/workbench/actions/ExportImageControl.tsx +0 -96
- package/src/styles/openpress/media-workspace.css +0 -230
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { memo, useState
|
|
2
|
-
import { Component as ComponentIcon
|
|
1
|
+
import { memo, useState } from "react";
|
|
2
|
+
import { Component as ComponentIcon } from "lucide-react";
|
|
3
3
|
import type { BookmarkItem, BookmarkSubItem, MediaAssetItem } from "../../document-model";
|
|
4
|
-
import { projectSourceDirectoryPath, PROJECT_SOURCES } from "./projectSourceModel";
|
|
5
4
|
import type { BlockSource } from "../../document-model";
|
|
6
5
|
import type { DisplayPage } from "../../reader";
|
|
7
6
|
import { Panel } from "../panels/Panel";
|
|
@@ -15,10 +14,6 @@ import {
|
|
|
15
14
|
export { createProjectObjectEntityId } from "./projectPreviewTypes";
|
|
16
15
|
export type { ProjectMentionItem, ProjectPanelPreview } from "./projectPreviewTypes";
|
|
17
16
|
|
|
18
|
-
export const PROJECT_VISUAL_SYSTEM_KEY = "visual-system";
|
|
19
|
-
export const PROJECT_IMAGE_GALLERY_KEY = "image-gallery";
|
|
20
|
-
export const PROJECT_COMPONENT_LIBRARY_KEY = "component-library";
|
|
21
|
-
|
|
22
17
|
export type ProjectComponentUsage = {
|
|
23
18
|
count: number;
|
|
24
19
|
pageIndexes: number[];
|
|
@@ -167,264 +162,6 @@ function ProjectEntryPanelImpl({
|
|
|
167
162
|
export const ProjectEntryPanel = memo(ProjectEntryPanelImpl);
|
|
168
163
|
ProjectEntryPanel.displayName = "ProjectEntryPanel";
|
|
169
164
|
|
|
170
|
-
export function ProjectPreviewPanel({
|
|
171
|
-
mediaAssets,
|
|
172
|
-
componentUsages,
|
|
173
|
-
selectedKey,
|
|
174
|
-
}: {
|
|
175
|
-
mediaAssets: MediaAssetItem[];
|
|
176
|
-
componentUsages: Map<string, ProjectComponentUsage>;
|
|
177
|
-
selectedKey: string | null;
|
|
178
|
-
}) {
|
|
179
|
-
if (!selectedKey || selectedKey === PROJECT_VISUAL_SYSTEM_KEY) {
|
|
180
|
-
return <ProjectVisualSystem />;
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
if (selectedKey === PROJECT_IMAGE_GALLERY_KEY) {
|
|
184
|
-
return <ProjectImageGallery mediaAssets={mediaAssets} />;
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
if (selectedKey === PROJECT_COMPONENT_LIBRARY_KEY) {
|
|
188
|
-
return <ProjectComponentLibrary usages={componentUsages} />;
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
return <ProjectVisualSystem />;
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
function ProjectPanelButton({
|
|
195
|
-
icon: Icon,
|
|
196
|
-
label,
|
|
197
|
-
meta,
|
|
198
|
-
active,
|
|
199
|
-
onClick,
|
|
200
|
-
}: {
|
|
201
|
-
icon: LucideIcon;
|
|
202
|
-
label: string;
|
|
203
|
-
meta: string;
|
|
204
|
-
active: boolean;
|
|
205
|
-
onClick: () => void;
|
|
206
|
-
}) {
|
|
207
|
-
return (
|
|
208
|
-
<button
|
|
209
|
-
type="button"
|
|
210
|
-
className={`bookmark-item bookmark-h2 openpress-project-entry${active ? " is-active" : ""}`}
|
|
211
|
-
aria-pressed={active}
|
|
212
|
-
onClick={onClick}
|
|
213
|
-
>
|
|
214
|
-
<span className="bookmark-index openpress-project-entry-icon"><Icon aria-hidden="true" /></span>
|
|
215
|
-
<span className="bookmark-title">
|
|
216
|
-
<span>{label}</span>
|
|
217
|
-
<small>{meta}</small>
|
|
218
|
-
</span>
|
|
219
|
-
</button>
|
|
220
|
-
);
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
function ProjectVisualSystem() {
|
|
224
|
-
return (
|
|
225
|
-
<section className="openpress-project-preview-panel" aria-label="專案">
|
|
226
|
-
<article className="openpress-project-visual-system" aria-label="Visual System">
|
|
227
|
-
<ProjectSectionHeader title="Visual System" minimal />
|
|
228
|
-
|
|
229
|
-
<div className="openpress-project-visual-grid">
|
|
230
|
-
<section className="openpress-project-visual-card openpress-project-visual-card--typography" aria-label="Typography">
|
|
231
|
-
<header>
|
|
232
|
-
<span>Typography</span>
|
|
233
|
-
<strong>閱讀層級</strong>
|
|
234
|
-
</header>
|
|
235
|
-
<div className="openpress-project-type-specimen">
|
|
236
|
-
<p className="openpress-project-type-kicker">Course Notes</p>
|
|
237
|
-
<h2>Data Structures</h2>
|
|
238
|
-
<h3>Linked List 與 Tree Traversal</h3>
|
|
239
|
-
<h4>Pointer / Node / Recursive Thinking</h4>
|
|
240
|
-
<p>以 C/C++ 實作資料結構,整理概念、表示法與操作流程。</p>
|
|
241
|
-
<code>struct Node *next = head;</code>
|
|
242
|
-
</div>
|
|
243
|
-
</section>
|
|
244
|
-
|
|
245
|
-
<section className="openpress-project-visual-card" aria-label="Color Palette">
|
|
246
|
-
<header>
|
|
247
|
-
<span>Palette</span>
|
|
248
|
-
<strong>色票配置</strong>
|
|
249
|
-
</header>
|
|
250
|
-
<div className="openpress-project-swatch-grid">
|
|
251
|
-
{PROJECT_COLOR_SWATCHES.map((item) => (
|
|
252
|
-
<div className="openpress-project-swatch" key={item.token}>
|
|
253
|
-
<span
|
|
254
|
-
className="openpress-project-swatch-chip"
|
|
255
|
-
style={{ "--openpress-project-swatch": `var(${item.token})` } as CSSProperties}
|
|
256
|
-
aria-hidden="true"
|
|
257
|
-
/>
|
|
258
|
-
<strong>{item.label}</strong>
|
|
259
|
-
<code>{item.token.replace("--openpress-", "")}</code>
|
|
260
|
-
</div>
|
|
261
|
-
))}
|
|
262
|
-
</div>
|
|
263
|
-
</section>
|
|
264
|
-
|
|
265
|
-
<section className="openpress-project-visual-card openpress-project-visual-card--surfaces" aria-label="Surfaces">
|
|
266
|
-
<header>
|
|
267
|
-
<span>Surfaces</span>
|
|
268
|
-
<strong>區塊背景</strong>
|
|
269
|
-
</header>
|
|
270
|
-
<div className="openpress-project-surface-preview">
|
|
271
|
-
<div className="openpress-project-surface-paper">
|
|
272
|
-
<span>Page paper</span>
|
|
273
|
-
</div>
|
|
274
|
-
<div className="openpress-project-surface-block">
|
|
275
|
-
<span>Figure / Code block</span>
|
|
276
|
-
</div>
|
|
277
|
-
</div>
|
|
278
|
-
</section>
|
|
279
|
-
</div>
|
|
280
|
-
</article>
|
|
281
|
-
</section>
|
|
282
|
-
);
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
function ProjectComponentLibrary({
|
|
286
|
-
usages,
|
|
287
|
-
}: {
|
|
288
|
-
usages: Map<string, ProjectComponentUsage>;
|
|
289
|
-
}) {
|
|
290
|
-
const previewItems = createComponentPreviewItems(usages);
|
|
291
|
-
return (
|
|
292
|
-
<section className="openpress-project-preview-panel" aria-label="專案">
|
|
293
|
-
<article className="openpress-project-component-viewer" aria-label={PROJECT_SOURCES.components.label}>
|
|
294
|
-
<ProjectSectionHeader
|
|
295
|
-
title="Rendered Components"
|
|
296
|
-
description="文件目前實際渲染出的 component、圖表與示意圖狀態。"
|
|
297
|
-
stats={[
|
|
298
|
-
["Kinds", String(usages.size)],
|
|
299
|
-
["Renders", String(previewItems.length)],
|
|
300
|
-
]}
|
|
301
|
-
/>
|
|
302
|
-
{previewItems.length > 0 ? (
|
|
303
|
-
<div className="openpress-project-component-list" aria-label="rendered content block list">
|
|
304
|
-
{previewItems.map((item) => (
|
|
305
|
-
<figure className="openpress-project-component-preview-row" key={`${item.name}-${item.index}`}>
|
|
306
|
-
<figcaption>
|
|
307
|
-
<span>{item.name}</span>
|
|
308
|
-
<small>P{String(item.preview.pageIndex + 1).padStart(2, "0")}</small>
|
|
309
|
-
</figcaption>
|
|
310
|
-
<div
|
|
311
|
-
className="openpress-project-component-preview"
|
|
312
|
-
dangerouslySetInnerHTML={{ __html: item.preview.html }}
|
|
313
|
-
/>
|
|
314
|
-
</figure>
|
|
315
|
-
))}
|
|
316
|
-
</div>
|
|
317
|
-
) : (
|
|
318
|
-
<p className="openpress-project-empty">目前文件尚未渲染任何內容區塊。</p>
|
|
319
|
-
)}
|
|
320
|
-
</article>
|
|
321
|
-
</section>
|
|
322
|
-
);
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
function ProjectImageGallery({
|
|
326
|
-
mediaAssets,
|
|
327
|
-
}: {
|
|
328
|
-
mediaAssets: MediaAssetItem[];
|
|
329
|
-
}) {
|
|
330
|
-
const usedCount = mediaAssets.filter((item) => item.usageCount > 0).length;
|
|
331
|
-
const unreferencedAssets = mediaAssets.filter((item) => item.usageCount === 0);
|
|
332
|
-
const referencedAssets = mediaAssets.filter((item) => item.usageCount > 0);
|
|
333
|
-
return (
|
|
334
|
-
<section className="openpress-project-preview-panel" aria-label="專案">
|
|
335
|
-
<article className="openpress-project-gallery-viewer" aria-label="Image Gallery">
|
|
336
|
-
<ProjectSectionHeader
|
|
337
|
-
title="Media Library"
|
|
338
|
-
description={projectSourceDirectoryPath("media")}
|
|
339
|
-
stats={[
|
|
340
|
-
["Files", String(mediaAssets.length)],
|
|
341
|
-
["Used", String(usedCount)],
|
|
342
|
-
]}
|
|
343
|
-
/>
|
|
344
|
-
{mediaAssets.length > 0 ? (
|
|
345
|
-
<div className="openpress-project-media-sections" aria-label="media gallery">
|
|
346
|
-
<ProjectMediaSection title="未引用" assets={unreferencedAssets} />
|
|
347
|
-
<ProjectMediaSection title="已引用" assets={referencedAssets} />
|
|
348
|
-
</div>
|
|
349
|
-
) : (
|
|
350
|
-
<p className="openpress-project-empty">{projectSourceDirectoryPath("media")} 尚未有可預覽素材。</p>
|
|
351
|
-
)}
|
|
352
|
-
</article>
|
|
353
|
-
</section>
|
|
354
|
-
);
|
|
355
|
-
}
|
|
356
|
-
|
|
357
|
-
function ProjectSectionHeader({
|
|
358
|
-
title,
|
|
359
|
-
description,
|
|
360
|
-
stats,
|
|
361
|
-
minimal = false,
|
|
362
|
-
}: {
|
|
363
|
-
title: string;
|
|
364
|
-
description?: string;
|
|
365
|
-
stats?: Array<[string, string]>;
|
|
366
|
-
minimal?: boolean;
|
|
367
|
-
}) {
|
|
368
|
-
return (
|
|
369
|
-
<header className={`openpress-project-section-header${minimal ? " openpress-project-section-header--minimal" : ""}`}>
|
|
370
|
-
<div>
|
|
371
|
-
<h2>{title}</h2>
|
|
372
|
-
{description ? <span>{description}</span> : null}
|
|
373
|
-
</div>
|
|
374
|
-
{!minimal && stats?.length ? (
|
|
375
|
-
<dl>
|
|
376
|
-
{stats.map(([label, value]) => (
|
|
377
|
-
<div key={label}>
|
|
378
|
-
<dt>{label}</dt>
|
|
379
|
-
<dd>{value}</dd>
|
|
380
|
-
</div>
|
|
381
|
-
))}
|
|
382
|
-
</dl>
|
|
383
|
-
) : null}
|
|
384
|
-
</header>
|
|
385
|
-
);
|
|
386
|
-
}
|
|
387
|
-
|
|
388
|
-
function ProjectMediaSection({
|
|
389
|
-
title,
|
|
390
|
-
assets,
|
|
391
|
-
}: {
|
|
392
|
-
title: string;
|
|
393
|
-
assets: MediaAssetItem[];
|
|
394
|
-
}) {
|
|
395
|
-
return (
|
|
396
|
-
<section className="openpress-project-media-section" aria-label={title}>
|
|
397
|
-
<header className="openpress-project-media-section-header">
|
|
398
|
-
<h3>{title}</h3>
|
|
399
|
-
</header>
|
|
400
|
-
{assets.length > 0 ? (
|
|
401
|
-
<div className="openpress-project-media-gallery">
|
|
402
|
-
{assets.map((item) => (
|
|
403
|
-
<figure className="openpress-project-media-card" data-unused={item.usageCount === 0 ? "true" : "false"} key={item.id}>
|
|
404
|
-
<img src={item.src} alt="" loading="lazy" />
|
|
405
|
-
<figcaption>
|
|
406
|
-
<strong>{item.fileName}</strong>
|
|
407
|
-
</figcaption>
|
|
408
|
-
</figure>
|
|
409
|
-
))}
|
|
410
|
-
</div>
|
|
411
|
-
) : (
|
|
412
|
-
<p className="openpress-project-media-section-empty">沒有{title}圖片。</p>
|
|
413
|
-
)}
|
|
414
|
-
</section>
|
|
415
|
-
);
|
|
416
|
-
}
|
|
417
|
-
|
|
418
|
-
function createComponentPreviewItems(usages: Map<string, ProjectComponentUsage>) {
|
|
419
|
-
return Array.from(usages.entries())
|
|
420
|
-
.flatMap(([name, usage]) => usage.previews.map((preview, index) => ({ name, preview, index })))
|
|
421
|
-
.filter((item) => Boolean(item.preview.html))
|
|
422
|
-
.sort((a, b) => {
|
|
423
|
-
const pageDelta = a.preview.pageIndex - b.preview.pageIndex;
|
|
424
|
-
return pageDelta || a.name.localeCompare(b.name, "zh-Hant") || a.index - b.index;
|
|
425
|
-
});
|
|
426
|
-
}
|
|
427
|
-
|
|
428
165
|
function extractRenderedComponentBlocks(html: string) {
|
|
429
166
|
const blocks: Array<{ name: string; html: string }> = [];
|
|
430
167
|
const openTagPattern = /<(figure|section|article|div)\b[^>]*data-openpress-component="([^"]+)"[^>]*>/g;
|
|
@@ -510,16 +247,3 @@ const PROJECT_SKILL_MENTIONS: ProjectMentionItem[] = [
|
|
|
510
247
|
{ trigger: "/", value: "/apply-style", label: "apply-style", meta: "skill", kind: "skill" },
|
|
511
248
|
{ trigger: "/", value: "/fix-code", label: "fix-code", meta: "skill", kind: "skill" },
|
|
512
249
|
];
|
|
513
|
-
|
|
514
|
-
const PROJECT_COLOR_SWATCHES = [
|
|
515
|
-
{ label: "Document", token: "--openpress-color-document" },
|
|
516
|
-
{ label: "Paper", token: "--openpress-color-paper" },
|
|
517
|
-
{ label: "Ink", token: "--openpress-color-ink" },
|
|
518
|
-
{ label: "Body", token: "--openpress-color-body" },
|
|
519
|
-
{ label: "Muted", token: "--openpress-color-muted" },
|
|
520
|
-
{ label: "Subtle", token: "--openpress-color-subtle" },
|
|
521
|
-
{ label: "Line", token: "--openpress-color-line" },
|
|
522
|
-
{ label: "Block", token: "--openpress-color-block" },
|
|
523
|
-
{ label: "Info", token: "--openpress-color-info" },
|
|
524
|
-
{ label: "Green", token: "--openpress-color-green" },
|
|
525
|
-
];
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import { Home, MousePointer2, Play, Ruler } from "lucide-react";
|
|
2
|
+
import type { Dispatch, SetStateAction } from "react";
|
|
3
|
+
import type { DeploymentInfo, HtmlPageBlock, SourceBlock, Theme } from "../../document-model";
|
|
4
|
+
import type { PageLayoutMode, PageViewportScaleMode } from "../../reader";
|
|
5
|
+
import {
|
|
6
|
+
DeploymentControl,
|
|
7
|
+
ExportControl,
|
|
8
|
+
PageZoomControl,
|
|
9
|
+
SearchControl,
|
|
10
|
+
} from "../actions";
|
|
11
|
+
import type { DeployStatus, InspectorCommentStatus, PdfActionStatus } from "../workbenchTypes";
|
|
12
|
+
import type { PageGeometrySpec } from "../workbenchFormatters";
|
|
13
|
+
import type { InlineDocumentEditStatus } from "../document";
|
|
14
|
+
|
|
15
|
+
export function WorkbenchToolbarActions({
|
|
16
|
+
pages,
|
|
17
|
+
currentPageIndex,
|
|
18
|
+
pressTitle,
|
|
19
|
+
theme,
|
|
20
|
+
workspaceMode,
|
|
21
|
+
sourceBlocksByPath,
|
|
22
|
+
onSelectPage,
|
|
23
|
+
onBackToWorkspace,
|
|
24
|
+
isSlidePress,
|
|
25
|
+
onOpenPresentation,
|
|
26
|
+
pageGeometry,
|
|
27
|
+
scaleMode,
|
|
28
|
+
scaleLabel,
|
|
29
|
+
pageLayoutMode,
|
|
30
|
+
onScaleModeChange,
|
|
31
|
+
onPageLayoutModeChange,
|
|
32
|
+
inlineEditStatus,
|
|
33
|
+
editStatusMessage,
|
|
34
|
+
inspectorMode,
|
|
35
|
+
inspectorToolbarExpanded,
|
|
36
|
+
inspectorSelectionLabel,
|
|
37
|
+
onInspectorModeChange,
|
|
38
|
+
inspectorCommentStatus,
|
|
39
|
+
inspectorCommentStatusMessage,
|
|
40
|
+
deploymentInfo,
|
|
41
|
+
deploymentStatus,
|
|
42
|
+
localDeployEnabled,
|
|
43
|
+
onDeploy,
|
|
44
|
+
onExportPdf,
|
|
45
|
+
pdfDisabled,
|
|
46
|
+
pdfLabel,
|
|
47
|
+
pdfStatusMessage,
|
|
48
|
+
pdfActionStatus,
|
|
49
|
+
}: {
|
|
50
|
+
pages: HtmlPageBlock[];
|
|
51
|
+
currentPageIndex: number;
|
|
52
|
+
pressTitle: string;
|
|
53
|
+
theme?: Theme;
|
|
54
|
+
workspaceMode: boolean;
|
|
55
|
+
sourceBlocksByPath: Record<string, SourceBlock[]>;
|
|
56
|
+
onSelectPage: (pageIndex: number, options?: { behavior?: ScrollBehavior }) => void;
|
|
57
|
+
onBackToWorkspace?: () => void;
|
|
58
|
+
isSlidePress: boolean;
|
|
59
|
+
onOpenPresentation?: (pageIndex: number) => void;
|
|
60
|
+
pageGeometry: PageGeometrySpec;
|
|
61
|
+
scaleMode: PageViewportScaleMode;
|
|
62
|
+
scaleLabel: string;
|
|
63
|
+
pageLayoutMode: PageLayoutMode;
|
|
64
|
+
onScaleModeChange: Dispatch<SetStateAction<PageViewportScaleMode>>;
|
|
65
|
+
onPageLayoutModeChange: Dispatch<SetStateAction<PageLayoutMode>>;
|
|
66
|
+
inlineEditStatus: InlineDocumentEditStatus;
|
|
67
|
+
editStatusMessage: string;
|
|
68
|
+
inspectorMode: boolean;
|
|
69
|
+
inspectorToolbarExpanded: boolean;
|
|
70
|
+
inspectorSelectionLabel: string;
|
|
71
|
+
onInspectorModeChange: (enabled: boolean) => void;
|
|
72
|
+
inspectorCommentStatus: InspectorCommentStatus;
|
|
73
|
+
inspectorCommentStatusMessage: string;
|
|
74
|
+
deploymentInfo: DeploymentInfo;
|
|
75
|
+
deploymentStatus: DeployStatus;
|
|
76
|
+
localDeployEnabled: boolean;
|
|
77
|
+
onDeploy: () => Promise<void>;
|
|
78
|
+
onExportPdf: () => void;
|
|
79
|
+
pdfDisabled: boolean;
|
|
80
|
+
pdfLabel: string;
|
|
81
|
+
pdfStatusMessage: string | null;
|
|
82
|
+
pdfActionStatus: PdfActionStatus;
|
|
83
|
+
}) {
|
|
84
|
+
return (
|
|
85
|
+
<>
|
|
86
|
+
{onBackToWorkspace ? (
|
|
87
|
+
<div className="openpress-workbench-toolbar__group" aria-label="工作台導覽">
|
|
88
|
+
<button
|
|
89
|
+
type="button"
|
|
90
|
+
className="openpress-workbench-toolbar-action openpress-workbench-toolbar-action--back"
|
|
91
|
+
data-openpress-back-to-workspace
|
|
92
|
+
onClick={onBackToWorkspace}
|
|
93
|
+
title="回到工作台"
|
|
94
|
+
aria-label="回到工作台"
|
|
95
|
+
>
|
|
96
|
+
<Home aria-hidden="true" />
|
|
97
|
+
<span className="openpress-workbench-toolbar-action__label">工作台</span>
|
|
98
|
+
</button>
|
|
99
|
+
</div>
|
|
100
|
+
) : null}
|
|
101
|
+
<div className="openpress-workbench-toolbar__group" aria-label="匯出">
|
|
102
|
+
<ExportControl
|
|
103
|
+
pages={pages}
|
|
104
|
+
currentPageIndex={currentPageIndex}
|
|
105
|
+
pressTitle={pressTitle}
|
|
106
|
+
theme={theme}
|
|
107
|
+
onExportPdf={onExportPdf}
|
|
108
|
+
pdfDisabled={pdfDisabled}
|
|
109
|
+
pdfLabel={pdfLabel}
|
|
110
|
+
pdfStatusMessage={pdfStatusMessage}
|
|
111
|
+
pdfActionStatus={pdfActionStatus}
|
|
112
|
+
/>
|
|
113
|
+
</div>
|
|
114
|
+
<div className="openpress-workbench-toolbar__group openpress-workbench-toolbar__group--page" aria-label="頁面規格">
|
|
115
|
+
{isSlidePress && onOpenPresentation ? (
|
|
116
|
+
<button
|
|
117
|
+
type="button"
|
|
118
|
+
className="openpress-workbench-toolbar-action"
|
|
119
|
+
data-openpress-slide-present
|
|
120
|
+
data-openpress-toolbar-expanded="false"
|
|
121
|
+
data-openpress-toolbar-active="false"
|
|
122
|
+
aria-pressed="false"
|
|
123
|
+
title="進入放映模式"
|
|
124
|
+
aria-label="進入放映模式"
|
|
125
|
+
onClick={() => onOpenPresentation(currentPageIndex)}
|
|
126
|
+
>
|
|
127
|
+
<Play aria-hidden="true" />
|
|
128
|
+
<span className="openpress-workbench-toolbar-action__label">放映</span>
|
|
129
|
+
</button>
|
|
130
|
+
) : null}
|
|
131
|
+
<button
|
|
132
|
+
type="button"
|
|
133
|
+
className="openpress-workbench-page-geometry"
|
|
134
|
+
data-openpress-page-geometry
|
|
135
|
+
title={pageGeometry.title}
|
|
136
|
+
aria-label={`頁面規格 ${pageGeometry.title}`}
|
|
137
|
+
>
|
|
138
|
+
<Ruler aria-hidden="true" />
|
|
139
|
+
<span className="openpress-workbench-page-geometry__label">{pageGeometry.label}</span>
|
|
140
|
+
<span className="openpress-workbench-page-geometry__dimensions">{pageGeometry.dimensions}</span>
|
|
141
|
+
</button>
|
|
142
|
+
<PageZoomControl
|
|
143
|
+
scaleMode={scaleMode}
|
|
144
|
+
scaleLabel={scaleLabel}
|
|
145
|
+
pageLayoutMode={pageLayoutMode}
|
|
146
|
+
onScaleModeChange={onScaleModeChange}
|
|
147
|
+
onPageLayoutModeChange={onPageLayoutModeChange}
|
|
148
|
+
/>
|
|
149
|
+
</div>
|
|
150
|
+
<div className="openpress-workbench-toolbar__group openpress-workbench-toolbar__group--right" aria-label="工作台狀態與發布">
|
|
151
|
+
{workspaceMode ? (
|
|
152
|
+
<SearchControl
|
|
153
|
+
sourceBlocksByPath={sourceBlocksByPath}
|
|
154
|
+
onSelectPage={onSelectPage}
|
|
155
|
+
/>
|
|
156
|
+
) : null}
|
|
157
|
+
{workspaceMode && editStatusMessage ? (
|
|
158
|
+
<span
|
|
159
|
+
className="openpress-dev-edit-status openpress-dev-edit-status--toolbar"
|
|
160
|
+
data-openpress-edit-status={inlineEditStatus.state}
|
|
161
|
+
role="status"
|
|
162
|
+
aria-live="polite"
|
|
163
|
+
>
|
|
164
|
+
{inlineEditStatus.state === "saving" ? <span className="openpress-dev-edit-status__spinner" aria-hidden="true" /> : null}
|
|
165
|
+
<span>{editStatusMessage}</span>
|
|
166
|
+
</span>
|
|
167
|
+
) : null}
|
|
168
|
+
{workspaceMode ? (
|
|
169
|
+
<button
|
|
170
|
+
type="button"
|
|
171
|
+
className="openpress-workbench-toolbar-action"
|
|
172
|
+
data-openpress-inspector-toggle
|
|
173
|
+
data-openpress-inspector-active={inspectorMode ? "true" : "false"}
|
|
174
|
+
data-openpress-toolbar-expanded={inspectorToolbarExpanded ? "true" : "false"}
|
|
175
|
+
data-openpress-toolbar-active={inspectorToolbarExpanded ? "true" : "false"}
|
|
176
|
+
onClick={() => onInspectorModeChange(!inspectorMode)}
|
|
177
|
+
aria-pressed={inspectorMode}
|
|
178
|
+
title={inspectorMode ? "關閉註解" : "開啟註解"}
|
|
179
|
+
aria-label={inspectorMode ? "關閉註解" : "開啟註解"}
|
|
180
|
+
>
|
|
181
|
+
<MousePointer2 aria-hidden="true" />
|
|
182
|
+
<span className="openpress-workbench-toolbar-action__label">{inspectorMode ? "註解中" : "註解"}</span>
|
|
183
|
+
<span className="openpress-dev-inspector-status">{inspectorSelectionLabel}</span>
|
|
184
|
+
</button>
|
|
185
|
+
) : null}
|
|
186
|
+
{workspaceMode && inspectorMode ? (
|
|
187
|
+
<span
|
|
188
|
+
className="openpress-dev-inspector-status"
|
|
189
|
+
role="status"
|
|
190
|
+
aria-live="polite"
|
|
191
|
+
data-openpress-inspector-comment-status={inspectorCommentStatus}
|
|
192
|
+
>
|
|
193
|
+
{inspectorCommentStatusMessage}
|
|
194
|
+
</span>
|
|
195
|
+
) : null}
|
|
196
|
+
{localDeployEnabled ? (
|
|
197
|
+
<DeploymentControl
|
|
198
|
+
info={deploymentInfo}
|
|
199
|
+
status={deploymentStatus}
|
|
200
|
+
onDeploy={onDeploy}
|
|
201
|
+
/>
|
|
202
|
+
) : null}
|
|
203
|
+
</div>
|
|
204
|
+
</>
|
|
205
|
+
);
|
|
206
|
+
}
|
|
@@ -105,89 +105,6 @@ body {
|
|
|
105
105
|
font-size: 13px;
|
|
106
106
|
}
|
|
107
107
|
|
|
108
|
-
/* ── Action Overlay(部署)──────────────────────────────────── */
|
|
109
|
-
.openpress-action-overlay {
|
|
110
|
-
position: fixed;
|
|
111
|
-
inset: 0;
|
|
112
|
-
z-index: 200;
|
|
113
|
-
display: flex;
|
|
114
|
-
align-items: center;
|
|
115
|
-
justify-content: center;
|
|
116
|
-
background: rgb(10 10 10 / 72%);
|
|
117
|
-
backdrop-filter: blur(12px);
|
|
118
|
-
-webkit-backdrop-filter: blur(12px);
|
|
119
|
-
animation: openpress-overlay-in 0.18s ease both;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
@keyframes openpress-overlay-in {
|
|
123
|
-
from { opacity: 0; }
|
|
124
|
-
to { opacity: 1; }
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
.openpress-action-overlay__card {
|
|
128
|
-
display: flex;
|
|
129
|
-
flex-direction: column;
|
|
130
|
-
align-items: center;
|
|
131
|
-
gap: 10px;
|
|
132
|
-
border: 1px solid rgb(255 255 255 / 12%);
|
|
133
|
-
border-radius: 16px;
|
|
134
|
-
padding: 36px 48px;
|
|
135
|
-
background: rgb(22 22 22 / 96%);
|
|
136
|
-
box-shadow: 0 24px 64px rgb(0 0 0 / 60%);
|
|
137
|
-
text-align: center;
|
|
138
|
-
min-width: 220px;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
.openpress-action-overlay__title {
|
|
142
|
-
margin: 0;
|
|
143
|
-
color: #f2f2f0;
|
|
144
|
-
font-size: 15px;
|
|
145
|
-
font-weight: 600;
|
|
146
|
-
letter-spacing: 0.01em;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
.openpress-action-overlay__sub {
|
|
150
|
-
margin: 0;
|
|
151
|
-
color: rgb(200 200 200 / 60%);
|
|
152
|
-
font-size: 12px;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
/* ── Deploy Icon ─────────────────────────────────────────────── */
|
|
156
|
-
.openpress-deploy-icon {
|
|
157
|
-
position: relative;
|
|
158
|
-
width: 80px;
|
|
159
|
-
height: 80px;
|
|
160
|
-
display: flex;
|
|
161
|
-
align-items: center;
|
|
162
|
-
justify-content: center;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
.openpress-deploy-icon--deploying { color: var(--openpress-accent, #e5c97a); }
|
|
166
|
-
.openpress-deploy-icon--deployed { color: #6ee7a0; }
|
|
167
|
-
.openpress-deploy-icon--failed { color: #f87171; }
|
|
168
|
-
|
|
169
|
-
.openpress-deploy-rocket {
|
|
170
|
-
animation: openpress-rocket-fly 1.4s ease-in-out infinite alternate;
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
@keyframes openpress-rocket-fly {
|
|
174
|
-
from { transform: translateY(4px) rotate(-6deg); }
|
|
175
|
-
to { transform: translateY(-6px) rotate(6deg); }
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
.openpress-deploy-orbit {
|
|
179
|
-
position: absolute;
|
|
180
|
-
inset: 0;
|
|
181
|
-
width: 80px;
|
|
182
|
-
height: 80px;
|
|
183
|
-
animation: openpress-orbit-spin 2.4s linear infinite;
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
@keyframes openpress-orbit-spin {
|
|
187
|
-
from { transform: rotate(0deg); }
|
|
188
|
-
to { transform: rotate(360deg); }
|
|
189
|
-
}
|
|
190
|
-
|
|
191
108
|
/* ── Empty document state ───────────────────────────────────── */
|
|
192
109
|
|
|
193
110
|
.openpress-empty-state {
|
|
@@ -27,7 +27,6 @@
|
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
.openpress-workbench,
|
|
30
|
-
.openpress-public-shell,
|
|
31
30
|
.openpress-reader-app,
|
|
32
31
|
.openpress-reader-app.is-closed-left,
|
|
33
32
|
.openpress-reader-app.is-closed-right,
|
|
@@ -47,8 +46,7 @@
|
|
|
47
46
|
.reader-navbar,
|
|
48
47
|
.reader-side-nav,
|
|
49
48
|
.openpress-workspace-panel,
|
|
50
|
-
.openpress-public-identity
|
|
51
|
-
.openpress-html-page__toolbar {
|
|
49
|
+
.openpress-public-identity {
|
|
52
50
|
display: none !important;
|
|
53
51
|
}
|
|
54
52
|
|