@open-press/cli 0.8.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (250) hide show
  1. package/README.md +33 -23
  2. package/dist/cli.js +320 -252
  3. package/package.json +9 -8
  4. package/template/core/AGENTS.md +0 -126
  5. package/template/core/CHANGELOG.md +0 -215
  6. package/template/core/README.md +0 -40
  7. package/template/core/engine/cli.mjs +0 -96
  8. package/template/core/engine/commands/_shared.mjs +0 -177
  9. package/template/core/engine/commands/deploy.mjs +0 -31
  10. package/template/core/engine/commands/dev.mjs +0 -49
  11. package/template/core/engine/commands/doctor.mjs +0 -229
  12. package/template/core/engine/commands/export.mjs +0 -8
  13. package/template/core/engine/commands/init.mjs +0 -24
  14. package/template/core/engine/commands/inspect.mjs +0 -35
  15. package/template/core/engine/commands/pdf.mjs +0 -26
  16. package/template/core/engine/commands/preview.mjs +0 -26
  17. package/template/core/engine/commands/render.mjs +0 -17
  18. package/template/core/engine/commands/replace.mjs +0 -41
  19. package/template/core/engine/commands/search.mjs +0 -33
  20. package/template/core/engine/commands/typecheck.mjs +0 -5
  21. package/template/core/engine/commands/upgrade.mjs +0 -159
  22. package/template/core/engine/commands/validate.mjs +0 -17
  23. package/template/core/engine/document-export.mjs +0 -15
  24. package/template/core/engine/init.mjs +0 -90
  25. package/template/core/engine/output/chrome-pdf.d.mts +0 -34
  26. package/template/core/engine/output/chrome-pdf.mjs +0 -358
  27. package/template/core/engine/output/deploy-sync.mjs +0 -15
  28. package/template/core/engine/output/fonts.mjs +0 -62
  29. package/template/core/engine/output/katex-assets.mjs +0 -45
  30. package/template/core/engine/output/page-block.mjs +0 -30
  31. package/template/core/engine/output/pdf-media.mjs +0 -45
  32. package/template/core/engine/output/public-assets.mjs +0 -19
  33. package/template/core/engine/output/static-server.mjs +0 -532
  34. package/template/core/engine/react/caption-numbering.mjs +0 -73
  35. package/template/core/engine/react/comment-endpoint.d.mts +0 -11
  36. package/template/core/engine/react/comment-endpoint.mjs +0 -102
  37. package/template/core/engine/react/comment-marker.mjs +0 -374
  38. package/template/core/engine/react/document-entry.mjs +0 -324
  39. package/template/core/engine/react/document-export.mjs +0 -373
  40. package/template/core/engine/react/http-json.mjs +0 -24
  41. package/template/core/engine/react/mdx-compile.mjs +0 -599
  42. package/template/core/engine/react/measurement-css.mjs +0 -136
  43. package/template/core/engine/react/object-entities.mjs +0 -119
  44. package/template/core/engine/react/pagination/allocator.mjs +0 -122
  45. package/template/core/engine/react/pagination/regions.mjs +0 -81
  46. package/template/core/engine/react/pagination-constants.mjs +0 -3
  47. package/template/core/engine/react/pagination.mjs +0 -9
  48. package/template/core/engine/react/pipeline/allocate.mjs +0 -251
  49. package/template/core/engine/react/pipeline/final-render.mjs +0 -94
  50. package/template/core/engine/react/pipeline/frame-measurement.mjs +0 -302
  51. package/template/core/engine/react/pipeline/press-tree.mjs +0 -135
  52. package/template/core/engine/react/project-asset-endpoint.d.mts +0 -10
  53. package/template/core/engine/react/project-asset-endpoint.mjs +0 -361
  54. package/template/core/engine/react/section-css.mjs +0 -56
  55. package/template/core/engine/react/source-edit-endpoint.d.mts +0 -10
  56. package/template/core/engine/react/source-edit-endpoint.mjs +0 -75
  57. package/template/core/engine/react/sources/heading-numbering.mjs +0 -132
  58. package/template/core/engine/react/sources/mdx-resolver.mjs +0 -439
  59. package/template/core/engine/react/style-discovery.mjs +0 -142
  60. package/template/core/engine/runtime/config.d.mts +0 -40
  61. package/template/core/engine/runtime/config.mjs +0 -175
  62. package/template/core/engine/runtime/file-utils.mjs +0 -106
  63. package/template/core/engine/runtime/file-walk.mjs +0 -22
  64. package/template/core/engine/runtime/inspection.mjs +0 -328
  65. package/template/core/engine/runtime/issue-report.mjs +0 -44
  66. package/template/core/engine/runtime/path-utils.mjs +0 -20
  67. package/template/core/engine/runtime/source-text-tools.d.mts +0 -102
  68. package/template/core/engine/runtime/source-text-tools.mjs +0 -832
  69. package/template/core/engine/runtime/source-workspace.mjs +0 -159
  70. package/template/core/engine/runtime/validation.mjs +0 -174
  71. package/template/core/index.html +0 -13
  72. package/template/core/openpress.config.mjs +0 -12
  73. package/template/core/package.json +0 -91
  74. package/template/core/src/main.tsx +0 -16
  75. package/template/core/src/openpress/app/OpenPressApp.tsx +0 -140
  76. package/template/core/src/openpress/app/OpenPressRuntime.tsx +0 -94
  77. package/template/core/src/openpress/app/index.ts +0 -2
  78. package/template/core/src/openpress/core/Frame.tsx +0 -78
  79. package/template/core/src/openpress/core/FrameContext.tsx +0 -24
  80. package/template/core/src/openpress/core/MdxArea.tsx +0 -34
  81. package/template/core/src/openpress/core/Press.tsx +0 -34
  82. package/template/core/src/openpress/core/cn.ts +0 -4
  83. package/template/core/src/openpress/core/index.tsx +0 -40
  84. package/template/core/src/openpress/core/primitives.tsx +0 -44
  85. package/template/core/src/openpress/core/types.ts +0 -191
  86. package/template/core/src/openpress/core/useSource.ts +0 -28
  87. package/template/core/src/openpress/document-model/anchorMapModel.ts +0 -27
  88. package/template/core/src/openpress/document-model/documentIndexes.ts +0 -329
  89. package/template/core/src/openpress/document-model/documentTypes.ts +0 -138
  90. package/template/core/src/openpress/document-model/index.ts +0 -6
  91. package/template/core/src/openpress/document-model/objectEntityModel.ts +0 -51
  92. package/template/core/src/openpress/document-model/projectIdentityModel.ts +0 -15
  93. package/template/core/src/openpress/document-model/reactDocumentMetadataModel.ts +0 -27
  94. package/template/core/src/openpress/manuscript/index.tsx +0 -238
  95. package/template/core/src/openpress/mdx/index.ts +0 -88
  96. package/template/core/src/openpress/numbering/index.ts +0 -294
  97. package/template/core/src/openpress/reader/PublicReaderPage.tsx +0 -267
  98. package/template/core/src/openpress/reader/ReaderNavigationPanel.tsx +0 -123
  99. package/template/core/src/openpress/reader/index.ts +0 -10
  100. package/template/core/src/openpress/reader/pageViewportScaleModel.ts +0 -73
  101. package/template/core/src/openpress/reader/readerPageRegistry.ts +0 -41
  102. package/template/core/src/openpress/reader/readerPageRoute.ts +0 -21
  103. package/template/core/src/openpress/reader/readerScroll.ts +0 -92
  104. package/template/core/src/openpress/reader/readerStateModel.ts +0 -15
  105. package/template/core/src/openpress/reader/readerTypes.ts +0 -4
  106. package/template/core/src/openpress/reader/usePageViewportScale.ts +0 -119
  107. package/template/core/src/openpress/reader/usePanelState.ts +0 -56
  108. package/template/core/src/openpress/reader/useReaderHashSync.ts +0 -61
  109. package/template/core/src/openpress/reader/useReaderKeyboardNav.ts +0 -48
  110. package/template/core/src/openpress/reader/useReaderRuntime.ts +0 -146
  111. package/template/core/src/openpress/reader/useReaderScrollAnchor.ts +0 -64
  112. package/template/core/src/openpress/shared/Panel.tsx +0 -77
  113. package/template/core/src/openpress/shared/frameScheduler.ts +0 -32
  114. package/template/core/src/openpress/shared/index.ts +0 -4
  115. package/template/core/src/openpress/shared/numberUtils.ts +0 -3
  116. package/template/core/src/openpress/shared/runtimeMode.ts +0 -11
  117. package/template/core/src/openpress/workbench/Workbench.tsx +0 -407
  118. package/template/core/src/openpress/workbench/actions/DeploymentControl.tsx +0 -157
  119. package/template/core/src/openpress/workbench/actions/PageZoomControl.tsx +0 -182
  120. package/template/core/src/openpress/workbench/actions/SearchControl.tsx +0 -345
  121. package/template/core/src/openpress/workbench/actions/deploymentStatusModel.ts +0 -112
  122. package/template/core/src/openpress/workbench/actions/index.ts +0 -5
  123. package/template/core/src/openpress/workbench/actions/useDeploymentWorkbench.ts +0 -136
  124. package/template/core/src/openpress/workbench/dialog/WorkbenchDialog.tsx +0 -72
  125. package/template/core/src/openpress/workbench/dialog/index.ts +0 -1
  126. package/template/core/src/openpress/workbench/document/components/DocumentPanel.tsx +0 -127
  127. package/template/core/src/openpress/workbench/document/components/InlineSourceEditorLayer.tsx +0 -207
  128. package/template/core/src/openpress/workbench/document/components/ReaderStage.tsx +0 -9
  129. package/template/core/src/openpress/workbench/document/hooks/useDocumentWorkbenchModel.ts +0 -34
  130. package/template/core/src/openpress/workbench/document/hooks/useInlineDocumentEditor.ts +0 -525
  131. package/template/core/src/openpress/workbench/document/index.ts +0 -10
  132. package/template/core/src/openpress/workbench/index.ts +0 -2
  133. package/template/core/src/openpress/workbench/inspector/InlineInspectorLayer.tsx +0 -459
  134. package/template/core/src/openpress/workbench/inspector/index.ts +0 -5
  135. package/template/core/src/openpress/workbench/inspector/inlineCommentModel.ts +0 -125
  136. package/template/core/src/openpress/workbench/inspector/inspectorGeometryModel.ts +0 -160
  137. package/template/core/src/openpress/workbench/inspector/inspectorModel.ts +0 -408
  138. package/template/core/src/openpress/workbench/inspector/useInspectorComments.ts +0 -248
  139. package/template/core/src/openpress/workbench/mentions/MentionSuggestionList.tsx +0 -41
  140. package/template/core/src/openpress/workbench/mentions/index.ts +0 -2
  141. package/template/core/src/openpress/workbench/mentions/useComposerMentions.ts +0 -185
  142. package/template/core/src/openpress/workbench/panels/Panel.tsx +0 -1
  143. package/template/core/src/openpress/workbench/panels/PendingCommentsPanel.tsx +0 -76
  144. package/template/core/src/openpress/workbench/panels/WorkbenchControlPanel.tsx +0 -29
  145. package/template/core/src/openpress/workbench/panels/index.ts +0 -3
  146. package/template/core/src/openpress/workbench/project/ProjectEntryPanel.tsx +0 -523
  147. package/template/core/src/openpress/workbench/project/ProjectPreviewDialog.tsx +0 -35
  148. package/template/core/src/openpress/workbench/project/index.ts +0 -2
  149. package/template/core/src/openpress/workbench/project/projectPreviewTypes.ts +0 -11
  150. package/template/core/src/openpress/workbench/project/projectSourceModel.ts +0 -24
  151. package/template/core/src/openpress/workbench/shell/WorkbenchShell.tsx +0 -167
  152. package/template/core/src/openpress/workbench/shell/index.ts +0 -1
  153. package/template/core/src/openpress/workbench/workbenchFormatters.ts +0 -120
  154. package/template/core/src/openpress/workbench/workbenchTypes.ts +0 -35
  155. package/template/core/src/styles/openpress/app-shell.css +0 -251
  156. package/template/core/src/styles/openpress/media-workspace.css +0 -230
  157. package/template/core/src/styles/openpress/print-route.css +0 -184
  158. package/template/core/src/styles/openpress/project-preview-panel.css +0 -924
  159. package/template/core/src/styles/openpress/public-viewer.css +0 -688
  160. package/template/core/src/styles/openpress/reader-runtime.css +0 -980
  161. package/template/core/src/styles/openpress/responsive.css +0 -245
  162. package/template/core/src/styles/openpress/workbench-panels.css +0 -594
  163. package/template/core/src/styles/openpress/workbench.css +0 -1255
  164. package/template/core/src/styles/openpress.css +0 -14
  165. package/template/core/src/vite-env.d.ts +0 -9
  166. package/template/core/tsconfig.json +0 -40
  167. package/template/core/vite.config.ts +0 -584
  168. package/template/packs/academic-paper/document/chapters/01-introduction/content/01-introduction.mdx +0 -35
  169. package/template/packs/academic-paper/document/chapters/02-methods/content/01-methods.mdx +0 -50
  170. package/template/packs/academic-paper/document/chapters/03-results-and-discussion/content/01-results.mdx +0 -47
  171. package/template/packs/academic-paper/document/chapters/04-acknowledgment/content/01-acknowledgment.mdx +0 -26
  172. package/template/packs/academic-paper/document/chapters/05-references/content/01-references.mdx +0 -32
  173. package/template/packs/academic-paper/document/components/ChapterOpenerVisual/index.tsx +0 -76
  174. package/template/packs/academic-paper/document/components/Page.tsx +0 -60
  175. package/template/packs/academic-paper/document/components/TokenSwatchGrid/index.tsx +0 -46
  176. package/template/packs/academic-paper/document/components/TokenSwatchGrid/style.css +0 -63
  177. package/template/packs/academic-paper/document/components/TypeSpecimen/index.tsx +0 -38
  178. package/template/packs/academic-paper/document/components/TypeSpecimen/style.css +0 -111
  179. package/template/packs/academic-paper/document/design.md +0 -279
  180. package/template/packs/academic-paper/document/index.tsx +0 -123
  181. package/template/packs/academic-paper/document/media/README.md +0 -13
  182. package/template/packs/academic-paper/document/media/figure-placeholder.svg +0 -9
  183. package/template/packs/academic-paper/document/openpress.config.mjs +0 -26
  184. package/template/packs/academic-paper/document/theme/README.md +0 -11
  185. package/template/packs/academic-paper/document/theme/base/page-contract.css +0 -522
  186. package/template/packs/academic-paper/document/theme/base/print.css +0 -93
  187. package/template/packs/academic-paper/document/theme/base/typography.css +0 -333
  188. package/template/packs/academic-paper/document/theme/fonts.css +0 -3
  189. package/template/packs/academic-paper/document/theme/page-surfaces/back-cover.css +0 -43
  190. package/template/packs/academic-paper/document/theme/page-surfaces/chapter-opener.css +0 -205
  191. package/template/packs/academic-paper/document/theme/page-surfaces/cover.css +0 -294
  192. package/template/packs/academic-paper/document/theme/page-surfaces/toc.css +0 -149
  193. package/template/packs/academic-paper/document/theme/patterns/_chart-frame.css +0 -49
  194. package/template/packs/academic-paper/document/theme/patterns/figure-grid.css +0 -68
  195. package/template/packs/academic-paper/document/theme/patterns/table-utilities.css +0 -66
  196. package/template/packs/academic-paper/document/theme/shell/reader-controls.css +0 -761
  197. package/template/packs/academic-paper/document/theme/tokens.css +0 -80
  198. package/template/packs/academic-paper/openpress.config.mjs +0 -5
  199. package/template/packs/claude-document/document/chapters/01-document-shape/content/01-document-shape.mdx +0 -51
  200. package/template/packs/claude-document/document/chapters/02-review-loop/content/01-review-loop.mdx +0 -31
  201. package/template/packs/claude-document/document/components/ChapterOpenerVisual.tsx +0 -96
  202. package/template/packs/claude-document/document/components/Page.tsx +0 -37
  203. package/template/packs/claude-document/document/design.md +0 -142
  204. package/template/packs/claude-document/document/index.tsx +0 -94
  205. package/template/packs/claude-document/document/media/README.md +0 -13
  206. package/template/packs/claude-document/document/openpress.config.mjs +0 -26
  207. package/template/packs/claude-document/document/theme/README.md +0 -15
  208. package/template/packs/claude-document/document/theme/base/page-contract.css +0 -525
  209. package/template/packs/claude-document/document/theme/base/print.css +0 -93
  210. package/template/packs/claude-document/document/theme/base/typography.css +0 -612
  211. package/template/packs/claude-document/document/theme/fonts.css +0 -4
  212. package/template/packs/claude-document/document/theme/page-surfaces/back-cover.css +0 -72
  213. package/template/packs/claude-document/document/theme/page-surfaces/chapter-opener.css +0 -236
  214. package/template/packs/claude-document/document/theme/page-surfaces/cover.css +0 -309
  215. package/template/packs/claude-document/document/theme/page-surfaces/toc.css +0 -225
  216. package/template/packs/claude-document/document/theme/patterns/_chart-frame.css +0 -53
  217. package/template/packs/claude-document/document/theme/patterns/figure-grid.css +0 -68
  218. package/template/packs/claude-document/document/theme/patterns/table-utilities.css +0 -66
  219. package/template/packs/claude-document/document/theme/shell/reader-controls.css +0 -789
  220. package/template/packs/claude-document/document/theme/tokens.css +0 -89
  221. package/template/packs/claude-document/openpress.config.mjs +0 -5
  222. package/template/packs/editorial-monograph/document/chapters/01-product-and-use-cases/content/01-product-and-use-cases.mdx +0 -31
  223. package/template/packs/editorial-monograph/document/chapters/02-workflow/content/01-workflow.mdx +0 -89
  224. package/template/packs/editorial-monograph/document/chapters/03-agent-skills-contributors/content/01-agent-skills-contributors.mdx +0 -51
  225. package/template/packs/editorial-monograph/document/chapters/04-validation-deploy/content/01-validation-deploy.mdx +0 -39
  226. package/template/packs/editorial-monograph/document/components/ChapterOpenerVisual/index.tsx +0 -76
  227. package/template/packs/editorial-monograph/document/components/Page.tsx +0 -37
  228. package/template/packs/editorial-monograph/document/components/TokenSwatchGrid/index.tsx +0 -46
  229. package/template/packs/editorial-monograph/document/components/TokenSwatchGrid/style.css +0 -63
  230. package/template/packs/editorial-monograph/document/components/TypeSpecimen/index.tsx +0 -38
  231. package/template/packs/editorial-monograph/document/components/TypeSpecimen/style.css +0 -111
  232. package/template/packs/editorial-monograph/document/design.md +0 -279
  233. package/template/packs/editorial-monograph/document/index.tsx +0 -97
  234. package/template/packs/editorial-monograph/document/media/README.md +0 -13
  235. package/template/packs/editorial-monograph/document/openpress.config.mjs +0 -26
  236. package/template/packs/editorial-monograph/document/theme/README.md +0 -11
  237. package/template/packs/editorial-monograph/document/theme/base/page-contract.css +0 -505
  238. package/template/packs/editorial-monograph/document/theme/base/print.css +0 -93
  239. package/template/packs/editorial-monograph/document/theme/base/typography.css +0 -336
  240. package/template/packs/editorial-monograph/document/theme/fonts.css +0 -3
  241. package/template/packs/editorial-monograph/document/theme/page-surfaces/back-cover.css +0 -43
  242. package/template/packs/editorial-monograph/document/theme/page-surfaces/chapter-opener.css +0 -205
  243. package/template/packs/editorial-monograph/document/theme/page-surfaces/cover.css +0 -147
  244. package/template/packs/editorial-monograph/document/theme/page-surfaces/toc.css +0 -149
  245. package/template/packs/editorial-monograph/document/theme/patterns/_chart-frame.css +0 -49
  246. package/template/packs/editorial-monograph/document/theme/patterns/figure-grid.css +0 -68
  247. package/template/packs/editorial-monograph/document/theme/patterns/table-utilities.css +0 -66
  248. package/template/packs/editorial-monograph/document/theme/shell/reader-controls.css +0 -761
  249. package/template/packs/editorial-monograph/document/theme/tokens.css +0 -80
  250. package/template/packs/editorial-monograph/openpress.config.mjs +0 -5
