@commentray/render 0.2.0 → 0.3.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/block-stretch-buffer-sync.d.ts +16 -0
- package/dist/block-stretch-buffer-sync.d.ts.map +1 -0
- package/dist/block-stretch-buffer-sync.js +271 -0
- package/dist/block-stretch-buffer-sync.js.map +1 -0
- package/dist/block-stretch-layout.d.ts +18 -5
- package/dist/block-stretch-layout.d.ts.map +1 -1
- package/dist/block-stretch-layout.js +121 -43
- package/dist/block-stretch-layout.js.map +1 -1
- package/dist/browse-page-slug.d.ts +3 -4
- package/dist/browse-page-slug.d.ts.map +1 -1
- package/dist/browse-page-slug.js +3 -4
- package/dist/browse-page-slug.js.map +1 -1
- package/dist/build-commentray-nav-search.d.ts +2 -2
- package/dist/build-commentray-nav-search.js +1 -1
- package/dist/code-browser-block-rays.d.ts +11 -0
- package/dist/code-browser-block-rays.d.ts.map +1 -1
- package/dist/code-browser-block-rays.js +25 -5
- package/dist/code-browser-block-rays.js.map +1 -1
- package/dist/code-browser-client.bundle.js +12 -11
- package/dist/code-browser-client.js +1366 -257
- package/dist/code-browser-client.js.map +1 -1
- package/dist/code-browser-pair-nav.d.ts +9 -2
- package/dist/code-browser-pair-nav.d.ts.map +1 -1
- package/dist/code-browser-pair-nav.js +53 -14
- package/dist/code-browser-pair-nav.js.map +1 -1
- package/dist/code-browser-scroll-buffer-equalize.d.ts +25 -0
- package/dist/code-browser-scroll-buffer-equalize.d.ts.map +1 -0
- package/dist/code-browser-scroll-buffer-equalize.js +316 -0
- package/dist/code-browser-scroll-buffer-equalize.js.map +1 -0
- package/dist/code-browser-scroll-sync-monotonic.d.ts +17 -0
- package/dist/code-browser-scroll-sync-monotonic.d.ts.map +1 -0
- package/dist/code-browser-scroll-sync-monotonic.js +22 -0
- package/dist/code-browser-scroll-sync-monotonic.js.map +1 -0
- package/dist/code-browser-scroll-sync-strategy.d.ts +12 -0
- package/dist/code-browser-scroll-sync-strategy.d.ts.map +1 -0
- package/dist/code-browser-scroll-sync-strategy.js +28 -0
- package/dist/code-browser-scroll-sync-strategy.js.map +1 -0
- package/dist/code-browser-scroll-sync.d.ts +2 -2
- package/dist/code-browser-scroll-sync.d.ts.map +1 -1
- package/dist/code-browser-scroll-sync.js +1 -1
- package/dist/code-browser-scroll-sync.js.map +1 -1
- package/dist/code-browser-smooth-reveal-dedup.d.ts +25 -0
- package/dist/code-browser-smooth-reveal-dedup.d.ts.map +1 -0
- package/dist/code-browser-smooth-reveal-dedup.js +25 -0
- package/dist/code-browser-smooth-reveal-dedup.js.map +1 -0
- package/dist/code-browser.d.ts +25 -8
- package/dist/code-browser.d.ts.map +1 -1
- package/dist/code-browser.js +350 -86
- package/dist/code-browser.js.map +1 -1
- package/dist/commentray-anchor-viewport-probe.d.ts +5 -1
- package/dist/commentray-anchor-viewport-probe.d.ts.map +1 -1
- package/dist/commentray-anchor-viewport-probe.js +8 -2
- package/dist/commentray-anchor-viewport-probe.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/inject-md-line-anchors.d.ts +1 -1
- package/dist/inject-md-line-anchors.d.ts.map +1 -1
- package/dist/inject-md-line-anchors.js +9 -5
- package/dist/inject-md-line-anchors.js.map +1 -1
- package/dist/markdown-pipeline.js +1 -1
- package/dist/markdown-pipeline.js.map +1 -1
- package/dist/mermaid-runtime-html.d.ts.map +1 -1
- package/dist/mermaid-runtime-html.js +4 -1
- package/dist/mermaid-runtime-html.js.map +1 -1
- package/dist/reading-viewport-comfort.d.ts +12 -0
- package/dist/reading-viewport-comfort.d.ts.map +1 -0
- package/dist/reading-viewport-comfort.js +14 -0
- package/dist/reading-viewport-comfort.js.map +1 -0
- package/package.json +2 -2
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Historical ceiling for smooth-scroll duration (hash / search helpers may still use `smooth`).
|
|
3
|
+
* Dual-pane block sync uses **instant** partner writes (`applyRevealChildInPane`); partner echo
|
|
4
|
+
* suppression stays above this constant so any remaining smooth paths do not masquerade as driver
|
|
5
|
+
* input mid-gesture.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Ceiling used when sizing partner echo suppression in `code-browser-client` so a smooth
|
|
9
|
+
* programmatic scroll (if any) is not mistaken for user input mid-animation.
|
|
10
|
+
*/
|
|
11
|
+
export declare const SMOOTH_REVEAL_INFLIGHT_DEDUP_MS = 800;
|
|
12
|
+
/** Sub-pixel tolerance — clamp / `getBoundingClientRect` math drifts by less than this between frames. */
|
|
13
|
+
export declare const SMOOTH_REVEAL_TARGET_EPSILON_PX = 0.5;
|
|
14
|
+
export type SmoothRevealInFlight = {
|
|
15
|
+
/** Clamped scrollTop the most recent `scrollTo` was aimed at. */
|
|
16
|
+
target: number;
|
|
17
|
+
/** `performance.now()` at the moment of issue. */
|
|
18
|
+
issuedAt: number;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* True when `target` essentially equals the last-issued target and the in-flight glide is still
|
|
22
|
+
* within the typical animation duration. The caller should skip its `scrollTo` in that case.
|
|
23
|
+
*/
|
|
24
|
+
export declare function smoothRevealAlreadyInFlight(last: SmoothRevealInFlight | null, target: number, now: number): boolean;
|
|
25
|
+
//# sourceMappingURL=code-browser-smooth-reveal-dedup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"code-browser-smooth-reveal-dedup.d.ts","sourceRoot":"","sources":["../src/code-browser-smooth-reveal-dedup.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;GAGG;AACH,eAAO,MAAM,+BAA+B,MAAM,CAAC;AAEnD,0GAA0G;AAC1G,eAAO,MAAM,+BAA+B,MAAM,CAAC;AAEnD,MAAM,MAAM,oBAAoB,GAAG;IACjC,iEAAiE;IACjE,MAAM,EAAE,MAAM,CAAC;IACf,kDAAkD;IAClD,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF;;;GAGG;AACH,wBAAgB,2BAA2B,CACzC,IAAI,EAAE,oBAAoB,GAAG,IAAI,EACjC,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,MAAM,GACV,OAAO,CAIT"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Historical ceiling for smooth-scroll duration (hash / search helpers may still use `smooth`).
|
|
3
|
+
* Dual-pane block sync uses **instant** partner writes (`applyRevealChildInPane`); partner echo
|
|
4
|
+
* suppression stays above this constant so any remaining smooth paths do not masquerade as driver
|
|
5
|
+
* input mid-gesture.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Ceiling used when sizing partner echo suppression in `code-browser-client` so a smooth
|
|
9
|
+
* programmatic scroll (if any) is not mistaken for user input mid-animation.
|
|
10
|
+
*/
|
|
11
|
+
export const SMOOTH_REVEAL_INFLIGHT_DEDUP_MS = 800;
|
|
12
|
+
/** Sub-pixel tolerance — clamp / `getBoundingClientRect` math drifts by less than this between frames. */
|
|
13
|
+
export const SMOOTH_REVEAL_TARGET_EPSILON_PX = 0.5;
|
|
14
|
+
/**
|
|
15
|
+
* True when `target` essentially equals the last-issued target and the in-flight glide is still
|
|
16
|
+
* within the typical animation duration. The caller should skip its `scrollTo` in that case.
|
|
17
|
+
*/
|
|
18
|
+
export function smoothRevealAlreadyInFlight(last, target, now) {
|
|
19
|
+
if (last === null)
|
|
20
|
+
return false;
|
|
21
|
+
if (Math.abs(last.target - target) > SMOOTH_REVEAL_TARGET_EPSILON_PX)
|
|
22
|
+
return false;
|
|
23
|
+
return now - last.issuedAt < SMOOTH_REVEAL_INFLIGHT_DEDUP_MS;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=code-browser-smooth-reveal-dedup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"code-browser-smooth-reveal-dedup.js","sourceRoot":"","sources":["../src/code-browser-smooth-reveal-dedup.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;GAGG;AACH,MAAM,CAAC,MAAM,+BAA+B,GAAG,GAAG,CAAC;AAEnD,0GAA0G;AAC1G,MAAM,CAAC,MAAM,+BAA+B,GAAG,GAAG,CAAC;AASnD;;;GAGG;AACH,MAAM,UAAU,2BAA2B,CACzC,IAAiC,EACjC,MAAc,EACd,GAAW;IAEX,IAAI,IAAI,KAAK,IAAI;QAAE,OAAO,KAAK,CAAC;IAChC,IAAI,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,GAAG,+BAA+B;QAAE,OAAO,KAAK,CAAC;IACnF,OAAO,GAAG,GAAG,IAAI,CAAC,QAAQ,GAAG,+BAA+B,CAAC;AAC/D,CAAC"}
|
package/dist/code-browser.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { type CommentrayIndex } from "@commentray/core";
|
|
2
|
+
import { type StretchBufferSyncStrategy } from "./block-stretch-layout.js";
|
|
2
3
|
import { type CommentrayOutputUrlOptions } from "./markdown-pipeline.js";
|
|
4
|
+
import { type DualPaneScrollSyncStrategyId } from "./code-browser-scroll-sync-strategy.js";
|
|
3
5
|
/** One angle tab for {@link CodeBrowserPageOptions.multiAngleBrowsing}. */
|
|
4
6
|
export type CodeBrowserMultiAngleSpec = {
|
|
5
7
|
id: string;
|
|
@@ -9,9 +11,8 @@ export type CodeBrowserMultiAngleSpec = {
|
|
|
9
11
|
commentrayOnGithubUrl?: string;
|
|
10
12
|
/**
|
|
11
13
|
* When the static site emits per-pair browse pages, same-tab navigation for the Doc toolbar
|
|
12
|
-
* (preferred over {@link commentrayOnGithubUrl} on the hub).
|
|
13
|
-
* `./browse
|
|
14
|
-
* remains valid for the canonical HTML file on disk.
|
|
14
|
+
* (preferred over {@link commentrayOnGithubUrl} on the hub). Paths mirror the companion layout
|
|
15
|
+
* under `./browse/…/index.html` (see `staticBrowseIndexRelPathFromPair` in `@commentray/core`).
|
|
15
16
|
*/
|
|
16
17
|
staticBrowseUrl?: string;
|
|
17
18
|
/**
|
|
@@ -48,8 +49,9 @@ export type CodeBrowserPageOptions = {
|
|
|
48
49
|
*/
|
|
49
50
|
githubRepoUrl?: string;
|
|
50
51
|
/**
|
|
51
|
-
* Same-site URL for the static documentation hub (e.g. `./` on `index.html`,
|
|
52
|
-
*
|
|
52
|
+
* Same-site URL for the static documentation hub (e.g. `./` on `index.html`, or a
|
|
53
|
+
* depth-correct relative path to the hub from nested `browse/…` pages — see static export).
|
|
54
|
+
* When set, the first toolbar control is a **home** link here instead of
|
|
53
55
|
* {@link githubRepoUrl}. Uses the same path safety rules as {@link commentrayStaticBrowseUrl}.
|
|
54
56
|
*/
|
|
55
57
|
siteHubUrl?: string;
|
|
@@ -104,6 +106,18 @@ export type CodeBrowserPageOptions = {
|
|
|
104
106
|
* **block-aware** scroll sync and separator lines in the commentray pane.
|
|
105
107
|
*/
|
|
106
108
|
codeBrowserLayout?: "auto" | "dual";
|
|
109
|
+
/**
|
|
110
|
+
* Stretch layout only. Omitted uses `DEFAULT_STRETCH_BUFFER_SYNC` from `@commentray/core`
|
|
111
|
+
* (`flow-synchronizer`: sync ids + measure wrappers + client `BufferingFlowSynchronizer`).
|
|
112
|
+
* `table`: legacy row height only, no shell flag / client padding pass.
|
|
113
|
+
*/
|
|
114
|
+
stretchBufferSync?: StretchBufferSyncStrategy;
|
|
115
|
+
/**
|
|
116
|
+
* Dual-pane scroll correlation (`#shell data-scroll-sync-strategy`). Strategies are mutually
|
|
117
|
+
* exclusive in the client; omit or set to the default for normal builds. `filler-blocks` is
|
|
118
|
+
* reserved until height-matched buffer layout exists (currently behaves like the default).
|
|
119
|
+
*/
|
|
120
|
+
dualPaneScrollSyncStrategy?: DualPaneScrollSyncStrategyId;
|
|
107
121
|
/**
|
|
108
122
|
* `full` (default): in-page search indexes every source line and every commentray line.
|
|
109
123
|
* `commentray-and-paths`: search only **toolbar path labels** plus commentray Markdown (no code-body line corpus).
|
|
@@ -121,8 +135,8 @@ export type CodeBrowserPageOptions = {
|
|
|
121
135
|
*/
|
|
122
136
|
commentrayOnGithubUrl?: string;
|
|
123
137
|
/**
|
|
124
|
-
* When set (e.g. `./browse/…/index.html
|
|
125
|
-
* the Doc toolbar icon opens this URL on the **same origin** instead of GitHub.
|
|
138
|
+
* When set (e.g. `./browse/…/index.html`, `/browse/…/index.html`, or `./browse/<hash>.html` from
|
|
139
|
+
* the static Pages build), the Doc toolbar icon opens this URL on the **same origin** instead of GitHub.
|
|
126
140
|
*/
|
|
127
141
|
commentrayStaticBrowseUrl?: string;
|
|
128
142
|
/**
|
|
@@ -138,7 +152,8 @@ export type CodeBrowserPageOptions = {
|
|
|
138
152
|
documentedPairsEmbeddedB64?: string;
|
|
139
153
|
/**
|
|
140
154
|
* When **two or more** angles are listed for the same static browse session, the shell renders
|
|
141
|
-
* an Angle selector
|
|
155
|
+
* an Angle selector. If every angle can build a block-stretch table (`layout` `auto`), the shell
|
|
156
|
+
* uses **stretch** (one scroll + row-aligned table); otherwise **dual** panes with client swap.
|
|
142
157
|
*/
|
|
143
158
|
multiAngleBrowsing?: CodeBrowserMultiAngleBrowsing;
|
|
144
159
|
/**
|
|
@@ -154,4 +169,6 @@ export type CodeBrowserPageOptions = {
|
|
|
154
169
|
* token-in-line quick search (all non-whitespace tokens must appear on the same line).
|
|
155
170
|
*/
|
|
156
171
|
export declare function renderCodeBrowserHtml(opts: CodeBrowserPageOptions): Promise<string>;
|
|
172
|
+
export type { DualPaneScrollSyncStrategyId } from "./code-browser-scroll-sync-strategy.js";
|
|
173
|
+
export type { StretchBufferSyncStrategy } from "./block-stretch-layout.js";
|
|
157
174
|
//# sourceMappingURL=code-browser.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"code-browser.d.ts","sourceRoot":"","sources":["../src/code-browser.ts"],"names":[],"mappings":"AAGA,OAAO,EAGL,KAAK,eAAe,
|
|
1
|
+
{"version":3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