@open-press/cli 0.5.0 → 0.7.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/dist/cli.js +114 -23
- package/package.json +1 -1
- package/template/core/CHANGELOG.md +97 -1
- package/template/core/README.md +9 -5
- package/template/core/engine/cli.mjs +2 -5
- package/template/core/engine/commands/_shared.mjs +4 -4
- package/template/core/engine/commands/deploy.mjs +1 -1
- package/template/core/engine/commands/inspect.mjs +3 -3
- package/template/core/engine/commands/replace.mjs +1 -1
- package/template/core/engine/commands/search.mjs +1 -1
- package/template/core/engine/commands/validate.mjs +2 -2
- package/template/core/engine/document-export.mjs +1 -1
- package/template/core/engine/{chrome-pdf.mjs → output/chrome-pdf.mjs} +1 -2
- package/template/core/engine/{deploy-sync.mjs → output/deploy-sync.mjs} +2 -2
- package/template/core/engine/{fonts.mjs → output/fonts.mjs} +1 -1
- package/template/core/engine/{public-assets.mjs → output/public-assets.mjs} +2 -2
- package/template/core/engine/{static-server.mjs → output/static-server.mjs} +2 -2
- package/template/core/engine/react/caption-numbering.mjs +73 -0
- package/template/core/engine/react/comment-marker.mjs +54 -10
- package/template/core/engine/react/document-entry.mjs +124 -64
- package/template/core/engine/react/document-export.mjs +252 -311
- package/template/core/engine/react/mdx-compile.mjs +123 -3
- package/template/core/engine/react/measurement-css.mjs +3 -3
- package/template/core/engine/react/pagination/allocator.mjs +122 -0
- package/template/core/engine/react/pagination/regions.mjs +81 -0
- package/template/core/engine/react/pagination.mjs +9 -121
- package/template/core/engine/react/pipeline/allocate.mjs +248 -0
- package/template/core/engine/react/pipeline/final-render.mjs +94 -0
- package/template/core/engine/react/pipeline/frame-measurement.mjs +271 -0
- package/template/core/engine/react/pipeline/press-tree.mjs +135 -0
- package/template/core/engine/react/project-asset-endpoint.mjs +2 -2
- package/template/core/engine/react/{chapter-css.mjs → section-css.mjs} +12 -9
- package/template/core/engine/react/sources/heading-numbering.mjs +132 -0
- package/template/core/engine/react/sources/mdx-resolver.mjs +441 -0
- package/template/core/engine/react/{workspace-discovery.mjs → style-discovery.mjs} +29 -40
- package/template/core/engine/{config.mjs → runtime/config.mjs} +15 -0
- package/template/core/engine/{file-utils.mjs → runtime/file-utils.mjs} +1 -1
- package/template/core/engine/{inspection.mjs → runtime/inspection.mjs} +3 -4
- package/template/core/engine/{source-text-tools.mjs → runtime/source-text-tools.mjs} +24 -7
- package/template/core/engine/runtime/source-workspace.mjs +186 -0
- package/template/core/engine/{validation.mjs → runtime/validation.mjs} +19 -17
- package/template/core/package.json +5 -2
- package/template/core/src/openpress/anchorMap.ts +27 -0
- package/template/core/src/openpress/core/Frame.tsx +80 -0
- package/template/core/src/openpress/core/FrameContext.tsx +19 -0
- package/template/core/src/openpress/core/MdxArea.tsx +35 -0
- package/template/core/src/openpress/core/Press.tsx +34 -0
- package/template/core/src/openpress/core/index.tsx +34 -15
- package/template/core/src/openpress/core/primitives.tsx +23 -0
- package/template/core/src/openpress/core/types.ts +131 -19
- package/template/core/src/openpress/core/useSource.ts +28 -0
- package/template/core/src/openpress/manuscript/index.tsx +196 -0
- package/template/core/src/openpress/mdx/index.ts +88 -0
- package/template/core/src/openpress/numbering/index.ts +294 -0
- package/template/core/src/openpress/publicPage.tsx +4 -186
- package/template/core/src/openpress/reactDocumentMetadata.ts +2 -16
- package/template/core/src/openpress/types.ts +0 -16
- package/template/core/src/openpress/workbench.tsx +2 -36
- package/template/core/src/styles/openpress/responsive.css +0 -14
- package/template/core/tsconfig.json +4 -1
- package/template/core/vite.config.ts +10 -3
- package/template/packs/academic-paper/document/chapters/01-introduction/content/01-introduction.mdx +21 -0
- package/template/packs/academic-paper/document/chapters/02-methods/content/01-methods.mdx +30 -0
- package/template/packs/academic-paper/document/chapters/03-results-and-discussion/content/01-results.mdx +29 -0
- package/template/packs/academic-paper/document/chapters/04-acknowledgment/content/01-acknowledgment.mdx +12 -0
- package/template/packs/academic-paper/document/chapters/05-references/content/01-references.mdx +27 -0
- package/template/packs/academic-paper/document/components/ChapterOpenerVisual/index.tsx +76 -0
- package/template/packs/academic-paper/document/components/Page.tsx +37 -0
- package/template/packs/academic-paper/document/components/TokenSwatchGrid/index.tsx +46 -0
- package/template/packs/academic-paper/document/components/TokenSwatchGrid/style.css +63 -0
- package/template/packs/academic-paper/document/components/TypeSpecimen/index.tsx +38 -0
- package/template/packs/academic-paper/document/components/TypeSpecimen/style.css +111 -0
- package/template/packs/academic-paper/document/design.md +279 -0
- package/template/packs/academic-paper/document/index.tsx +131 -0
- package/template/packs/academic-paper/document/media/README.md +13 -0
- package/template/packs/academic-paper/document/openpress.config.mjs +26 -0
- package/template/packs/academic-paper/document/theme/README.md +11 -0
- package/template/packs/academic-paper/document/theme/base/page-contract.css +505 -0
- package/template/packs/academic-paper/document/theme/base/print.css +93 -0
- package/template/packs/academic-paper/document/theme/base/typography.css +336 -0
- package/template/packs/academic-paper/document/theme/fonts.css +3 -0
- package/template/packs/academic-paper/document/theme/page-surfaces/back-cover.css +43 -0
- package/template/packs/academic-paper/document/theme/page-surfaces/chapter-opener.css +205 -0
- package/template/packs/academic-paper/document/theme/page-surfaces/cover.css +267 -0
- package/template/packs/academic-paper/document/theme/page-surfaces/toc.css +149 -0
- package/template/packs/academic-paper/document/theme/patterns/_chart-frame.css +49 -0
- package/template/packs/academic-paper/document/theme/patterns/figure-grid.css +68 -0
- package/template/packs/academic-paper/document/theme/patterns/table-utilities.css +66 -0
- package/template/packs/academic-paper/document/theme/shell/reader-controls.css +761 -0
- package/template/packs/academic-paper/document/theme/tokens.css +80 -0
- package/template/packs/academic-paper/openpress.config.mjs +5 -0
- package/template/packs/claude-document/document/components/Page.tsx +24 -14
- package/template/packs/claude-document/document/design.md +2 -2
- package/template/packs/claude-document/document/index.tsx +67 -62
- package/template/packs/claude-document/document/theme/page-surfaces/toc.css +19 -7
- package/template/packs/editorial-monograph/document/components/Page.tsx +24 -14
- package/template/packs/editorial-monograph/document/design.md +2 -2
- package/template/packs/editorial-monograph/document/index.tsx +71 -47
- package/template/packs/editorial-monograph/document/theme/page-surfaces/toc.css +19 -9
- package/template/core/engine/commands/migrate-to-react.mjs +0 -27
- package/template/core/engine/page-renderer.mjs +0 -217
- package/template/core/engine/react/migrate-to-react.mjs +0 -355
- package/template/core/engine/source-workspace.mjs +0 -76
- package/template/core/src/openpress/core/basePages.tsx +0 -87
- package/template/core/src/openpress/pagination.ts +0 -845
- package/template/packs/claude-document/document/chapters/01-document-shape/chapter.tsx +0 -30
- package/template/packs/claude-document/document/chapters/02-review-loop/chapter.tsx +0 -30
- /package/template/core/engine/{chrome-pdf.d.mts → output/chrome-pdf.d.mts} +0 -0
- /package/template/core/engine/{katex-assets.mjs → output/katex-assets.mjs} +0 -0
- /package/template/core/engine/{page-block.mjs → output/page-block.mjs} +0 -0
- /package/template/core/engine/{pdf-media.mjs → output/pdf-media.mjs} +0 -0
- /package/template/core/engine/{config.d.mts → runtime/config.d.mts} +0 -0
- /package/template/core/engine/{issue-report.mjs → runtime/issue-report.mjs} +0 -0
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
/* 深色 chrome(navbar / sidebar / app background) */
|
|
3
|
+
--openpress-color-app-bg: #161616;
|
|
4
|
+
--openpress-color-border-subtle: #393939;
|
|
5
|
+
--openpress-color-border-strong: #6f6f6f;
|
|
6
|
+
--openpress-color-text-on-dark: #f4f4f4;
|
|
7
|
+
--openpress-color-text-secondary: #c6c6c6;
|
|
8
|
+
--openpress-color-text-placeholder: #8d8d8d;
|
|
9
|
+
--openpress-color-focus: #0f62fe;
|
|
10
|
+
|
|
11
|
+
/* 文件本身(白底文件、墨色內文) */
|
|
12
|
+
--openpress-color-document: #ffffff;
|
|
13
|
+
--openpress-color-ink: #161616;
|
|
14
|
+
--openpress-color-muted: #6f6f6f;
|
|
15
|
+
--openpress-color-line: #e0e0e0;
|
|
16
|
+
--openpress-color-soft-line: #f4f4f4;
|
|
17
|
+
|
|
18
|
+
/* 表格狀態符號 */
|
|
19
|
+
--openpress-color-green: #24a148;
|
|
20
|
+
|
|
21
|
+
/* 圖表 palette(柔和暖色系)
|
|
22
|
+
* 用於 data-foundation、milestone-roadmap、cost-donut、revenue-line-chart 等元件。
|
|
23
|
+
* 排序由淺到深,可以對應 phase / tier 的進階感:
|
|
24
|
+
* gold (起始 / current) → coral (中期) → coral-deep (後期) → dark (anchor / 成熟)
|
|
25
|
+
*/
|
|
26
|
+
--openpress-chart-gold: #FFB000;
|
|
27
|
+
--openpress-chart-coral: #FF6A4D;
|
|
28
|
+
--openpress-chart-coral-deep: #C9522B;
|
|
29
|
+
--openpress-chart-dark: #1F2328;
|
|
30
|
+
--openpress-chart-cream: #FFF3DB;
|
|
31
|
+
--openpress-chart-warm-gray: #B0A89A;
|
|
32
|
+
|
|
33
|
+
/* 對應的背景 tint(較飽和、用於 phase / tier 卡片) */
|
|
34
|
+
--openpress-chart-gold-bg: rgba(255, 176, 0, 0.20);
|
|
35
|
+
--openpress-chart-coral-bg: rgba(255, 106, 77, 0.16);
|
|
36
|
+
--openpress-chart-coral-deep-bg: rgba(201, 82, 43, 0.14);
|
|
37
|
+
--openpress-chart-dark-bg: rgba(31, 35, 40, 0.09);
|
|
38
|
+
|
|
39
|
+
/* 對應的中等飽和邊框色(配合 background tint) */
|
|
40
|
+
--openpress-chart-gold-border: rgba(255, 176, 0, 0.55);
|
|
41
|
+
--openpress-chart-coral-border: rgba(255, 106, 77, 0.5);
|
|
42
|
+
--openpress-chart-coral-deep-border: rgba(201, 82, 43, 0.42);
|
|
43
|
+
--openpress-chart-dark-border: rgba(31, 35, 40, 0.28);
|
|
44
|
+
|
|
45
|
+
/* Status — 文件內行內語意強調色(warn / success / info),
|
|
46
|
+
* 用於 <span class="status-warn|status-success|status-info">。
|
|
47
|
+
* 避免按色相命名(accent-gold 之類)以強制走語意。 */
|
|
48
|
+
--openpress-status-warn: #C9522B;
|
|
49
|
+
--openpress-status-success: #5C8C4F;
|
|
50
|
+
--openpress-status-info: #4A6B8A;
|
|
51
|
+
|
|
52
|
+
/* 字型 */
|
|
53
|
+
--openpress-font-body: "IBM Plex Sans", "PingFang TC", "Noto Sans TC", "Hiragino Sans", "Microsoft JhengHei", sans-serif;
|
|
54
|
+
--openpress-font-serif: "Noto Serif TC", "Songti TC", "Source Han Serif TC", "PMingLiU", serif;
|
|
55
|
+
--openpress-font-mono: "SFMono-Regular", "Menlo", "Consolas", monospace;
|
|
56
|
+
|
|
57
|
+
/* 字級(固定 pt 用於小元素;標題改用 container queries 算) */
|
|
58
|
+
--openpress-text-sm: 9.5pt;
|
|
59
|
+
--openpress-text-md: 10.5pt;
|
|
60
|
+
|
|
61
|
+
/* 行距 */
|
|
62
|
+
--openpress-leading-body: 1.72;
|
|
63
|
+
--openpress-leading-table: 1.45;
|
|
64
|
+
|
|
65
|
+
/* 間距系統(mm 為主、適合 print 與 A4 視覺節奏) */
|
|
66
|
+
--openpress-space-1: 2mm;
|
|
67
|
+
--openpress-space-2: 4mm;
|
|
68
|
+
--openpress-space-3: 6mm;
|
|
69
|
+
--openpress-space-4: 9mm;
|
|
70
|
+
--openpress-space-5: 13mm;
|
|
71
|
+
|
|
72
|
+
/* Page geometry — A4 預設。
|
|
73
|
+
* 換成 B5 / Letter / 16:9 投影片時改這三條,其他 CSS 與 page-contract `@page`
|
|
74
|
+
* 都會跟著走。注意:@page size 改用 length pair 時,PDF 與瀏覽器 print 都會吃。 */
|
|
75
|
+
--openpress-page-width: 210mm;
|
|
76
|
+
--openpress-page-height: 297mm;
|
|
77
|
+
--openpress-page-aspect-ratio: 210 / 297;
|
|
78
|
+
--openpress-page-height-ratio: calc(297 / 210);
|
|
79
|
+
--openpress-page-margin: 18mm;
|
|
80
|
+
}
|
|
@@ -1,27 +1,37 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Frame, MdxArea } from "@open-press/core";
|
|
2
|
+
import type { SectionsPageProps } from "@open-press/core/manuscript";
|
|
2
3
|
|
|
3
4
|
export default function Page({
|
|
5
|
+
frameKey,
|
|
6
|
+
chainId,
|
|
4
7
|
pageIndex,
|
|
5
8
|
totalPages,
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}:
|
|
9
|
+
sectionSlug,
|
|
10
|
+
sectionTitle,
|
|
11
|
+
sectionTone,
|
|
12
|
+
}: SectionsPageProps) {
|
|
10
13
|
return (
|
|
11
|
-
<
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
14
|
+
<Frame
|
|
15
|
+
frameKey={frameKey}
|
|
16
|
+
role="manuscript.content"
|
|
17
|
+
className="reader-page--content"
|
|
15
18
|
data-page-index={pageIndex}
|
|
16
19
|
data-total-pages={totalPages}
|
|
17
|
-
data-
|
|
18
|
-
data-chapter-tone={
|
|
20
|
+
data-section-id={sectionSlug}
|
|
21
|
+
data-chapter-tone={sectionTone}
|
|
19
22
|
>
|
|
20
23
|
<div className="page-frame">
|
|
21
24
|
<header className="page-header" aria-hidden="true" />
|
|
22
|
-
<main className="page-body">
|
|
23
|
-
|
|
25
|
+
<main className="page-body">
|
|
26
|
+
<MdxArea chainId={chainId} />
|
|
27
|
+
</main>
|
|
28
|
+
<footer className="page-footer" aria-hidden="true">
|
|
29
|
+
<span className="footer-left">{sectionTitle}</span>
|
|
30
|
+
<span className="footer-right">
|
|
31
|
+
{totalPages > 1 ? `${pageIndex + 1}/${totalPages}` : pageIndex + 1}
|
|
32
|
+
</span>
|
|
33
|
+
</footer>
|
|
24
34
|
</div>
|
|
25
|
-
</
|
|
35
|
+
</Frame>
|
|
26
36
|
);
|
|
27
37
|
}
|
|
@@ -102,7 +102,7 @@ Claude Document 以 sans 作為主要閱讀字體,讓正文、表格與長段落
|
|
|
102
102
|
|
|
103
103
|
### Tables
|
|
104
104
|
|
|
105
|
-
Markdown table 前使用 `<TableCaption>...</TableCaption>`,內容只寫說明文字;
|
|
105
|
+
Markdown table 前使用 `<TableCaption>...</TableCaption>`,內容只寫說明文字;export pipeline 會輸出 `表 N:...`。不要手寫表號,也不要使用舊 `表:...` marker。
|
|
106
106
|
|
|
107
107
|
<TableCaption>表格使用規則</TableCaption>
|
|
108
108
|
|
|
@@ -114,7 +114,7 @@ Markdown table 前使用 `<TableCaption>...</TableCaption>`,內容只寫說明
|
|
|
114
114
|
|
|
115
115
|
### Figures
|
|
116
116
|
|
|
117
|
-
Figure component 應輸出標準 `<figure><figcaption>...</figcaption></figure>`。`figcaption` 只放 caption 文字,不放手寫圖號;
|
|
117
|
+
Figure component 應輸出標準 `<figure><figcaption>...</figcaption></figure>`。`figcaption` 只放 caption 文字,不放手寫圖號;export pipeline 會依 content pages 的 DOM 順序產生可見的 `圖 N:` / `表 N:` 前綴,並加上統一的 `data-openpress-caption="true"` 與 `data-openpress-caption-label`。
|
|
118
118
|
|
|
119
119
|
### Diagram Rules
|
|
120
120
|
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Frame, Press } from "@open-press/core";
|
|
2
|
+
import type { Manifest } from "@open-press/core";
|
|
3
|
+
import { mdxSource } from "@open-press/core/mdx";
|
|
4
|
+
import { Sections, Toc } from "@open-press/core/manuscript";
|
|
2
5
|
import ChapterOpenerVisual from "@/components/ChapterOpenerVisual";
|
|
6
|
+
import Page from "./components/Page";
|
|
3
7
|
|
|
4
8
|
export const config: Manifest = {
|
|
5
9
|
title: "Claude Document",
|
|
@@ -23,67 +27,68 @@ export const config: Manifest = {
|
|
|
23
27
|
},
|
|
24
28
|
};
|
|
25
29
|
|
|
26
|
-
export const
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
<
|
|
42
|
-
<
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
30
|
+
export const sources = {
|
|
31
|
+
story: mdxSource({ preset: "section-folders", root: "chapters" }),
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
function Cover() {
|
|
35
|
+
return (
|
|
36
|
+
<Frame
|
|
37
|
+
frameKey="cover"
|
|
38
|
+
role="manuscript.cover"
|
|
39
|
+
chrome={false}
|
|
40
|
+
className="reader-page--cover no-footer"
|
|
41
|
+
data-page-title="Cover"
|
|
42
|
+
aria-labelledby="document-title"
|
|
43
|
+
>
|
|
44
|
+
<ChapterOpenerVisual variant="overview" tone="sage" />
|
|
45
|
+
<div className="cover-main">
|
|
46
|
+
<h1 id="document-title" className="cover-title">
|
|
47
|
+
Claude
|
|
48
|
+
<br />
|
|
49
|
+
Document
|
|
50
|
+
</h1>
|
|
51
|
+
<p className="cover-author">
|
|
52
|
+
<span>Prepared for</span>
|
|
53
|
+
<strong>Working Notes</strong>
|
|
54
|
+
</p>
|
|
55
|
+
</div>
|
|
56
|
+
</Frame>
|
|
57
|
+
);
|
|
58
|
+
}
|
|
48
59
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
<
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
60
|
+
function BackCover() {
|
|
61
|
+
return (
|
|
62
|
+
<Frame
|
|
63
|
+
frameKey="back-cover"
|
|
64
|
+
role="manuscript.back-cover"
|
|
65
|
+
chrome={false}
|
|
66
|
+
className="reader-page--back-cover no-footer"
|
|
67
|
+
data-page-title="Back cover"
|
|
68
|
+
>
|
|
69
|
+
<ChapterOpenerVisual variant="overview" tone="sage" />
|
|
70
|
+
<div className="back-cover-main">
|
|
71
|
+
<h2 className="back-cover-title">
|
|
72
|
+
Claude
|
|
73
|
+
<br />
|
|
74
|
+
Document
|
|
63
75
|
</h2>
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
76
|
+
<p className="cover-author">
|
|
77
|
+
<span>Prepared for</span>
|
|
78
|
+
<strong>Working Notes</strong>
|
|
79
|
+
</p>
|
|
80
|
+
</div>
|
|
81
|
+
</Frame>
|
|
82
|
+
);
|
|
83
|
+
}
|
|
68
84
|
|
|
69
|
-
export
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
Claude
|
|
80
|
-
<br />
|
|
81
|
-
Document
|
|
82
|
-
</h2>
|
|
83
|
-
<p className="cover-author">
|
|
84
|
-
<span>Prepared for</span>
|
|
85
|
-
<strong>Working Notes</strong>
|
|
86
|
-
</p>
|
|
87
|
-
</div>
|
|
88
|
-
</section>
|
|
89
|
-
);
|
|
85
|
+
export default function ClaudeDocumentPress() {
|
|
86
|
+
return (
|
|
87
|
+
<Press>
|
|
88
|
+
<Cover />
|
|
89
|
+
<Toc source="story" heading={<h2 id="toc-title" className="toc-heading">Contents</h2>} />
|
|
90
|
+
<Sections source="story" page={Page} />
|
|
91
|
+
<BackCover />
|
|
92
|
+
</Press>
|
|
93
|
+
);
|
|
94
|
+
}
|
|
@@ -1,12 +1,26 @@
|
|
|
1
1
|
/* page-surfaces / toc
|
|
2
|
-
* Table-of-contents page surface
|
|
3
|
-
*
|
|
2
|
+
* Table-of-contents page surface rendered by the manuscript <Toc> helper.
|
|
3
|
+
* Entries flow through the generated toc:<sourceId> chain and TocArea.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
.reader-page--toc {
|
|
7
7
|
padding: 0;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
+
.reader-page--toc .page-frame {
|
|
11
|
+
grid-template-rows: auto minmax(0, 1fr);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.reader-page--toc .toc-header {
|
|
15
|
+
display: block;
|
|
16
|
+
overflow: visible;
|
|
17
|
+
opacity: 1;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.reader-page--toc .openpress-toc-area {
|
|
21
|
+
height: 100%;
|
|
22
|
+
}
|
|
23
|
+
|
|
10
24
|
.reader-page--toc h2 {
|
|
11
25
|
margin-top: 0;
|
|
12
26
|
font-family: var(--openpress-font-serif);
|
|
@@ -56,6 +70,7 @@
|
|
|
56
70
|
align-items: baseline;
|
|
57
71
|
color: var(--openpress-color-ink);
|
|
58
72
|
text-decoration: none;
|
|
73
|
+
font-family: var(--openpress-font-serif);
|
|
59
74
|
padding: 1.6mm 0;
|
|
60
75
|
font-weight: 400;
|
|
61
76
|
line-height: 1.38;
|
|
@@ -76,12 +91,8 @@
|
|
|
76
91
|
font-variant-numeric: tabular-nums;
|
|
77
92
|
font-weight: 400;
|
|
78
93
|
letter-spacing: 0;
|
|
79
|
-
font-size: calc(8pt - var(--openpress-type-step-down));
|
|
80
|
-
text-align: left;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
.toc-index {
|
|
84
94
|
font-size: 0;
|
|
95
|
+
text-align: left;
|
|
85
96
|
}
|
|
86
97
|
|
|
87
98
|
.toc-index::before {
|
|
@@ -140,6 +151,7 @@
|
|
|
140
151
|
gap: 3mm;
|
|
141
152
|
align-items: baseline;
|
|
142
153
|
color: var(--openpress-color-ink);
|
|
154
|
+
font-family: var(--openpress-font-serif);
|
|
143
155
|
}
|
|
144
156
|
|
|
145
157
|
.toc-title::after {
|
|
@@ -1,27 +1,37 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Frame, MdxArea } from "@open-press/core";
|
|
2
|
+
import type { SectionsPageProps } from "@open-press/core/manuscript";
|
|
2
3
|
|
|
3
4
|
export default function Page({
|
|
5
|
+
frameKey,
|
|
6
|
+
chainId,
|
|
4
7
|
pageIndex,
|
|
5
8
|
totalPages,
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}:
|
|
9
|
+
sectionSlug,
|
|
10
|
+
sectionTitle,
|
|
11
|
+
sectionTone,
|
|
12
|
+
}: SectionsPageProps) {
|
|
10
13
|
return (
|
|
11
|
-
<
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
14
|
+
<Frame
|
|
15
|
+
frameKey={frameKey}
|
|
16
|
+
role="manuscript.content"
|
|
17
|
+
className="reader-page--content"
|
|
15
18
|
data-page-index={pageIndex}
|
|
16
19
|
data-total-pages={totalPages}
|
|
17
|
-
data-
|
|
18
|
-
data-chapter-tone={
|
|
20
|
+
data-section-id={sectionSlug}
|
|
21
|
+
data-chapter-tone={sectionTone}
|
|
19
22
|
>
|
|
20
23
|
<div className="page-frame">
|
|
21
24
|
<header className="page-header" aria-hidden="true" />
|
|
22
|
-
<main className="page-body">
|
|
23
|
-
|
|
25
|
+
<main className="page-body">
|
|
26
|
+
<MdxArea chainId={chainId} />
|
|
27
|
+
</main>
|
|
28
|
+
<footer className="page-footer" aria-hidden="true">
|
|
29
|
+
<span className="footer-left">{sectionTitle}</span>
|
|
30
|
+
<span className="footer-right">
|
|
31
|
+
{totalPages > 1 ? `${pageIndex + 1}/${totalPages}` : pageIndex + 1}
|
|
32
|
+
</span>
|
|
33
|
+
</footer>
|
|
24
34
|
</div>
|
|
25
|
-
</
|
|
35
|
+
</Frame>
|
|
26
36
|
);
|
|
27
37
|
}
|
|
@@ -112,7 +112,7 @@ Block-level 強調(callout / warning / note)目前不在 design system 範圍;
|
|
|
112
112
|
|
|
113
113
|
### Chapter & Section Numbering
|
|
114
114
|
|
|
115
|
-
Engine 不在 h2/h3 內容前注入任何編號或前綴;
|
|
115
|
+
Engine 不在 h2/h3 內容前注入任何編號或前綴;export pipeline 會在 build-time 寫入 `data-chapter` / `data-section` attribute(值是 `01`、`1.1` 這種兩位數阿拉伯格式)。實際顯示樣式由 theme 的 `::before content` 決定,這讓不同文件能挑不同 numbering vocabulary 而不動 reader runtime。
|
|
116
116
|
|
|
117
117
|
預設(editorial-monograph 起手樣式):
|
|
118
118
|
|
|
@@ -258,7 +258,7 @@ body 內容區的 page padding(content margin)由 `.reader-page` 內的 `--page-
|
|
|
258
258
|
| 資料歸資料 | chart data 透過 React props 或鄰近的 typed data module 傳入,不寫死在 CSS |
|
|
259
259
|
| 樣式歸樣式 | chart frame 等通用規則放在 `document/theme/patterns/`;變體 CSS 放在元件自己的 `style.css` |
|
|
260
260
|
| 元件歸元件 | 一個視覺 = 一個 `document/components/ComponentName/` 包;MDX 只保留 `<ComponentName />` 呼叫 |
|
|
261
|
-
| Caption 必填 | caption 只寫說明文字,不手寫圖號或表號;
|
|
261
|
+
| Caption 必填 | caption 只寫說明文字,不手寫圖號或表號;export pipeline 會替 content pages 的 figure/table 自動編號 |
|
|
262
262
|
| PDF-safe | 圖表需 `break-inside: avoid`,高度不可壓到 footer |
|
|
263
263
|
|
|
264
264
|
如果使用者要求新的視覺元件,Agent 應先更新本檔說明,再改對應的 `document/components/<name>/style.css` 或 `document/theme/` CSS,最後用 reader 預覽檢查 PDF 輸出。
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import { Frame, Press } from "@open-press/core";
|
|
2
|
+
import type { Manifest } from "@open-press/core";
|
|
3
|
+
import { mdxSource } from "@open-press/core/mdx";
|
|
4
|
+
import { Sections, Toc } from "@open-press/core/manuscript";
|
|
5
|
+
import Page from "./components/Page";
|
|
3
6
|
|
|
4
7
|
export const config: Manifest = {
|
|
5
8
|
title: "open-press",
|
|
@@ -24,50 +27,71 @@ export const config: Manifest = {
|
|
|
24
27
|
},
|
|
25
28
|
};
|
|
26
29
|
|
|
27
|
-
export const
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
<
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
30
|
+
export const sources = {
|
|
31
|
+
story: mdxSource({ preset: "section-folders", root: "chapters" }),
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
function Cover() {
|
|
35
|
+
return (
|
|
36
|
+
<Frame
|
|
37
|
+
frameKey="cover"
|
|
38
|
+
role="manuscript.cover"
|
|
39
|
+
chrome={false}
|
|
40
|
+
className="reader-page--cover"
|
|
41
|
+
data-page-title="封面"
|
|
42
|
+
aria-labelledby="report-title"
|
|
43
|
+
>
|
|
44
|
+
<header className="cover-meta">
|
|
45
|
+
<span className="cover-meta-title">產品說明與使用文件</span>
|
|
46
|
+
</header>
|
|
47
|
+
<div className="cover-main">
|
|
48
|
+
<h1 id="report-title" className="cover-title">open-press</h1>
|
|
49
|
+
<p className="cover-tagline">AI-first fixed-layout document workspace</p>
|
|
50
|
+
<div className="cover-rule"></div>
|
|
51
|
+
<p className="cover-subtitle">為需要固定視覺樣式的長篇文件,建立可由 AI 協作、驗證與輸出的工作流。</p>
|
|
52
|
+
<p className="cover-summary">open-press 將內容、文件設計、視覺元件、預覽與 PDF 輸出收斂在同一個 workspace。</p>
|
|
53
|
+
</div>
|
|
54
|
+
<footer className="cover-byline">
|
|
55
|
+
<span>open-press</span>
|
|
56
|
+
<span>v0 Showcase</span>
|
|
57
|
+
</footer>
|
|
58
|
+
</Frame>
|
|
59
|
+
);
|
|
60
|
+
}
|
|
45
61
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
<
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
62
|
+
function BackCover() {
|
|
63
|
+
return (
|
|
64
|
+
<Frame
|
|
65
|
+
frameKey="back-cover"
|
|
66
|
+
role="manuscript.back-cover"
|
|
67
|
+
chrome={false}
|
|
68
|
+
className="reader-page--back-cover"
|
|
69
|
+
data-page-title="封底"
|
|
70
|
+
>
|
|
71
|
+
<header className="back-cover-meta">
|
|
72
|
+
<span className="cover-meta-title">產品說明、使用流程與 Agent 互動建議</span>
|
|
73
|
+
</header>
|
|
74
|
+
<div className="back-cover-main">
|
|
75
|
+
<p className="back-cover-kicker">open-press</p>
|
|
76
|
+
<div className="back-cover-rule"></div>
|
|
77
|
+
<p className="back-cover-statement">把長篇文件的寫作、設計與輸出,變成 Agent 可以參與、使用者可以審核、系統可以驗證的流程。</p>
|
|
78
|
+
<p className="back-cover-summary">從 style pack 起手,用 skill 協調寫作、設計、本機審稿、貢獻者工作流與部署檢查,再透過 open-press CLI 驗證、預覽與輸出。</p>
|
|
79
|
+
</div>
|
|
80
|
+
<footer className="back-cover-byline">
|
|
81
|
+
<span>open-press</span>
|
|
82
|
+
<span>v0 Showcase</span>
|
|
83
|
+
</footer>
|
|
84
|
+
</Frame>
|
|
85
|
+
);
|
|
86
|
+
}
|
|
56
87
|
|
|
57
|
-
export
|
|
58
|
-
|
|
59
|
-
<
|
|
60
|
-
<
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
<
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
</div>
|
|
68
|
-
<footer className="back-cover-byline">
|
|
69
|
-
<span>open-press</span>
|
|
70
|
-
<span>v0 Showcase</span>
|
|
71
|
-
</footer>
|
|
72
|
-
</BaseBackCoverPage>
|
|
73
|
-
);
|
|
88
|
+
export default function StoryPress() {
|
|
89
|
+
return (
|
|
90
|
+
<Press>
|
|
91
|
+
<Cover />
|
|
92
|
+
<Toc source="story" />
|
|
93
|
+
<Sections source="story" page={Page} />
|
|
94
|
+
<BackCover />
|
|
95
|
+
</Press>
|
|
96
|
+
);
|
|
97
|
+
}
|
|
@@ -1,12 +1,26 @@
|
|
|
1
1
|
/* page-surfaces / toc
|
|
2
|
-
* Table-of-contents page surface
|
|
3
|
-
*
|
|
2
|
+
* Table-of-contents page surface rendered by the manuscript <Toc> helper.
|
|
3
|
+
* Entries flow through the generated toc:<sourceId> chain and TocArea.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
.reader-page--toc {
|
|
7
7
|
padding: 0;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
+
.reader-page--toc .page-frame {
|
|
11
|
+
grid-template-rows: auto minmax(0, 1fr);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.reader-page--toc .toc-header {
|
|
15
|
+
display: block;
|
|
16
|
+
overflow: visible;
|
|
17
|
+
opacity: 1;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.reader-page--toc .openpress-toc-area {
|
|
21
|
+
height: 100%;
|
|
22
|
+
}
|
|
23
|
+
|
|
10
24
|
.reader-page--toc h2 {
|
|
11
25
|
margin-top: 0;
|
|
12
26
|
font-family: var(--openpress-font-serif);
|
|
@@ -18,13 +32,7 @@
|
|
|
18
32
|
}
|
|
19
33
|
|
|
20
34
|
.reader-page--toc h2.toc-heading--continuation {
|
|
21
|
-
|
|
22
|
-
color: var(--openpress-color-muted);
|
|
23
|
-
font-family: var(--openpress-font-mono);
|
|
24
|
-
font-size: calc(8.5pt - var(--openpress-type-step-down));
|
|
25
|
-
font-weight: 400;
|
|
26
|
-
letter-spacing: 0.08em;
|
|
27
|
-
text-align: right;
|
|
35
|
+
display: none;
|
|
28
36
|
}
|
|
29
37
|
|
|
30
38
|
.toc-list {
|
|
@@ -51,6 +59,7 @@
|
|
|
51
59
|
align-items: baseline;
|
|
52
60
|
color: var(--openpress-color-ink);
|
|
53
61
|
text-decoration: none;
|
|
62
|
+
font-family: var(--openpress-font-serif);
|
|
54
63
|
padding: 1.6mm 0;
|
|
55
64
|
font-weight: 400;
|
|
56
65
|
line-height: 1.38;
|
|
@@ -117,6 +126,7 @@
|
|
|
117
126
|
gap: 3mm;
|
|
118
127
|
align-items: baseline;
|
|
119
128
|
color: var(--openpress-color-ink);
|
|
129
|
+
font-family: var(--openpress-font-serif);
|
|
120
130
|
}
|
|
121
131
|
|
|
122
132
|
.toc-title::after {
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { migrateLegacyWorkspaceToReact } from "../react/migrate-to-react.mjs";
|
|
2
|
-
import { validateWorkspace } from "../validation.mjs";
|
|
3
|
-
|
|
4
|
-
export async function run({ root, config, options }) {
|
|
5
|
-
const result = await migrateLegacyWorkspaceToReact(root, config, {
|
|
6
|
-
dryRun: options.dryRun,
|
|
7
|
-
force: options.force,
|
|
8
|
-
});
|
|
9
|
-
|
|
10
|
-
if (options.json) {
|
|
11
|
-
console.log(JSON.stringify(result, null, 2));
|
|
12
|
-
return 0;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
const verb = options.dryRun ? "would create" : "created";
|
|
16
|
-
console.log(`OpenPress migrate-to-react ${verb} ${result.files.length} paths from ${result.sourceFiles} legacy files:`);
|
|
17
|
-
for (const file of result.files) {
|
|
18
|
-
console.log(` ${file.action.padEnd(5)} ${file.path}`);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
if (!options.dryRun) {
|
|
22
|
-
const report = await validateWorkspace(root);
|
|
23
|
-
console.log(report.ok ? `OpenPress validation OK\nChecked: ${report.checked.join(", ")}` : report.format());
|
|
24
|
-
return report.ok ? 0 : 1;
|
|
25
|
-
}
|
|
26
|
-
return 0;
|
|
27
|
-
}
|