@@ -1,167 +0,0 @@
1
- import { createContext, useContext, type CSSProperties, type ReactNode } from "react";
2
- import { PanelLeftClose, PanelLeftOpen, PanelRightClose, PanelRightOpen, X } from "lucide-react";
3
-
4
- type WorkbenchShellContextValue = {
5
- leftPanelOpen: boolean;
6
- rightPanelOpen: boolean;
7
- onToggleLeftPanel: () => void;
8
- onToggleRightPanel: () => void;
9
- };
10
-
11
- const WorkbenchShellContext = createContext<WorkbenchShellContextValue | null>(null);
12
-
13
- function useWorkbenchShell() {
14
- const value = useContext(WorkbenchShellContext);
15
- if (!value) throw new Error("WorkbenchShell compound components must be rendered inside <WorkbenchShell>.");
16
- return value;
17
- }
18
-
19
- function WorkbenchShellRoot({
20
- style,
21
- devMode,
22
- viewMode,
23
- inspectorMode,
24
- editMode = false,
25
- leftPanelOpen,
26
- rightPanelOpen,
27
- onToggleLeftPanel,
28
- onToggleRightPanel,
29
- children,
30
- }: {
31
- style: CSSProperties;
32
- devMode: boolean;
33
- viewMode: string;
34
- inspectorMode: boolean;
35
- editMode?: boolean;
36
- leftPanelOpen: boolean;
37
- rightPanelOpen: boolean;
38
- onToggleLeftPanel: () => void;
39
- onToggleRightPanel: () => void;
40
- children: ReactNode;
41
- }) {
42
- const scrimOpen = leftPanelOpen || rightPanelOpen;
43
- const handleScrimClick = rightPanelOpen ? onToggleRightPanel : onToggleLeftPanel;
44
- const shellClassName = [
45
- "reader-app openpress-reader-app openpress-public-viewer openpress-dev-public-viewer openpress-workbench-shell is-ready",
46
- leftPanelOpen ? "" : "is-closed-left",
47
- rightPanelOpen ? "" : "is-closed-right",
48
- ].filter(Boolean).join(" ");
49
-
50
- return (
51
- <WorkbenchShellContext.Provider value={{ leftPanelOpen, rightPanelOpen, onToggleLeftPanel, onToggleRightPanel }}>
52
- <main className="openpress-workbench" style={style} data-dev-mode={devMode ? "true" : "false"}>
53
- <div
54
- className={shellClassName}
55
- data-openpress-react-runtime="true"
56
- data-openpress-view-mode={viewMode}
57
- data-openpress-inspector-mode={inspectorMode ? "on" : "off"}
58
- data-openpress-edit-mode={editMode ? "on" : "off"}
59
- data-openpress-workbench-shell
60
- data-testid="workbench-shell"
61
- >
62
- {scrimOpen ? (
63
- <div className="openpress-public-scrim" aria-hidden="true" onClick={handleScrimClick} />
64
- ) : null}
65
- {children}
66
- </div>
67
- </main>
68
- </WorkbenchShellContext.Provider>
69
- );
70
- }
71
-
72
- export function WorkbenchToolbar({ children }: { children: ReactNode }) {
73
- const {
74
- leftPanelOpen,
75
- rightPanelOpen,
76
- onToggleLeftPanel,
77
- onToggleRightPanel,
78
- } = useWorkbenchShell();
79
- const LeftIcon = leftPanelOpen ? PanelLeftClose : PanelLeftOpen;
80
- const RightIcon = rightPanelOpen ? PanelRightClose : PanelRightOpen;
81
- const leftLabel = leftPanelOpen ? "收合左側面板" : "展開左側面板";
82
- const rightLabel = rightPanelOpen ? "收合右側面板" : "展開右側面板";
83
-
84
- return (
85
- <header
86
- className="openpress-workbench-toolbar"
87
- role="toolbar"
88
- aria-label="工作台操作"
89
- data-openpress-workbench-toolbar
90
- >
91
- <button
92
- type="button"
93
- className="openpress-workbench-toolbar-panel-toggle"
94
- data-openpress-toggle-left-panel
95
- data-openpress-panel-open={leftPanelOpen ? "true" : "false"}
96
- aria-label={leftLabel}
97
- title={leftLabel}
98
- onClick={onToggleLeftPanel}
99
- >
100
- <LeftIcon aria-hidden="true" />
101
- </button>
102
- <div className="openpress-workbench-toolbar__content">
103
- {children}
104
- </div>
105
- <button
106
- type="button"
107
- className="openpress-workbench-toolbar-panel-toggle"
108
- data-openpress-toggle-right-panel
109
- data-openpress-panel-open={rightPanelOpen ? "true" : "false"}
110
- aria-label={rightLabel}
111
- title={rightLabel}
112
- onClick={onToggleRightPanel}
113
- >
114
- <RightIcon aria-hidden="true" />
115
- </button>
116
- </header>
117
- );
118
- }
119
-
120
- function WorkbenchLeftPanel({ children }: { children: ReactNode }) {
121
- return (
122
- <aside
123
- className="reader-side-nav openpress-workspace-panel openpress-workbench-left-panel openpress-public-navigation"
124
- aria-label="文件導覽"
125
- data-openpress-left-panel
126
- >
127
- {children}
128
- </aside>
129
- );
130
- }
131
-
132
- function WorkbenchRightPanel({ children }: { children: ReactNode }) {
133
- const { onToggleRightPanel } = useWorkbenchShell();
134
-
135
- return (
136
- <aside
137
- className="openpress-workspace-panel openpress-workbench-right-panel openpress-dev-public-navigation"
138
- aria-label="控制面板"
139
- data-openpress-right-panel
140
- >
141
- <button type="button" className="openpress-public-drawer-close" aria-label="關閉右側面板" onClick={onToggleRightPanel}>
142
- <X size={16} aria-hidden="true" />
143
- </button>
144
- {children}
145
- </aside>
146
- );
147
- }
148
-
149
- function WorkbenchMainContent({ children }: { children: ReactNode }) {
150
- return (
151
- <section
152
- className="openpress-workbench__stage openpress-workbench-main openpress-public-viewer__stage openpress-dev-main-content"
153
- aria-label="主要內容"
154
- data-openpress-main-content
155
- >
156
- {children}
157
- </section>
158
- );
159
- }
160
-
161
- export const WorkbenchShell = Object.assign(WorkbenchShellRoot, {
162
- Toolbar: WorkbenchToolbar,
163
- LeftPanel: WorkbenchLeftPanel,
164
- RightPanel: WorkbenchRightPanel,
165
- ControlPanel: WorkbenchRightPanel,
166
- MainContent: WorkbenchMainContent,
167
- });
@@ -1 +0,0 @@
1
- export * from "./WorkbenchShell";
@@ -1,120 +0,0 @@
1
- import type { InspectorPlacement } from "./inspector";
2
- import type { ObjectEntity, SourceBlock, Theme } from "../document-model";
3
- import type { PendingCommentsStatus, InspectorCommentStatus } from "./workbenchTypes";
4
-
5
- export type PageGeometrySpec = {
6
- label: string;
7
- dimensions: string;
8
- title: string;
9
- };
10
-
11
- const DEFAULT_PAGE_GEOMETRY = {
12
- pageWidth: "210mm",
13
- pageHeight: "297mm",
14
- };
15
-
16
- export function formatInspectorSelection(block: SourceBlock | null, entity?: ObjectEntity | null) {
17
- if (entity) return entity.label;
18
- if (!block) return "未選取";
19
- const line = block.source?.line;
20
- return line ? `${block.path}:${line}` : block.path;
21
- }
22
-
23
- export function formatInspectorCommentStatus(status: InspectorCommentStatus, error: string) {
24
- if (status === "submitting") return "寫入中";
25
- if (status === "saved") return "已寫入 source";
26
- if (status === "failed") return error || "寫入失敗";
27
- return "";
28
- }
29
-
30
- export function formatCommentsCount(count: number, status: PendingCommentsStatus) {
31
- if (status === "loading") return "正在讀取";
32
- if (status === "clearing") return "正在清除";
33
- return `${count} 則待處理`;
34
- }
35
-
36
- export function formatPageGeometrySpec(theme?: Pick<Theme, "pageWidth" | "pageHeight">): PageGeometrySpec {
37
- const width = parseCssLength(theme?.pageWidth ?? DEFAULT_PAGE_GEOMETRY.pageWidth);
38
- const height = parseCssLength(theme?.pageHeight ?? DEFAULT_PAGE_GEOMETRY.pageHeight);
39
- const dimensions = formatLengthPair(width, height);
40
- const label = pageGeometryLabel(width, height);
41
-
42
- return {
43
- label,
44
- dimensions,
45
- title: `${label} · ${dimensions}`,
46
- };
47
- }
48
-
49
- export function parseCommentHint(hint?: string) {
50
- if (!hint?.startsWith("openpress-react-inspector")) return null;
51
- const intent = hint.match(/\bintent=(add|edit|delete)\b/)?.[1];
52
- const placement = hint.match(/\bplacement=(block|before)\b/)?.[1] as InspectorPlacement | undefined;
53
- const targetObjectId = decodeHintValue(hint.match(/\btarget=([^\s]+)/)?.[1]);
54
- const intentLabel = intent === "add" ? "Add" : intent === "delete" ? "Remove" : "Edit";
55
- const placementLabel = placement === "before" ? "插入於區塊前" : "針對目前區塊";
56
- return { intent: intent ?? "edit", intentLabel, placement: placement ?? "block", placementLabel, targetObjectId };
57
- }
58
-
59
- export function formatCommentTimestamp(value: string) {
60
- const date = new Date(value);
61
- if (Number.isNaN(date.getTime())) return value;
62
- return new Intl.DateTimeFormat("zh-TW", {
63
- month: "2-digit",
64
- day: "2-digit",
65
- hour: "2-digit",
66
- minute: "2-digit",
67
- hour12: false,
68
- }).format(date);
69
- }
70
-
71
- function pageGeometryLabel(width: CssLength, height: CssLength) {
72
- if (matchesPageSize(width, height, "210", "297", "mm")) return "A4 Page";
73
- if (matchesPageSize(width, height, "176", "250", "mm")) return "B5 Page";
74
- if (matchesPageSize(width, height, "215.9", "279.4", "mm")) return "Letter Page";
75
- if (isSixteenByNine(width, height)) return "16:9 Page";
76
- return "Custom Page";
77
- }
78
-
79
- type CssLength = {
80
- raw: string;
81
- value: string | null;
82
- unit: string | null;
83
- };
84
-
85
- function parseCssLength(value: string): CssLength {
86
- const raw = value.trim();
87
- const match = raw.match(/^(-?\d+(?:\.\d+)?)([a-z%]+)$/i);
88
- if (!match) return { raw, value: null, unit: null };
89
- return { raw, value: trimTrailingZeroes(match[1]), unit: match[2] };
90
- }
91
-
92
- function formatLengthPair(width: CssLength, height: CssLength) {
93
- if (width.value && height.value && width.unit && width.unit === height.unit) {
94
- return `${width.value} × ${height.value} ${width.unit}`;
95
- }
96
- return `${width.raw} × ${height.raw}`;
97
- }
98
-
99
- function matchesPageSize(width: CssLength, height: CssLength, targetWidth: string, targetHeight: string, unit: string) {
100
- return width.value === targetWidth && height.value === targetHeight && width.unit === unit && height.unit === unit;
101
- }
102
-
103
- function isSixteenByNine(width: CssLength, height: CssLength) {
104
- if (!width.value || !height.value || !width.unit || width.unit !== height.unit) return false;
105
- const ratio = Number(width.value) / Number(height.value);
106
- return ratio > 1 && Math.abs(ratio - (16 / 9)) < 0.02;
107
- }
108
-
109
- function decodeHintValue(value?: string) {
110
- if (!value) return undefined;
111
- try {
112
- return decodeURIComponent(value);
113
- } catch {
114
- return value;
115
- }
116
- }
117
-
118
- function trimTrailingZeroes(value: string) {
119
- return value.replace(/\.0+$/, "").replace(/(\.\d*?)0+$/, "$1");
120
- }
@@ -1,35 +0,0 @@
1
- import type { InspectorPlacement, ObjectSelection } from "./inspector/inspectorModel";
2
-
3
- export type DeployStatus = "idle" | "deploying" | "deployed" | "unavailable" | "failed" | "setup";
4
- export type PdfActionStatus = "idle" | "generating" | "opening" | "failed";
5
- export type InspectorCommentStatus = "idle" | "submitting" | "saved" | "failed";
6
- export type PendingCommentsStatus = "idle" | "loading" | "ready" | "failed" | "clearing";
7
-
8
- export interface InlineSavedComment {
9
- id: string;
10
- objectId?: string;
11
- blockId?: string;
12
- placement: InspectorPlacement;
13
- note: string;
14
- path?: string;
15
- line?: number;
16
- timestamp?: string;
17
- markerLabel?: string;
18
- }
19
-
20
- export interface InlineSavedCommentMarkerEntry {
21
- target: ObjectSelection;
22
- comments: InlineSavedComment[];
23
- }
24
-
25
- export interface InspectorLayerRect {
26
- top: number;
27
- left: number;
28
- width: number;
29
- height: number;
30
- }
31
-
32
- export interface InspectorInsertTargetView {
33
- blockId: string;
34
- rect: InspectorLayerRect;
35
- }
@@ -1,251 +0,0 @@
1
- :root {
2
- --openpress-scrollbar-track: #141414;
3
- --openpress-scrollbar-track-sidebar: #171717;
4
- --openpress-scrollbar-thumb: rgb(255 255 255 / 18%);
5
- --openpress-scrollbar-thumb-hover: rgb(255 255 255 / 28%);
6
-
7
- color-scheme: dark;
8
- color: var(--openpress-text);
9
- background: #141414;
10
- font-family: var(--openpress-font-family);
11
- scrollbar-color: var(--openpress-scrollbar-thumb) var(--openpress-scrollbar-track);
12
- scrollbar-width: thin;
13
- }
14
-
15
- * {
16
- box-sizing: border-box;
17
- }
18
-
19
- *::-webkit-scrollbar {
20
- width: 10px;
21
- height: 10px;
22
- }
23
-
24
- *::-webkit-scrollbar-track {
25
- background: transparent;
26
- }
27
-
28
- *::-webkit-scrollbar-thumb {
29
- border: 3px solid transparent;
30
- border-radius: 999px;
31
- background-color: var(--openpress-scrollbar-thumb);
32
- background-clip: content-box;
33
- }
34
-
35
- *::-webkit-scrollbar-thumb:hover {
36
- background-color: var(--openpress-scrollbar-thumb-hover);
37
- }
38
-
39
- *::-webkit-scrollbar-corner {
40
- background: transparent;
41
- }
42
-
43
- body {
44
- margin: 0;
45
- overflow-x: hidden;
46
- scrollbar-color: var(--openpress-scrollbar-thumb) var(--openpress-scrollbar-track);
47
- scrollbar-width: thin;
48
- }
49
-
50
- /* ── Full-page loading screen ───────────────────────────────── */
51
- .openpress-loading-screen {
52
- position: fixed;
53
- inset: 0;
54
- display: flex;
55
- align-items: center;
56
- justify-content: center;
57
- background: #141414;
58
- }
59
-
60
- .openpress-loading-screen__inner {
61
- display: flex;
62
- flex-direction: column;
63
- align-items: center;
64
- gap: 20px;
65
- }
66
-
67
- .openpress-loading-screen__label {
68
- color: rgb(200 200 200 / 40%);
69
- font-size: 12px;
70
- letter-spacing: 0.12em;
71
- text-transform: uppercase;
72
- }
73
-
74
- .openpress-loading-dots {
75
- display: flex;
76
- gap: 8px;
77
- }
78
-
79
- .openpress-loading-dots span {
80
- width: 6px;
81
- height: 6px;
82
- border-radius: 50%;
83
- background: var(--openpress-accent, #e5c97a);
84
- animation: openpress-dot-pulse 1.2s ease-in-out infinite;
85
- }
86
-
87
- .openpress-loading-dots span:nth-child(2) { animation-delay: 0.2s; }
88
- .openpress-loading-dots span:nth-child(3) { animation-delay: 0.4s; }
89
-
90
- @keyframes openpress-dot-pulse {
91
- 0%, 80%, 100% { opacity: 0.15; transform: scale(0.8); }
92
- 40% { opacity: 1; transform: scale(1); }
93
- }
94
-
95
- .openpress-load-state {
96
- position: fixed;
97
- top: 16px;
98
- left: 50%;
99
- z-index: 20;
100
- transform: translateX(-50%);
101
- border: 1px solid rgb(255 255 255 / 14%);
102
- padding: 8px 12px;
103
- background: rgb(20 20 20 / 86%);
104
- color: #d8dadd;
105
- font-size: 13px;
106
- }
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
- /* ── Empty document state ───────────────────────────────────── */
192
-
193
- .openpress-empty-state {
194
- display: grid;
195
- place-items: center;
196
- min-height: 100vh;
197
- padding: 48px 24px;
198
- }
199
-
200
- .openpress-empty-state__panel {
201
- max-width: 560px;
202
- border: 1px solid var(--openpress-scrollbar-thumb);
203
- border-radius: 8px;
204
- padding: 36px 32px;
205
- background: rgb(255 255 255 / 3%);
206
- color: var(--openpress-text-on-dark, #f4f4f4);
207
- }
208
-
209
- .openpress-empty-state__eyebrow {
210
- margin: 0 0 8px;
211
- font-size: 12px;
212
- font-weight: 600;
213
- letter-spacing: 0.16em;
214
- text-transform: uppercase;
215
- color: var(--openpress-text-secondary, #c6c6c6);
216
- }
217
-
218
- .openpress-empty-state__title {
219
- margin: 0 0 16px;
220
- font-size: 22px;
221
- font-weight: 500;
222
- line-height: 1.4;
223
- }
224
-
225
- .openpress-empty-state__body {
226
- margin: 0 0 16px;
227
- font-size: 14px;
228
- line-height: 1.6;
229
- color: var(--openpress-text-secondary, #c6c6c6);
230
- }
231
-
232
- .openpress-empty-state__body code,
233
- .openpress-empty-state__steps code {
234
- padding: 1px 6px;
235
- border-radius: 4px;
236
- background: rgb(255 255 255 / 8%);
237
- font-family: var(--openpress-font-mono, "SFMono-Regular", "Menlo", monospace);
238
- font-size: 13px;
239
- }
240
-
241
- .openpress-empty-state__steps {
242
- margin: 0;
243
- padding-left: 1.2em;
244
- font-size: 14px;
245
- line-height: 1.7;
246
- color: var(--openpress-text-secondary, #c6c6c6);
247
- }
248
-
249
- .openpress-empty-state__steps li {
250
- margin-bottom: 4px;
251
- }