@open-press/core 0.7.0 → 0.8.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 (116) hide show
  1. package/engine/commands/dev.mjs +2 -2
  2. package/engine/commands/upgrade.mjs +47 -5
  3. package/engine/output/chrome-pdf.mjs +18 -3
  4. package/engine/output/static-server.mjs +39 -0
  5. package/engine/react/comment-endpoint.mjs +13 -39
  6. package/engine/react/comment-marker.mjs +30 -6
  7. package/engine/react/document-entry.mjs +11 -0
  8. package/engine/react/document-export.mjs +45 -5
  9. package/engine/react/http-json.mjs +24 -0
  10. package/engine/react/mdx-compile.mjs +187 -3
  11. package/engine/react/measurement-css.mjs +93 -1
  12. package/engine/react/object-entities.mjs +119 -0
  13. package/engine/react/pipeline/allocate.mjs +10 -7
  14. package/engine/react/pipeline/frame-measurement.mjs +40 -9
  15. package/engine/react/project-asset-endpoint.mjs +6 -24
  16. package/engine/react/source-edit-endpoint.d.mts +10 -0
  17. package/engine/react/source-edit-endpoint.mjs +75 -0
  18. package/engine/react/sources/mdx-resolver.mjs +12 -14
  19. package/engine/react/style-discovery.mjs +1 -4
  20. package/engine/runtime/file-walk.mjs +22 -0
  21. package/engine/runtime/inspection.mjs +1 -20
  22. package/engine/runtime/path-utils.mjs +20 -0
  23. package/engine/runtime/source-text-tools.d.mts +102 -0
  24. package/engine/runtime/source-text-tools.mjs +551 -16
  25. package/engine/runtime/source-workspace.mjs +4 -31
  26. package/package.json +1 -1
  27. package/src/openpress/{App.tsx → app/OpenPressApp.tsx} +25 -12
  28. package/src/openpress/{renderer.tsx → app/OpenPressRuntime.tsx} +10 -7
  29. package/src/openpress/app/index.ts +2 -0
  30. package/src/openpress/core/Frame.tsx +9 -11
  31. package/src/openpress/core/FrameContext.tsx +8 -3
  32. package/src/openpress/core/MdxArea.tsx +11 -12
  33. package/src/openpress/core/cn.ts +4 -0
  34. package/src/openpress/core/index.tsx +2 -1
  35. package/src/openpress/core/primitives.tsx +29 -8
  36. package/src/openpress/core/types.ts +8 -0
  37. package/src/openpress/{anchorMap.ts → document-model/anchorMapModel.ts} +1 -1
  38. package/src/openpress/{indexes.ts → document-model/documentIndexes.ts} +1 -1
  39. package/src/openpress/{types.ts → document-model/documentTypes.ts} +42 -0
  40. package/src/openpress/document-model/index.ts +6 -0
  41. package/src/openpress/document-model/objectEntityModel.ts +51 -0
  42. package/src/openpress/{projectIdentity.ts → document-model/projectIdentityModel.ts} +1 -1
  43. package/src/openpress/{reactDocumentMetadata.ts → document-model/reactDocumentMetadataModel.ts} +1 -1
  44. package/src/openpress/manuscript/index.tsx +49 -7
  45. package/src/openpress/{publicPage.tsx → reader/PublicReaderPage.tsx} +31 -51
  46. package/src/openpress/{workbenchPanels.tsx → reader/ReaderNavigationPanel.tsx} +6 -5
  47. package/src/openpress/reader/index.ts +10 -0
  48. package/src/openpress/reader/pageViewportScaleModel.ts +73 -0
  49. package/src/openpress/reader/readerTypes.ts +4 -0
  50. package/src/openpress/reader/usePageViewportScale.ts +119 -0
  51. package/src/openpress/reader/usePanelState.ts +56 -0
  52. package/src/openpress/reader/useReaderHashSync.ts +61 -0
  53. package/src/openpress/reader/useReaderKeyboardNav.ts +48 -0
  54. package/src/openpress/reader/useReaderRuntime.ts +146 -0
  55. package/src/openpress/reader/useReaderScrollAnchor.ts +64 -0
  56. package/src/openpress/shared/Panel.tsx +77 -0
  57. package/src/openpress/shared/index.ts +4 -0
  58. package/src/openpress/shared/numberUtils.ts +3 -0
  59. package/src/openpress/{runtimeMode.ts → shared/runtimeMode.ts} +0 -11
  60. package/src/openpress/workbench/Workbench.tsx +407 -0
  61. package/src/openpress/workbench/actions/DeploymentControl.tsx +157 -0
  62. package/src/openpress/workbench/actions/PageZoomControl.tsx +182 -0
  63. package/src/openpress/workbench/actions/SearchControl.tsx +345 -0
  64. package/src/openpress/workbench/actions/deploymentStatusModel.ts +112 -0
  65. package/src/openpress/workbench/actions/index.ts +5 -0
  66. package/src/openpress/workbench/actions/useDeploymentWorkbench.ts +136 -0
  67. package/src/openpress/workbench/dialog/WorkbenchDialog.tsx +72 -0
  68. package/src/openpress/workbench/dialog/index.ts +1 -0
  69. package/src/openpress/workbench/document/components/DocumentPanel.tsx +127 -0
  70. package/src/openpress/workbench/document/components/InlineSourceEditorLayer.tsx +207 -0
  71. package/src/openpress/workbench/document/components/ReaderStage.tsx +9 -0
  72. package/src/openpress/workbench/document/hooks/useDocumentWorkbenchModel.ts +34 -0
  73. package/src/openpress/workbench/document/hooks/useInlineDocumentEditor.ts +525 -0
  74. package/src/openpress/workbench/document/index.ts +10 -0
  75. package/src/openpress/workbench/index.ts +2 -0
  76. package/src/openpress/workbench/inspector/InlineInspectorLayer.tsx +459 -0
  77. package/src/openpress/workbench/inspector/index.ts +5 -0
  78. package/src/openpress/workbench/inspector/inlineCommentModel.ts +125 -0
  79. package/src/openpress/workbench/inspector/inspectorGeometryModel.ts +160 -0
  80. package/src/openpress/workbench/inspector/inspectorModel.ts +408 -0
  81. package/src/openpress/workbench/inspector/useInspectorComments.ts +248 -0
  82. package/src/openpress/workbench/mentions/MentionSuggestionList.tsx +41 -0
  83. package/src/openpress/workbench/mentions/index.ts +2 -0
  84. package/src/openpress/{composerMentions.ts → workbench/mentions/useComposerMentions.ts} +1 -4
  85. package/src/openpress/workbench/panels/Panel.tsx +1 -0
  86. package/src/openpress/workbench/panels/PendingCommentsPanel.tsx +76 -0
  87. package/src/openpress/workbench/panels/WorkbenchControlPanel.tsx +29 -0
  88. package/src/openpress/workbench/panels/index.ts +3 -0
  89. package/src/openpress/workbench/project/ProjectEntryPanel.tsx +523 -0
  90. package/src/openpress/workbench/project/ProjectPreviewDialog.tsx +35 -0
  91. package/src/openpress/workbench/project/index.ts +2 -0
  92. package/src/openpress/workbench/project/projectPreviewTypes.ts +11 -0
  93. package/src/openpress/workbench/shell/WorkbenchShell.tsx +167 -0
  94. package/src/openpress/workbench/shell/index.ts +1 -0
  95. package/src/openpress/workbench/workbenchFormatters.ts +120 -0
  96. package/src/openpress/workbench/workbenchTypes.ts +35 -0
  97. package/src/styles/openpress/print-route.css +0 -2
  98. package/src/styles/openpress/{project-workspace.css → project-preview-panel.css} +13 -407
  99. package/src/styles/openpress/public-viewer.css +25 -320
  100. package/src/styles/openpress/reader-runtime.css +243 -55
  101. package/src/styles/openpress/responsive.css +145 -270
  102. package/src/styles/openpress/workbench-panels.css +214 -178
  103. package/src/styles/openpress/workbench.css +986 -451
  104. package/src/styles/openpress.css +1 -1
  105. package/vite.config.ts +50 -0
  106. package/src/openpress/inspector.ts +0 -282
  107. package/src/openpress/projectWorkspace.tsx +0 -919
  108. package/src/openpress/readerRuntime.ts +0 -230
  109. package/src/openpress/workbench.tsx +0 -1265
  110. package/src/openpress/workbenchTypes.ts +0 -4
  111. /package/src/openpress/{readerPageRegistry.ts → reader/readerPageRegistry.ts} +0 -0
  112. /package/src/openpress/{pageRoute.ts → reader/readerPageRoute.ts} +0 -0
  113. /package/src/openpress/{readerScroll.ts → reader/readerScroll.ts} +0 -0
  114. /package/src/openpress/{readerState.ts → reader/readerStateModel.ts} +0 -0
  115. /package/src/openpress/{frameScheduler.ts → shared/frameScheduler.ts} +0 -0
  116. /package/src/openpress/{projectSources.ts → workbench/project/projectSourceModel.ts} +0 -0
