@tooee/view 0.1.20 → 0.1.22

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 (52) hide show
  1. package/README.md +28 -0
  2. package/dist/View.d.ts +7 -1
  3. package/dist/View.d.ts.map +1 -1
  4. package/dist/View.js +2 -2
  5. package/dist/View.js.map +1 -1
  6. package/dist/components/subviews/CodeSubview.d.ts.map +1 -1
  7. package/dist/components/subviews/CodeSubview.js +26 -3
  8. package/dist/components/subviews/CodeSubview.js.map +1 -1
  9. package/dist/components/subviews/CustomSubview.d.ts.map +1 -1
  10. package/dist/components/subviews/CustomSubview.js +15 -1
  11. package/dist/components/subviews/CustomSubview.js.map +1 -1
  12. package/dist/components/subviews/MarkdownSubview.d.ts +3 -1
  13. package/dist/components/subviews/MarkdownSubview.d.ts.map +1 -1
  14. package/dist/components/subviews/MarkdownSubview.js +60 -5
  15. package/dist/components/subviews/MarkdownSubview.js.map +1 -1
  16. package/dist/components/subviews/TableSubview.d.ts.map +1 -1
  17. package/dist/components/subviews/TableSubview.js +28 -3
  18. package/dist/components/subviews/TableSubview.js.map +1 -1
  19. package/dist/hooks/index.d.ts +2 -1
  20. package/dist/hooks/index.d.ts.map +1 -1
  21. package/dist/hooks/index.js +1 -1
  22. package/dist/hooks/index.js.map +1 -1
  23. package/dist/hooks/useContentLoader.d.ts.map +1 -1
  24. package/dist/hooks/useContentLoader.js +13 -7
  25. package/dist/hooks/useContentLoader.js.map +1 -1
  26. package/dist/hooks/useViewCommandContext.d.ts +59 -0
  27. package/dist/hooks/useViewCommandContext.d.ts.map +1 -1
  28. package/dist/hooks/useViewCommandContext.js +52 -20
  29. package/dist/hooks/useViewCommandContext.js.map +1 -1
  30. package/dist/index.d.ts +4 -0
  31. package/dist/index.d.ts.map +1 -1
  32. package/dist/index.js +2 -0
  33. package/dist/index.js.map +1 -1
  34. package/dist/launch.d.ts +7 -0
  35. package/dist/launch.d.ts.map +1 -1
  36. package/dist/launch.js +1 -1
  37. package/dist/launch.js.map +1 -1
  38. package/dist/types.d.ts +10 -0
  39. package/dist/types.d.ts.map +1 -1
  40. package/dist/types.js.map +1 -1
  41. package/package.json +10 -10
  42. package/src/View.tsx +10 -2
  43. package/src/components/subviews/CodeSubview.tsx +33 -2
  44. package/src/components/subviews/CustomSubview.tsx +18 -1
  45. package/src/components/subviews/MarkdownSubview.tsx +77 -3
  46. package/src/components/subviews/TableSubview.tsx +35 -2
  47. package/src/hooks/index.ts +10 -1
  48. package/src/hooks/useContentLoader.ts +15 -7
  49. package/src/hooks/useViewCommandContext.ts +128 -20
  50. package/src/index.ts +12 -0
  51. package/src/launch.tsx +8 -0
  52. package/src/types.ts +10 -0
@@ -1,6 +1,65 @@
1
+ import type { Mode } from "@tooee/commands";
1
2
  import type { NavigationState } from "@tooee/shell";
2
3
  import type { MarkSet } from "@tooee/marks";
3
4
  import type { AnyContent } from "../types.js";