@@ -9,215 +9,66 @@
9
9
  scrollbar-width: none;
10
10
  }
11
11
 
12
- .openpress-reader-app .reader-thumb-strip {
13
- display: flex;
14
- flex-direction: column;
15
- overflow: hidden;
16
- }
17
-
18
12
  .openpress-reader-app .reader-side-nav {
19
13
  display: grid;
20
14
  grid-template-rows: auto auto minmax(0, 1fr);
21
15
  overflow: hidden;
22
16
  }
23
17
 
24
- .openpress-workspace-panel--left {
25
- padding: 18px 14px 26px;
26
- border-right: 1px solid rgb(255 255 255 / 8%);
18
+ .openpress-document-panel {
19
+ display: grid;
20
+ height: 100%;
21
+ min-height: 0;
22
+ grid-template-rows: auto minmax(0, 1fr);
23
+ overflow: hidden;
27
24
  }
28
25
 
29
- .openpress-workspace-panel--right {
30
- min-width: 300px;
31
- border-left: 1px solid rgb(255 255 255 / 8%);
32
- padding: 0;
26
+ .openpress-dev-control-tabs.openpress-document-panel-tabs {
27
+ grid-template-columns: repeat(2, minmax(0, 1fr));
28
+ margin: 0 22px;
29
+ padding-top: 2px;
33
30
  }
34
31
 
35
- .openpress-reader-app.is-closed-right .openpress-workspace-panel--right,
36
- .openpress-reader-app.is-closed-left.is-closed-right .openpress-workspace-panel--right {
37
- min-width: 0;
32
+ .openpress-document-panel [data-openpress-document-panel-tab-panel] {
33
+ min-height: 0;
34
+ overflow: hidden;
38
35
  }
39
36
 
40
- .openpress-left-nav-tabs {
41
- display: grid;
42
- flex: 0 0 auto;
43
- grid-template-columns: repeat(3, minmax(0, 1fr));
44
- gap: 4px;
37
+ .openpress-document-panel [data-openpress-document-panel-tab-panel][hidden] {
38
+ display: none;
45
39
  }
46
40
 
47
- .openpress-left-nav-tab {
41
+ .openpress-document-panel [data-openpress-document-panel-tab-panel]:not([hidden]) {
48
42
  display: grid;
49
- min-width: 0;
50
- grid-template-columns: auto minmax(0, 1fr) auto;
51
- gap: 5px;
52
- align-items: center;
53
- border: 1px solid rgb(255 255 255 / 10%);
54
- padding: 7px 7px;
55
- background: rgb(255 255 255 / 3%);
56
- color: #858b92;
57
- font: inherit;
58
- font-size: 11px;
59
- line-height: 1;
60
- cursor: pointer;
61
- transition:
62
- border-color 160ms ease,
63
- background 160ms ease,
64
- color 160ms ease;
65
43
  }
66
44
 
67
- .openpress-left-nav-tab:hover,
68
- .openpress-left-nav-tab.is-active {
69
- border-color: rgb(223 75 33 / 45%);
70
- background: rgb(223 75 33 / 10%);
71
- color: #f2f2f0;
72
- }
73
-
74
- .openpress-left-nav-tab svg {
75
- width: 13px;
76
- height: 13px;
77
- color: var(--openpress-accent);
78
- }
79
-
80
- .openpress-left-nav-tab span {
45
+ .openpress-document-panel__comments,
46
+ .openpress-document-panel__project {
47
+ min-height: 0;
81
48
  overflow: hidden;
82
- min-width: 0;
83
- text-overflow: ellipsis;
84
- white-space: nowrap;
85
- }
86
-
87
- .openpress-left-nav-tab small {
88
- color: #676e76;
89
- font-size: 10px;
90
- font-variant-numeric: tabular-nums;
91
- }
92
-
93
- .openpress-left-nav-tab.is-active small {
94
- color: #b5babf;
95
49
  }
96
50
 
97
- .openpress-left-nav-body {
98
- display: flex;
51
+ .openpress-control-panel {
52
+ display: grid;
53
+ align-content: start;
99
54
  min-height: 0;
100
- flex: 1 1 auto;
101
- flex-direction: column;
55
+ gap: 22px;
56
+ padding: 18px 22px 18px;
102
57
  overflow: auto;
103
58
  scrollbar-width: none;
104
59
  }
105
60
 
106
- .openpress-left-nav-body::-webkit-scrollbar {
61
+ .openpress-control-panel::-webkit-scrollbar {
107
62
  width: 0;
108
63
  height: 0;
109
64
  display: none;
110
65
  }
111
66
 
112
- .openpress-left-page-list,
113
- .openpress-left-asset-list {
114
- display: flex;
67
+ .openpress-control-panel .openpress-comments-panel--embedded,
68
+ .openpress-control-panel .openpress-project-panel {
115
69
  min-height: 0;
116
- flex-direction: column;
117
- gap: 14px;
118
- }
119
-
120
- .openpress-left-asset-list {
121
- gap: 4px;
122
- }
123
-
124
- .openpress-left-asset-item {
125
- display: grid;
126
- width: 100%;
127
- min-width: 0;
128
- grid-template-columns: 42px minmax(0, 1fr);
129
- gap: 10px;
130
- align-items: baseline;
131
- border: 0;
132
- padding: 9px 0;
133
- background: transparent;
134
- color: #8e949b;
135
- font: inherit;
136
- text-align: left;
137
- cursor: pointer;
138
- }
139
-
140
- .openpress-left-asset-item:hover,
141
- .openpress-left-asset-item.is-active {
142
- color: #f2f2f0;
143
- }
144
-
145
- .openpress-left-asset-label {
146
- color: #d95a36;
147
- font-size: 11px;
148
- font-variant-numeric: tabular-nums;
149
- white-space: nowrap;
150
- }
151
-
152
- .openpress-left-asset-item--table .openpress-left-asset-label {
153
- color: #d7a034;
154
- }
155
-
156
- .openpress-left-asset-copy {
157
- display: grid;
158
- min-width: 0;
159
- gap: 3px;
160
- }
161
-
162
- .openpress-left-asset-copy strong {
163
- overflow: hidden;
164
- display: -webkit-box;
165
- color: inherit;
166
- font-size: 12px;
167
- font-weight: 500;
168
- line-height: 1.35;
169
- word-break: keep-all;
170
- -webkit-box-orient: vertical;
171
- -webkit-line-clamp: 2;
172
- }
173
-
174
- .openpress-left-asset-copy small {
175
- overflow: hidden;
176
- color: #626970;
177
- font-size: 10px;
178
- line-height: 1.25;
179
- text-overflow: ellipsis;
180
- white-space: nowrap;
181
- }
182
-
183
- .openpress-left-nav-empty {
184
- margin: 0;
185
- padding: 12px 2px;
186
- color: #70777f;
187
- font-size: 12px;
188
- line-height: 1.45;
189
- }
190
-
191
- .openpress-reader-app .thumb-strip-frame {
192
- outline-color: rgb(255 255 255 / 10%);
193
- box-shadow: 0 8px 18px rgb(0 0 0 / 18%);
194
- }
195
-
196
- .openpress-reader-app .thumb-strip-content {
197
- display: block;
198
- height: calc(980px * var(--openpress-page-height-ratio, 1.4142857143));
199
- transform: scale(0.195);
200
- transform-origin: 0 0;
201
- }
202
-
203
- .openpress-reader-app .thumb-strip-content .reader-page {
204
- display: block !important;
205
- width: 980px !important;
206
- height: auto !important;
207
- max-height: none !important;
208
- overflow: hidden !important;
209
- box-shadow: none !important;
210
- transform: none !important;
211
- }
212
-
213
- .openpress-reader-app .thumb-strip-item.is-active .thumb-strip-frame {
214
- outline: 2px solid rgb(223 75 33 / 80%);
215
- outline-offset: 2px;
216
- box-shadow: 0 0 0 1px rgb(0 0 0 / 55%), 0 6px 20px rgb(223 75 33 / 24%);
217
- }
218
-
219
- .openpress-reader-app .thumb-strip-item.is-active .thumb-strip-label {
220
- color: #f2f2f0;
70
+ padding: 0;
71
+ overflow: visible;
221
72
  }
222
73
 
223
74
  .openpress-reader-app .reader-side-nav .reader-bookmarks {
@@ -556,3 +407,188 @@
556
407
  color: #696f75;
557
408
  font-size: 12px;
558
409
  }
410
+
411
+ .openpress-panel {
412
+ min-width: 0;
413
+ min-height: 0;
414
+ color: rgb(232 232 228 / 92%);
415
+ }
416
+
417
+ .openpress-panel-header {
418
+ display: grid;
419
+ min-width: 0;
420
+ grid-template-columns: minmax(0, 1fr) auto;
421
+ gap: 12px;
422
+ align-items: end;
423
+ border-bottom: 1px solid rgb(255 255 255 / 9%);
424
+ padding-bottom: 12px;
425
+ }
426
+
427
+ .openpress-panel-heading-stack {
428
+ display: grid;
429
+ min-width: 0;
430
+ gap: 3px;
431
+ }
432
+
433
+ .openpress-panel-kicker {
434
+ display: block;
435
+ margin: 0;
436
+ color: rgb(160 166 173 / 60%);
437
+ font-family: var(--openpress-font-mono);
438
+ font-size: 10px;
439
+ font-weight: 650;
440
+ line-height: 1;
441
+ letter-spacing: 0.04em;
442
+ text-transform: uppercase;
443
+ }
444
+
445
+ .openpress-panel-title {
446
+ min-width: 0;
447
+ margin: 0;
448
+ overflow: hidden;
449
+ break-after: auto;
450
+ color: rgb(242 242 240 / 94%);
451
+ font-family: inherit;
452
+ font-size: 14px;
453
+ font-weight: 700;
454
+ line-height: 1.35;
455
+ letter-spacing: 0;
456
+ text-overflow: ellipsis;
457
+ white-space: nowrap;
458
+ }
459
+
460
+ .openpress-panel-title::before {
461
+ display: none;
462
+ content: none;
463
+ }
464
+
465
+ .openpress-panel-description,
466
+ .openpress-panel-section-description {
467
+ min-width: 0;
468
+ margin: 0;
469
+ color: rgb(160 166 173 / 64%);
470
+ font-size: 11px;
471
+ line-height: 1.4;
472
+ }
473
+
474
+ .openpress-panel-actions {
475
+ display: flex;
476
+ min-width: 0;
477
+ flex-wrap: wrap;
478
+ gap: 8px;
479
+ justify-content: flex-end;
480
+ }
481
+
482
+ .openpress-panel-action-button {
483
+ display: inline-flex;
484
+ min-width: 0;
485
+ min-height: 30px;
486
+ align-items: center;
487
+ justify-content: center;
488
+ gap: 7px;
489
+ border: 1px solid rgb(255 255 255 / 12%);
490
+ border-radius: 6px;
491
+ padding: 6px 9px;
492
+ background: rgb(255 255 255 / 5%);
493
+ color: rgb(242 242 240 / 90%);
494
+ font: inherit;
495
+ font-size: 11px;
496
+ font-weight: 700;
497
+ line-height: 1;
498
+ cursor: pointer;
499
+ }
500
+
501
+ .openpress-panel-action-button:hover:not(:disabled) {
502
+ border-color: rgb(255 255 255 / 20%);
503
+ background: rgb(255 255 255 / 8%);
504
+ }
505
+
506
+ .openpress-panel-action-button:disabled {
507
+ cursor: not-allowed;
508
+ opacity: 0.46;
509
+ }
510
+
511
+ .openpress-panel-action-button svg {
512
+ width: 14px;
513
+ height: 14px;
514
+ flex: 0 0 auto;
515
+ }
516
+
517
+ .openpress-panel-body {
518
+ display: grid;
519
+ min-width: 0;
520
+ min-height: 0;
521
+ align-content: start;
522
+ gap: 10px;
523
+ }
524
+
525
+ .openpress-panel > .openpress-panel-section,
526
+ .openpress-panel-body > .openpress-panel-section {
527
+ display: grid;
528
+ min-width: 0;
529
+ min-height: 0;
530
+ gap: 10px;
531
+ border-top: 1px solid rgb(255 255 255 / 8%);
532
+ padding: 14px 0;
533
+ }
534
+
535
+ .openpress-panel > .openpress-panel-section:first-child,
536
+ .openpress-panel-body > .openpress-panel-section:first-child {
537
+ border-top: 0;
538
+ padding-top: 0;
539
+ }
540
+
541
+ .openpress-panel .openpress-panel-section-title {
542
+ margin: 0;
543
+ padding: 0;
544
+ color: rgb(190 196 202 / 58%);
545
+ font-family: var(--openpress-font-mono);
546
+ font-size: 10px;
547
+ font-weight: 650;
548
+ line-height: 1;
549
+ letter-spacing: 0.04em;
550
+ text-transform: uppercase;
551
+ }
552
+
553
+ .openpress-panel-empty {
554
+ margin: 0;
555
+ border: 1px dashed rgb(255 255 255 / 12%);
556
+ padding: 14px;
557
+ color: rgb(150 156 163 / 62%);
558
+ font-size: 12px;
559
+ line-height: 1.4;
560
+ overflow-wrap: anywhere;
561
+ }
562
+
563
+ .openpress-panel-error {
564
+ margin: 0;
565
+ border-left: 3px solid rgb(248 113 113 / 76%);
566
+ padding: 8px 0 8px 12px;
567
+ color: rgb(248 113 113 / 88%);
568
+ font-size: 12px;
569
+ line-height: 1.45;
570
+ }
571
+
572
+ .openpress-panel--compact .openpress-panel-header {
573
+ gap: 10px;
574
+ align-items: start;
575
+ }
576
+
577
+ .openpress-panel--compact .openpress-panel-actions {
578
+ justify-content: flex-start;
579
+ }
580
+
581
+ .openpress-panel--compact .openpress-panel-actions .openpress-panel-action-button {
582
+ width: 34px;
583
+ min-height: 30px;
584
+ padding: 0;
585
+ }
586
+
587
+ .openpress-panel--compact .openpress-panel-actions .openpress-panel-action-button span {
588
+ position: absolute;
589
+ width: 1px;
590
+ height: 1px;
591
+ overflow: hidden;
592
+ clip: rect(0 0 0 0);
593
+ white-space: nowrap;
594
+ }