5
+ /** The `view` field contributed to the command context (see augmentation below). */
6
+ export interface ViewCommandContext {
7
+ content: AnyContent;
8
+ format: string;
9
+ title?: string;
10
+ data?: unknown;
11
+ cursor: number | null;
12
+ selection: {
13
+ start: number;
14
+ end: number;
15
+ } | null;
16
+ mode: Mode;
17
+ toggledIndices: Set<number>;
18
+ reload: () => void;
19
+ marks: {
20
+ setMarkSet: (set: MarkSet) => void;
21
+ clearNamespace: (namespace: string) => void;
22
+ clearAll: () => void;
23
+ userMarks: MarkSet[];
24
+ providerMarks: MarkSet[];
25
+ };
26
+ /** Subview extras (e.g. activeRow/selectedRows for tables). */
27
+ [key: string]: unknown;
28
+ }
29
+ declare module "@tooee/commands" {
30
+ interface CommandContext {
31
+ view: ViewCommandContext;
32
+ }
33
+ }
34
+ type ViewNavigationContext = Pick<NavigationState, "cursor" | "selection" | "toggledIndices">;
35
+ export interface CreateViewCommandContextOptions {
36
+ /**
37
+ * Content represented by this command context. Custom/headless surfaces may
38
+ * omit it; the builder will synthesize a minimal custom content object.
39
+ */
40
+ content?: AnyContent;
41
+ format?: string;
42
+ title?: string;
43
+ data?: unknown;
44
+ nav?: ViewNavigationContext;
45
+ cursor?: number | null;
46
+ selection?: {
47
+ start: number;
48
+ end: number;
49
+ } | null;
50
+ /** Caller-owned mode value. Prefer `useProvideViewCommandContext` in React so this is live. */
51
+ mode: Mode;
52
+ toggledIndices?: Set<number>;
53
+ reload?: () => void;
54
+ marks?: Partial<ViewCommandContext["marks"]>;
55
+ extras?: Record<string, unknown>;
56
+ }
57
+ export type ProvideViewCommandContextOptions = Omit<CreateViewCommandContextOptions, "mode"> & {
58
+ /** Advanced override; normally omitted so the hook injects the live command mode. */
59
+ mode?: Mode;
60
+ };
61
+ export declare function createViewCommandContext({ content, format, title, data, nav, cursor, selection, mode, toggledIndices, reload, marks, extras, }: CreateViewCommandContextOptions): ViewCommandContext;
62
+ export declare function useProvideViewCommandContext(options: ProvideViewCommandContextOptions | (() => ProvideViewCommandContextOptions)): void;
4
63
  interface UseViewCommandContextParams {
5
64
  content: AnyContent;
6
65
  nav: NavigationState;
@@ -1 +1 @@
1
- {"version":3,"file":"useViewCommandContext.d.ts","sourceRoot":"","sources":["../../src/hooks/useViewCommandContext.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AACnD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAC3C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAE7C,UAAU,2BAA2B;IACnC,OAAO,EAAE,UAAU,CAAA;IACnB,GAAG,EAAE,eAAe,CAAA;IACpB,MAAM,EAAE,MAAM,IAAI,CAAA;IAClB,aAAa,EAAE,OAAO,EAAE,CAAA;IACxB,SAAS,EAAE,OAAO,EAAE,CAAA;IACpB,UAAU,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,IAAI,CAAA;IAClC,kBAAkB,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAA;IAC/C,iBAAiB,E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Ac,EACd,MAAM,EACN,KAAK,EACL,MAAM,GACP,EAAE,+BAA+B,GAAG,kBAAkB,CA6BtD;AAED,wBAAgB,4BAA4B,CAC1C,OAAO,EAAE,gCAAgC,GAAG,CAAC,MAAM,gCAAgC,CAAC,QAUrF;AAED,UAAU,2BAA2B;IACnC,OAAO,EAAE,UAAU,CAAA;IACnB,GAAG,EAAE,eAAe,CAAA;IACpB,MAAM,EAAE,MAAM,IAAI,CAAA;IAClB,aAAa,EAAE,OAAO,EAAE,CAAA;IACxB,SAAS,EAAE,OAAO,EAAE,CAAA;IACpB,UAAU,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,IAAI,CAAA;IAClC,kBAAkB,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAA;IAC/C,iBAAiB,EAAE,MAAM,IAAI,CAAA;IAC7B,yFAAyF;IACzF,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CACjC;AAED,wBAAgB,qBAAqB,CAAC,EACpC,OAAO,EACP,GAAG,EACH,MAAM,EACN,aAAa,EACb,SAAS,EACT,UAAU,EACV,kBAAkB,EAClB,iBAAiB,EACjB,MAAM,GACP,EAAE,2BAA2B,QAc7B"}
@@ -1,24 +1,56 @@
1
- import { useProvideCommandContext, useMode } from "@tooee/commands";
2
- export function useViewCommandContext({ content, nav, reload, providerMarks, userMarks, setMarkSet, clearMarkNamespace, clearAllUserMarks, extras, }) {
1
+ import { useProvideCommandContextKey, useMode } from "@tooee/commands";
2
+ const noop = () => { };
3
+ export function createViewCommandContext({ content, format, title, data, nav, cursor, selection, mode, toggledIndices, reload, marks, extras, }) {
4
+ const resolvedFormat = format ?? content?.format ?? "custom";
5
+ const resolvedContent = content ??
6
+ {
7
+ format: resolvedFormat,
8
+ data,
9
+ title,
10
+ };
11
+ return {
12
+ ...extras,
13
+ content: resolvedContent,
14
+ format: resolvedFormat,
15
+ title: title ?? content?.title,
16
+ data: data ?? ("data" in resolvedContent ? resolvedContent.data : undefined),
17
+ cursor: cursor ?? nav?.cursor ?? null,
18
+ selection: selection ?? nav?.selection ?? null,
19
+ mode,
20
+ toggledIndices: toggledIndices ?? nav?.toggledIndices ?? new Set(),
21
+ reload: reload ?? noop,
22
+ marks: {
23
+ setMarkSet: marks?.setMarkSet ?? noop,
24
+ clearNamespace: marks?.clearNamespace ?? noop,
25
+ clearAll: marks?.clearAll ?? noop,
26
+ userMarks: marks?.userMarks ?? [],
27
+ providerMarks: marks?.providerMarks ?? [],
28
+ },
29
+ };
30
+ }
31
+ export function useProvideViewCommandContext(options) {
3
32
  const mode = useMode();
4
- useProvideCommandContext(() => ({
5
- view: {
6
- content,
7
- format: content.format,
8
- cursor: nav.cursor,
9
- selection: nav.selection,
10
- mode,
11
- toggledIndices: nav.toggledIndices,
12
- reload,
13
- marks: {
14
- setMarkSet,
15
- clearNamespace: clearMarkNamespace,
16
- clearAll: clearAllUserMarks,
17
- userMarks,
18
- providerMarks,
19
- },
20
- ...extras,
33
+ useProvideCommandContextKey("view", () => {
34
+ const resolvedOptions = typeof options === "function" ? options() : options;
35
+ return createViewCommandContext({
36
+ ...resolvedOptions,
37
+ mode: resolvedOptions.mode ?? mode,
38
+ });
39
+ });
40
+ }
41
+ export function useViewCommandContext({ content, nav, reload, providerMarks, userMarks, setMarkSet, clearMarkNamespace, clearAllUserMarks, extras, }) {
42
+ useProvideViewCommandContext({
43
+ content,
44
+ nav,
45
+ reload,
46
+ marks: {
47
+ setMarkSet,
48
+ clearNamespace: clearMarkNamespace,
49
+ clearAll: clearAllUserMarks,
50
+ userMarks,
51
+ providerMarks,
21
52
  },
22
- }));
53
+ extras,
54
+ });
23
55
  }
24
56
  //# sourceMappingURL=useViewCommandContext.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useViewCommandContext.js","sourceRoot":"","sources":["../../src/hooks/useViewCommandContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAA;AAkBnE,MAAM,UAAU,qBAAqB,CAAC,EACpC,OAAO,EACP,GAAG,EACH,MAAM,EACN,aAAa,EACb,SAAS,EACT,UAAU,EACV,kBAAkB,EAClB,iBAAiB,EACjB,MAAM,GACsB;IAC5B,MAAM,IAAI,GAAG,OAAO,EAAE,CAAA;IACtB,wBAAwB,CAAC,GAAG,EAAE,CAAC,CAAC;QAC9B,IAAI,EAAE;YACJ,OAAO;YACP,MAAM,EAAE,OAAO,CAAC,MAAM;YACtB,MAAM,EAAE,GAAG,CAAC,MAAM;YAClB,SAAS,EAAE,GAAG,CAAC,SAAS;YACxB,IAAI;YACJ,cAAc,EAAE,GAAG,CAAC,cAAc;YAClC,MAAM;YACN,KAAK,EAAE;gBACL,UAAU;gBACV,cAAc,EAAE,kBAAkB;gBAClC,QAAQ,EAAE,iBAAiB;gBAC3B,SAAS;gBACT,aAAa;aACd;YACD,GAAG,MAAM;SACV;KACF,CAAC,CAAC,CAAA;AACL,CAAC"}
1
+ {"version":3,"file":"useViewCommandContext.js","sourceRoot":"","sources":["../../src/hooks/useViewCommandContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAA;AAkCtE,MAAM,IAAI,GAAG,GAAG,EAAE,GAAE,CAAC,CAAA;AA6BrB,MAAM,UAAU,wBAAwB,CAAC,EACvC,OAAO,EACP,MAAM,EACN,KAAK,EACL,IAAI,EACJ,GAAG,EACH,MAAM,EACN,SAAS,EACT,IAAI,EACJ,cAAc,EACd,MAAM,EACN,KAAK,EACL,MAAM,GAC0B;IAChC,MAAM,cAAc,GAAG,MAAM,IAAI,OAAO,EAAE,MAAM,IAAI,QAAQ,CAAA;IAC5D,MAAM,eAAe,GACnB,OAAO;QACN;YACC,MAAM,EAAE,cAAc;YACtB,IAAI;YACJ,KAAK;SACgB,CAAA;IAEzB,OAAO;QACL,GAAG,MAAM;QACT,OAAO,EAAE,eAAe;QACxB,MAAM,EA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AAM,GACsB;IAC5B,4BAA4B,CAAC;QAC3B,OAAO;QACP,GAAG;QACH,MAAM;QACN,KAAK,EAAE;YACL,UAAU;YACV,cAAc,EAAE,kBAAkB;YAClC,QAAQ,EAAE,iBAAiB;YAC3B,SAAS;YACT,aAAa;SACd;QACD,MAAM;KACP,CAAC,CAAA;AACJ,CAAC"}
package/dist/index.d.ts CHANGED
@@ -5,6 +5,10 @@ export type { ViewLaunchOptions } from "./launch.js";
5
5
  export { createFileProvider, createStdinProvider, createTableFileProvider, createTableStdinProvider, } from "./default-provider.js";
6
6
  export { listDirectoryFiles } from "./directory-provider.js";
7
7
  export type { DirectoryEntry } from "./directory-provider.js";
8
+ export { createViewCommandContext, useProvideViewCommandContext, useViewCommandContext, } from "./hooks/useViewCommandContext.js";
9
+ export type { CreateViewCommandContextOptions, ProvideViewCommandContextOptions, ViewCommandContext, } from "./hooks/useViewCommandContext.js";
8
10
  export type { AnyContent, Content, ContentChunk, ContentFormat, ContentProvider, ContentRenderer, ContentRendererProps, CustomContent, ViewContent, ViewContentProvider, ColumnDef, TableRow, } from "./types.js";
9
11
  export { getTextContent, isBuiltinContent, isCustomContent } from "./types.js";
12
+ export { CodeBlockChrome } from "@tooee/renderers";
13
+ export type { CodeBlockRenderer, CodeBlockRendererProps, CodeBlockHScroll } from "@tooee/renderers";
10
14
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAClD,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AACrD,YAAY,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AACpD,OAAO,EACL,kBAAkB,EAClB,mBAAmB,EACnB,uBAAuB,EACvB,wBAAwB,GACzB,MAAM,uBAAuB,C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E,MAAM,YAAY,CAAA;AAC9E,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAClD,YAAY,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAA"}
package/dist/index.js CHANGED
@@ -3,5 +3,7 @@ export { DirectoryView } from "./DirectoryView.js";
3
3
  export { launch, launchDirectory } from "./launch.js";
4
4
  export { createFileProvider, createStdinProvider, createTableFileProvider, createTableStdinProvider, } from "./default-provider.js";
5
5
  export { listDirectoryFiles } from "./directory-provider.js";
6
+ export { createViewCommandContext, useProvideViewCommandContext, useViewCommandContext, } from "./hooks/useViewCommandContext.js";
6
7
  export { getTextContent, isBuiltinContent, isCustomContent } from "./types.js";
8
+ export { CodeBlockChrome } from "@tooee/renderers";
7
9
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAClD,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAErD,OAAO,EACL,kBAAkB,EAClB,mBAAmB,EACnB,uBAAuB,EACvB,wBAAwB,GACzB,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAgB5D,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAClD,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAErD,OAAO,EACL,kBAAkB,EAClB,mBAAmB,EACnB,uBAAuB,EACvB,wBAAwB,GACzB,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAE5D,OAAO,EACL,wBAAwB,EACxB,4BAA4B,EAC5B,qBAAqB,GACtB,MAAM,kCAAkC,CAAA;AAoBzC,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAC9E,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA"}
package/dist/launch.d.ts CHANGED
@@ -1,9 +1,16 @@
1
1
  import type { ActionDefinition } from "@tooee/commands";
2
+ import type { CodeBlockRenderer } from "@tooee/renderers";
2
3
  import type { ContentProvider, ContentRenderer } from "./types.js";
3
4
  export interface ViewLaunchOptions {
4
5
  contentProvider: ContentProvider;
5
6
  actions?: ActionDefinition[];
6
7
  renderers?: Record<string, ContentRenderer>;
8
+ /**
9
+ * Custom renderers for fenced code blocks in markdown content, keyed by
10
+ * fence type (first word of the fence info string, case-insensitive).
11
+ * Unmatched types fall back to the default syntax-highlighted code block.
12
+ */
13
+ codeBlockRenderers?: Record<string, CodeBlockRenderer>;
7
14
  }
8
15
  export interface DirectoryLaunchOptions {
9
16
  dirPath: string;
@@ -1 +1 @@
1
- {"version":3,"file":"launch.d.ts","sourceRoot":"","sources":["../src/launch.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AAGvD,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAElE,MAAM,WAAW,iBAAiB;IAChC,eAAe,EAAE,eAAe,CAAA;IAChC,OAAO,CAAC,EAAE,gBAAgB,EAAE,CAAA;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAA;CAC5C;AAED,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,CAAC,EAAE,gBAAgB,EAAE,CAAA;CAC7B;AAED,wBAAsB,MAAM,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CAQtE;AAED,wBAAsB,eAAe,CAAC,OAAO,EAAE,sBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC,CAEpF"}
1
+ {"version":3,"file":"launch.d.ts","sourceRoot":"","sources":["../src/launch.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AACvD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;AAGzD,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAElE,MAAM,WAAW,iBAAiB;IAChC,eAAe,EAAE,eAAe,CAAA;IAChC,OAAO,CAAC,EAAE,gBAAgB,EAAE,CAAA;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAA;IAC3C;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAA;CACvD;AAED,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,CAAC,EAAE,gBAAgB,EAAE,CAAA;CAC7B;AAED,wBAAsB,MAAM,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CAStE;AAED,wBAAsB,eAAe,CAAC,OAAO,EAAE,sBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC,CAEpF"}
package/dist/launch.js CHANGED
@@ -3,7 +3,7 @@ import { launchCli } from "@tooee/shell";
3
3
  import { View } from "./View.js";
4
4
  import { DirectoryView } from "./DirectoryView.js";
5
5
  export async function launch(options) {
6
- await launchCli(_jsx(View, { contentProvider: options.contentProvider, actions: options.actions, renderers: options.renderers }));
6
+ await launchCli(_jsx(View, { contentProvider: options.contentProvider, actions: options.actions, renderers: options.renderers, codeBlockRenderers: options.codeBlockRenderers }));
7
7
  }
8
8
  export async function launchDirectory(options) {
9
9
  await launchCli(_jsx(DirectoryView, { dirPath: options.dirPath, actions: options.actions }));
@@ -1 +1 @@
1
- {"version":3,"file":"launch.js","sourceRoot":"","sources":["../src/launch.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAExC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAclD,MAAM,CAAC,KAAK,UAAU,MAAM,CAAC,OAA0B;IACrD,MAAM,SAAS,CACb,KAAC,IAAI,IACH,eAAe,EAAE,OAAO,CAAC,eAAe,EACxC,OAAO,EAAE,OAAO,CAAC,OAAO,EACxB,SAAS,EAAE,OAAO,CAAC,SAAS,GAC5B,CACH,CAAA;AACH,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,OAA+B;IACnE,MAAM,SAAS,CAAC,KAAC,aAAa,IAAC,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,GAAI,CAAC,CAAA;AACxF,CAAC"}
1
+ {"version":3,"file":"launch.js","sourceRoot":"","sources":["../src/launch.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAGxC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAoBlD,MAAM,CAAC,KAAK,UAAU,MAAM,CAAC,OAA0B;IACrD,MAAM,SAAS,CACb,KAAC,IAAI,IACH,eAAe,EAAE,OAAO,CAAC,eAAe,EACxC,OAAO,EAAE,OAAO,CAAC,OAAO,EACxB,SAAS,EAAE,OAAO,CAAC,SAAS,EAC5B,kBAAkB,EAAE,OAAO,CAAC,kBAAkB,GAC9C,CACH,CAAA;AACH,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,OAA+B;IACnE,MAAM,SAAS,CAAC,KAAC,aAAa,IAAC,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,GAAI,CAAC,CAAA;AACxF,CAAC"}
package/dist/types.d.ts CHANGED
@@ -41,6 +41,16 @@ export interface ContentRendererProps {
41
41
  selectionEnd?: number;
42
42
  /** Combined mark state (nav + provider + user marks) */
43
43
  marks?: MarkState;
44
+ /**
45
+ * Select a row by index — the mouse equivalent of the keyboard cursor move.
46
+ * A custom renderer that has a notion of rows should call this from its own
47
+ * `onMouseDown`/`onRowClick` handlers to make left-click select a row, the
48
+ * same way the built-in code/markdown/table views do. Selection is a no-op
49
+ * while a modal overlay is open (the host guards it), so renderers can wire
50
+ * it unconditionally. Renderers that own a `RowDocumentRenderable` can map a
51
+ * click's screen-Y to a row via its `getRowAtScreenY(event.y)` helper.
52
+ */
53
+ onSelectRow?: (index: number) => void;
44
54
  }
45
55
  export type ContentRenderer = (props: ContentRendererProps) => ReactNode;
46
56
  export type AppendableFormat = Extract<ContentFormat, "markdown" | "code" | "text">;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACtC,OAAO,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAC3D,OAAO,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAItD,MAAM,MAAM,OAAO,GAAG,eAAe,GAAG,WAAW,GAAG,WAAW,GAAG,YAAY,CAAA;AAEhF,MAAM,MAAM,aAAa,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAA;AAE7C,UAAU,WAAW;IACnB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,cAA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,KAAK,KAAK,SAAS;QAAE,OAAO,MAAM,CAAC,KAAK,CAAC,CAAA;IACjF,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAA;IAC9B,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,MAAM,CAAC,KAAK,CAAC,CAAA;IACtB,CAAC;AACH,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tooee/view",
3
- "version": "0.1.20",
3
+ "version": "0.1.22",
4
4
  "description": "Terminal content viewer for markdown, code, text, and tables",
5
5
  "keywords": [
6
6
  "cli",
@@ -37,15 +37,15 @@
37
37
  "typecheck": "tsc --noEmit"
38
38
  },
39
39
  "dependencies": {
40
- "@tooee/commands": "0.1.20",
41
- "@tooee/config": "0.1.20",
42
- "@tooee/layout": "0.1.20",
43
- "@tooee/marks": "0.1.20",
44
- "@tooee/overlays": "0.1.20",
45
- "@tooee/renderers": "0.1.20",
46
- "@tooee/search": "0.1.20",
47
- "@tooee/shell": "0.1.20",
48
- "@tooee/themes": "0.1.20",
40
+ "@tooee/commands": "0.1.22",
41
+ "@tooee/config": "0.1.22",
42
+ "@tooee/layout": "0.1.22",
43
+ "@tooee/marks": "0.1.22",
44
+ "@tooee/overlays": "0.1.22",
45
+ "@tooee/renderers": "0.1.22",
46
+ "@tooee/search": "0.1.22",
47
+ "@tooee/shell": "0.1.22",
48
+ "@tooee/themes": "0.1.22",
49
49
  "marked": "^17.0.4"
50
50
  },
51
51
  "devDependencies": {
package/src/View.tsx CHANGED
@@ -2,6 +2,7 @@ import { useState, useCallback } from "react"
2
2
  import { useTheme } from "@tooee/themes"
3
3
  import type { ActionDefinition } from "@tooee/commands"
4
4
  import type { MarkSet } from "@tooee/marks"
5
+ import type { CodeBlockRenderer } from "@tooee/renderers"
5
6
  import { isCustomContent, type ContentProvider, type ContentRenderer } from "./types.js"
6
7
  import { useContentLoader } from "./hooks/useContentLoader.js"
7
8
  import {
@@ -15,9 +16,14 @@ interface ViewProps {
15
16
  contentProvider: ContentProvider
16
17
  actions?: ActionDefinition[]
17
18
  renderers?: Record<string, ContentRenderer>
19
+ /**
20
+ * Custom renderers for fenced code blocks in markdown content, keyed by
21
+ * fence type (first word of the fence info string, case-insensitive).
22
+ */
23
+ codeBlockRenderers?: Record<string, CodeBlockRenderer>
18
24
  }
19
25
 
20
- export function View({ contentProvider, actions, renderers }: ViewProps) {
26
+ export function View({ contentProvider, actions, renderers, codeBlockRenderers }: ViewProps) {
21
27
  const { theme } = useTheme()
22
28
  const [reloadTrigger, setReloadTrigger] = useState(0)
23
29
  const reload = useCallback(() => setReloadTrigger((n) => n + 1), [])
@@ -77,7 +83,9 @@ export function View({ contentProvider, actions, renderers }: ViewProps) {
77
83
 
78
84
  switch (content.format) {
79
85
  case "markdown":
80
- return <MarkdownSubview content={content} {...shared} />
86
+ return (
87
+ <MarkdownSubview content={content} codeBlockRenderers={codeBlockRenderers} {...shared} />
88
+ )
81
89
  case "code":
82
90
  case "text":
83
91
  return <CodeSubview content={content} {...shared} />
@@ -1,8 +1,10 @@
1
- import { useEffect, useMemo, useRef } from "react"
1
+ import { useCallback, useEffect, useMemo, useRef } from "react"
2
2
  import { CodeView, type RowDocumentRenderable } from "@tooee/renderers"
3
3
  import { useTheme } from "@tooee/themes"
4
+ import { useCommandContext } from "@tooee/commands"
5
+ import { useHasModalOverlay } from "@tooee/overlays"
4
6
  import { useViewCommandContext } from "../../hooks/useViewCommandContext.js"
5
- import { useCopy, useNavigation } from "@tooee/shell"
7
+ import { actionsToContextMenuEntries, useContextMenu, useCopy, useNavigation } from "@tooee/shell"
6
8
  import { findMatchingLines, useSearch } from "@tooee/search"
7
9
  import type { CodeContent, TextContent } from "../../types.js"
8
10
  import { useMarkState } from "../../hooks/useMarkState.js"
@@ -27,6 +29,9 @@ export function CodeSubview({
27
29
  }: CodeSubviewProps) {
28
30
  const { theme } = useTheme()
29
31
  const docRef = useRef<RowDocumentRenderable>(null)
32
+ const hasModalOverlay = useHasModalOverlay()
33
+ const contextMenu = useContextMenu()
34
+ const { invoke } = useCommandContext()
30
35
  const textContent = content.format === "code" ? content.code : content.text
31
36
  const lines = useMemo(() => textContent.split("\n"), [textContent])
32
37
  const lineCount = lines.length
@@ -76,6 +81,30 @@ export function CodeSubview({
76
81
 
77
82
  const text = content.format === "code" ? content.code : content.text
78
83
 
84
+ const menuEntries = useMemo(() => actionsToContextMenuEntries(actions), [actions])
85
+
86
+ // Left-click selects the clicked line; right-click selects it and opens the
87
+ // same app-provided action menu as table rows. Both stand down while a modal
88
+ // overlay is up (theme picker, command palette, Ask/Choose), matching the
89
+ // keyboard stand-down and avoiding covered-app mutations.
90
+ const setCursor = nav.setCursor
91
+ const openContextMenu = contextMenu.open
92
+ const handleRowClick = useCallback(
93
+ (index: number) => {
94
+ if (hasModalOverlay) return
95
+ setCursor(index)
96
+ },
97
+ [hasModalOverlay, setCursor],
98
+ )
99
+ const handleRowContextMenu = useCallback(
100
+ (index: number, x: number, y: number) => {
101
+ if (hasModalOverlay) return
102
+ setCursor(index)
103
+ openContextMenu(x, y, menuEntries, invoke)
104
+ },
105
+ [hasModalOverlay, setCursor, openContextMenu, menuEntries, invoke],
106
+ )
107
+
79
108
  const extraStatusItems = useMemo(() => {
80
109
  const selectionCount = nav.selection != null ? nav.selection.end - nav.selection.start + 1 : 0
81
110
  const toggledCount = nav.toggledIndices.size
@@ -106,6 +135,8 @@ export function CodeSubview({
106
135
  showLineNumbers={showLineNumbers}
107
136
  marks={markState}
108
137
  docRef={docRef}
138
+ onRowClick={handleRowClick}
139
+ onRowContextMenu={handleRowContextMenu}
109
140
  />
110
141
  </SubviewLayout>
111
142
  )
@@ -1,6 +1,7 @@
1
- import { useEffect, useMemo, useRef } from "react"
1
+ import { useCallback, useEffect, useMemo, useRef } from "react"
2
2
  import { CodeView, type RowDocumentRenderable } from "@tooee/renderers"
3
3
  import { useTheme } from "@tooee/themes"
4
+ import { useHasModalOverlay } from "@tooee/overlays"
4
5
  import { useViewCommandContext } from "../../hooks/useViewCommandContext.js"
5
6
  import { useCopy, useNavigation } from "@tooee/shell"
6
7
  import { findMatchingLines, useSearch } from "@tooee/search"
@@ -29,6 +30,7 @@ export function CustomSubview({
29
30
  }: CustomSubviewProps) {
30
31
  const { theme } = useTheme()
31
32
  const docRef = useRef<RowDocumentRenderable>(null)
33
+ const hasModalOverlay = useHasModalOverlay()
32
34
  const textContent = useMemo(() => getTextContent(content), [content])
33
35
  const lines = useMemo(() => textContent.split("\n"), [textContent])
34
36
  const lineCount = lines.length
@@ -92,6 +94,20 @@ export function CustomSubview({
92
94
  ]
93
95
  }, [content.format, lineCount, nav.selection, nav.toggledIndices])
94
96
 
97
+ // Left-click selection for custom renderers. The framework does not own the
98
+ // renderer's markup, so it cannot map clicks to rows itself; instead it hands
99
+ // the renderer this callback (the mouse equivalent of the keyboard cursor
100
+ // move) to call from its own handlers. Guarded like the built-in views so a
101
+ // click never mutates the covered app while a modal overlay is up.
102
+ const setCursor = nav.setCursor
103
+ const handleSelectRow = useCallback(
104
+ (index: number) => {
105
+ if (hasModalOverlay) return
106
+ setCursor(index)
107
+ },
108
+ [hasModalOverlay, setCursor],
109
+ )
110
+
95
111
  const customRenderer = renderers?.[content.format]
96
112
  if (customRenderer) {
97
113
  const cursorLine = nav.cursor ?? undefined
@@ -113,6 +129,7 @@ export function CustomSubview({
113
129
  selectionStart,
114
130
  selectionEnd,
115
131
  marks: markState,
132
+ onSelectRow: handleSelectRow,
116
133
  })}
117
134
  </SubviewLayout>
118
135
  )
@@ -1,9 +1,17 @@
1
- import { useEffect, useMemo, useRef } from "react"
1
+ import { useCallback, useEffect, useMemo, useRef } from "react"
2
2
  import { marked } from "marked"
3
- import { MarkdownView, flattenTokens, type RowDocumentRenderable } from "@tooee/renderers"
3
+ import type { TextBufferRenderable } from "@opentui/core"
4
+ import {
5
+ MarkdownView,
6
+ flattenTokens,
7
+ type CodeBlockRenderer,
8
+ type RowDocumentRenderable,
9
+ } from "@tooee/renderers"
4
10
  import { useTheme } from "@tooee/themes"
11
+ import { useCommand, useCommandContext } from "@tooee/commands"
12
+ import { useHasModalOverlay } from "@tooee/overlays"
5
13
  import { useViewCommandContext } from "../../hooks/useViewCommandContext.js"
6
- import { useCopy, useNavigation } from "@tooee/shell"
14
+ import { actionsToContextMenuEntries, useContextMenu, useCopy, useNavigation } from "@tooee/shell"
7
15
  import { useSearch } from "@tooee/search"
8
16
  import type { MarkdownContent } from "../../types.js"
9
17
  import { useMarkState } from "../../hooks/useMarkState.js"
@@ -13,10 +21,15 @@ import type { SubviewProps } from "./types.js"
13
21
 
14
22
  interface MarkdownSubviewProps extends SubviewProps {
15
23
  content: MarkdownContent
24
+ codeBlockRenderers?: Record<string, CodeBlockRenderer>
16
25
  }
17
26
 
27
+ /** Columns moved per h/l press when scrolling a wide block horizontally. */
28
+ const BLOCK_HSCROLL_STEP = 4
29
+
18
30
  export function MarkdownSubview({
19
31
  content,
32
+ codeBlockRenderers,
20
33
  providerMarks,
21
34
  userMarks,
22
35
  setMarkSet,
@@ -28,6 +41,9 @@ export function MarkdownSubview({
28
41
  }: MarkdownSubviewProps) {
29
42
  const { theme } = useTheme()
30
43
  const docRef = useRef<RowDocumentRenderable>(null)
44
+ const hasModalOverlay = useHasModalOverlay()
45
+ const contextMenu = useContextMenu()
46
+ const { invoke } = useCommandContext()
31
47
  const textContent = content.markdown
32
48
  const lineCount = useMemo(() => textContent.split("\n").length, [textContent])
33
49
  const blocks = useMemo(() => flattenTokens(marked.lexer(content.markdown)), [content.markdown])
@@ -66,6 +82,60 @@ export function MarkdownSubview({
66
82
  }
67
83
  }, [nav.cursor])
68
84
 
85
+ // Horizontal panning for wide blocks (mermaid diagrams and code blocks).
86
+ // Blocks that can overflow horizontally register their text-buffer
87
+ // renderable by block index; h/l in cursor mode pans the block under the
88
+ // nav cursor via `scrollX` (the setter clamps to the content width).
89
+ const hScrollableBlocksRef = useRef<Map<number, TextBufferRenderable>>(new Map())
90
+ const cursorScrollable = () =>
91
+ nav.cursor !== null ? hScrollableBlocksRef.current.get(nav.cursor) : undefined
92
+ useCommand({
93
+ id: "block-scroll-left",
94
+ title: "Scroll block left",
95
+ hotkey: "h",
96
+ modes: ["cursor"],
97
+ when: () => cursorScrollable() != null,
98
+ handler: () => {
99
+ const target = cursorScrollable()
100
+ if (target) target.scrollX -= BLOCK_HSCROLL_STEP
101
+ },
102
+ })
103
+ useCommand({
104
+ id: "block-scroll-right",
105
+ title: "Scroll block right",
106
+ hotkey: "l",
107
+ modes: ["cursor"],
108
+ when: () => cursorScrollable() != null,
109
+ handler: () => {
110
+ const target = cursorScrollable()
111
+ if (target) target.scrollX += BLOCK_HSCROLL_STEP
112
+ },
113
+ })
114
+
115
+ const menuEntries = useMemo(() => actionsToContextMenuEntries(actions), [actions])
116
+
117
+ // Left-click selects the clicked block; right-click selects it and opens the
118
+ // same app-provided action menu as table/code rows. Both stand down while a
119
+ // modal overlay is up (theme picker, command palette, Ask/Choose), matching
120
+ // keyboard stand-down semantics.
121
+ const setCursor = nav.setCursor
122
+ const openContextMenu = contextMenu.open
123
+ const handleRowClick = useCallback(
124
+ (index: number) => {
125
+ if (hasModalOverlay) return
126
+ setCursor(index)
127
+ },
128
+ [hasModalOverlay, setCursor],
129
+ )
130
+ const handleRowContextMenu = useCallback(
131
+ (index: number, x: number, y: number) => {
132
+ if (hasModalOverlay) return
133
+ setCursor(index)
134
+ openContextMenu(x, y, menuEntries, invoke)
135
+ },
136
+ [hasModalOverlay, setCursor, openContextMenu, menuEntries, invoke],
137
+ )
138
+
69
139
  const { themeName, showLineNumbers } = useViewCommands({ content, textContent, actions })
70
140
 
71
141
  const markState = useMarkState({
@@ -116,6 +186,10 @@ export function MarkdownSubview({
116
186
  showLineNumbers={showLineNumbers}
117
187
  marks={markState}
118
188
  docRef={docRef}
189
+ hScrollableBlocksRef={hScrollableBlocksRef}
190
+ codeBlockRenderers={codeBlockRenderers}
191
+ onRowClick={handleRowClick}
192
+ onRowContextMenu={handleRowContextMenu}
119
193
  />
120
194
  </SubviewLayout>
121
195
  )
@@ -1,8 +1,10 @@
1
- import { useEffect, useMemo, useRef } from "react"
1
+ import { useCallback, useEffect, useMemo, useRef } from "react"
2
2
  import { Table, type RowDocumentRenderable } from "@tooee/renderers"
3
3
  import { useTheme } from "@tooee/themes"
4
+ import { useCommandContext } from "@tooee/commands"
5
+ import { useHasModalOverlay } from "@tooee/overlays"
4
6
  import { useViewCommandContext } from "../../hooks/useViewCommandContext.js"
5
- import { useCopy, useNavigation } from "@tooee/shell"
7
+ import { actionsToContextMenuEntries, useContextMenu, useCopy, useNavigation } from "@tooee/shell"
6
8
  import { useSearch } from "@tooee/search"
7
9
  import { getTextContent, type TableContent } from "../../types.js"
8
10
  import { useMarkState } from "../../hooks/useMarkState.js"
@@ -28,6 +30,9 @@ export function TableSubview({
28
30
  const { theme } = useTheme()
29
31
  const docRef = useRef<RowDocumentRenderable>(null)
30
32
  const textContent = useMemo(() => getTextContent(content), [content])
33
+ const contextMenu = useContextMenu()
34
+ const { invoke } = useCommandContext()
35
+ const hasModalOverlay = useHasModalOverlay()
31
36
 
32
37
  const nav = useNavigation({
33
38
  rowCount: content.rows.length,
@@ -107,6 +112,32 @@ export function TableSubview({
107
112
  },
108
113
  })
109
114
 
115
+ // Row-scoped context-menu entries come from the app-provided actions.
116
+ const menuEntries = useMemo(() => actionsToContextMenuEntries(actions), [actions])
117
+
118
+ // Row mouse handlers stand down while a modal overlay (theme picker, command
119
+ // palette, Ask/Choose overlays, the context menu itself) is up: centered
120
+ // overlays leave clickable margins around them, and mouse events route
121
+ // through the hit-grid, bypassing command-surface arbitration. Memoized so
122
+ // Table's rowElements memo keeps doing its job.
123
+ const setCursor = nav.setCursor
124
+ const openContextMenu = contextMenu.open
125
+ const handleRowClick = useCallback(
126
+ (index: number) => {
127
+ if (hasModalOverlay) return
128
+ setCursor(index)
129
+ },
130
+ [hasModalOverlay, setCursor],
131
+ )
132
+ const handleRowContextMenu = useCallback(
133
+ (index: number, x: number, y: number) => {
134
+ if (hasModalOverlay) return
135
+ setCursor(index)
136
+ openContextMenu(x, y, menuEntries, invoke)
137
+ },
138
+ [hasModalOverlay, setCursor, openContextMenu, menuEntries, invoke],
139
+ )
140
+
110
141
  const extraStatusItems = useMemo(() => {
111
142
  const selectionCount = nav.selection != null ? nav.selection.end - nav.selection.start + 1 : 0
112
143
  const toggledCount = nav.toggledIndices.size
@@ -144,6 +175,8 @@ export function TableSubview({
144
175
  showLineNumbers={showLineNumbers}
145
176
  marks={markState}
146
177
  docRef={docRef}
178
+ onRowClick={handleRowClick}
179
+ onRowContextMenu={handleRowContextMenu}
147
180
  />
148
181
  </SubviewLayout>
149
182
  )