@tooee/view 0.2.1 → 0.2.2
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/components/subviews/CodeSubview.js +3 -3
- package/dist/components/subviews/CodeSubview.js.map +1 -1
- package/dist/components/subviews/MarkdownSubview.d.ts.map +1 -1
- package/dist/components/subviews/MarkdownSubview.js +3 -3
- package/dist/components/subviews/MarkdownSubview.js.map +1 -1
- package/dist/components/subviews/TableSubview.d.ts.map +1 -1
- package/dist/components/subviews/TableSubview.js +3 -3
- package/dist/components/subviews/TableSubview.js.map +1 -1
- package/package.json +10 -10
- package/src/components/subviews/CodeSubview.tsx +3 -3
- package/src/components/subviews/MarkdownSubview.tsx +3 -7
- package/src/components/subviews/TableSubview.tsx +3 -4
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "@opentui/react/jsx-runtime";
|
|
2
2
|
import { useMemo } from "react";
|
|
3
3
|
import { CodeView, sourceLines, sourceLineAdapter } from "@tooee/renderers";
|
|
4
|
-
import {
|
|
4
|
+
import { useDocumentController } from "@tooee/shell";
|
|
5
5
|
import { useContentCommands } from "../../hooks/useContentCommands.js";
|
|
6
6
|
import { ViewScreen } from "../ViewScreen.js";
|
|
7
7
|
export function CodeSubview({ content, decorations, actions, ...screen }) {
|
|
@@ -9,13 +9,13 @@ export function CodeSubview({ content, decorations, actions, ...screen }) {
|
|
|
9
9
|
// One navigation row per physical source line; row index is the source line.
|
|
10
10
|
const lineRows = useMemo(() => sourceLines(textContent), [textContent]);
|
|
11
11
|
const { showLineNumbers } = useContentCommands({ content, textContent });
|
|
12
|
-
const contextMenu = useMemo(() => actionsToContextMenuEntries(actions), [actions]);
|
|
13
12
|
const document = useDocumentController({
|
|
14
13
|
rows: lineRows,
|
|
15
14
|
adapter: sourceLineAdapter,
|
|
16
15
|
multiSelect: true,
|
|
17
16
|
decorations,
|
|
18
|
-
|
|
17
|
+
// The controller projects the screen's actions onto menu entries at open time.
|
|
18
|
+
contextMenu: actions,
|
|
19
19
|
});
|
|
20
20
|
const statusItems = useMemo(() => [
|
|
21
21
|
{ label: "Format:", value: content.format },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CodeSubview.js","sourceRoot":"","sources":["../../../src/components/subviews/CodeSubview.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AAC/B,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,iBAAiB,EAAsB,MAAM,kBAAkB,CAAA;AAC/F,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"CodeSubview.js","sourceRoot":"","sources":["../../../src/components/subviews/CodeSubview.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AAC/B,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,iBAAiB,EAAsB,MAAM,kBAAkB,CAAA;AAC/F,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAA;AAEpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAA;AACtE,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAO7C,MAAM,UAAU,WAAW,CAAC,EAAE,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,GAAG,MAAM,EAAoB;IACxF,MAAM,WAAW,GAAG,OAAO,CAAC,MAAM,KAAK,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAA;IAC3E,6EAA6E;IAC7E,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,WAAW,CAAC,WAAW,CAAC,EAAE,CAAC,WAAW,CAAC,CAAC,CAAA;IAEvE,MAAM,EAAE,eAAe,EAAE,GAAG,kBAAkB,CAAC,EAAE,OAAO,EAAE,WAAW,EAAE,CAAC,CAAA;IAExE,MAAM,QAAQ,GAAG,qBAAqB,CAAgB;QACpD,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,iBAAiB;QAC1B,WAAW,EAAE,IAAI;QACjB,WAAW;QACX,+EAA+E;QAC/E,WAAW,EAAE,OAAO;KACrB,CAAC,CAAA;IAEF,MAAM,WAAW,GAAG,OAAO,CACzB,GAAG,EAAE,CAAC;QACJ,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,CAAC,MAAM,EAAE;QAC3C,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE;KACpD,EACD,CAAC,OAAO,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,CAClC,CAAA;IAED,OAAO,CACL,KAAC,UAAU,IACT,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,QAAQ,EACpB,OAAO,EAAE,OAAO,EAChB,WAAW,EAAE,WAAW,KACpB,MAAM,YAEV,KAAC,QAAQ,IACP,OAAO,EAAE,WAAW,EACpB,QAAQ,EAAE,OAAO,CAAC,MAAM,KAAK,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,EAClE,eAAe,EAAE,eAAe,EAChC,QAAQ,EAAE,QAAQ,GAClB,GACS,CACd,CAAA;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MarkdownSubview.d.ts","sourceRoot":"","sources":["../../../src/components/subviews/MarkdownSubview.tsx"],"names":[],"mappings":"AAEA,OAAO,EAIL,KAAK,iBAAiB,EAEvB,MAAM,kBAAkB,CAAA;
|
|
1
|
+
{"version":3,"file":"MarkdownSubview.d.ts","sourceRoot":"","sources":["../../../src/components/subviews/MarkdownSubview.tsx"],"names":[],"mappings":"AAEA,OAAO,EAIL,KAAK,iBAAiB,EAEvB,MAAM,kBAAkB,CAAA;AAGzB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAGrD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAE9C,UAAU,oBAAqB,SAAQ,YAAY;IACjD,OAAO,EAAE,eAAe,CAAA;IACxB,kBAAkB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAA;CACvD;AAeD,wBAAgB,eAAe,CAAC,EAC9B,OAAO,EACP,kBAAkB,EAClB,WAAW,EACX,OAAO,EACP,GAAG,MAAM,EACV,EAAE,oBAAoB,6BAsEtB"}
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx } from "@opentui/react/jsx-runtime";
|
|
|
2
2
|
import { useMemo, useRef } from "react";
|
|
3
3
|
import { MarkdownView, flattenMarkdown, getFlatBlockText, } from "@tooee/renderers";
|
|
4
4
|
import { useCommand } from "@tooee/commands";
|
|
5
|
-
import {
|
|
5
|
+
import { useDocumentController } from "@tooee/shell";
|
|
6
6
|
import { useContentCommands } from "../../hooks/useContentCommands.js";
|
|
7
7
|
import { ViewScreen } from "../ViewScreen.js";
|
|
8
8
|
/** Columns moved per h/l press when scrolling a wide block horizontally. */
|
|
@@ -21,13 +21,13 @@ export function MarkdownSubview({ content, codeBlockRenderers, decorations, acti
|
|
|
21
21
|
const lineCount = useMemo(() => textContent.split("\n").length, [textContent]);
|
|
22
22
|
const blocks = useMemo(() => flattenMarkdown(content.markdown), [content.markdown]);
|
|
23
23
|
const { showLineNumbers } = useContentCommands({ content, textContent });
|
|
24
|
-
const contextMenu = useMemo(() => actionsToContextMenuEntries(actions), [actions]);
|
|
25
24
|
const document = useDocumentController({
|
|
26
25
|
rows: blocks,
|
|
27
26
|
adapter: MARKDOWN_BLOCK_ADAPTER,
|
|
28
27
|
multiSelect: true,
|
|
29
28
|
decorations,
|
|
30
|
-
|
|
29
|
+
// The controller projects the screen's actions onto menu entries at open time.
|
|
30
|
+
contextMenu: actions,
|
|
31
31
|
});
|
|
32
32
|
const hScrollableBlocksRef = useRef(new Map());
|
|
33
33
|
const cursorScrollable = () => document.activeIndex !== null
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MarkdownSubview.js","sourceRoot":"","sources":["../../../src/components/subviews/MarkdownSubview.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAA;AAEvC,OAAO,EACL,YAAY,EACZ,eAAe,EACf,gBAAgB,GAGjB,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,
|
|
1
|
+
{"version":3,"file":"MarkdownSubview.js","sourceRoot":"","sources":["../../../src/components/subviews/MarkdownSubview.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAA;AAEvC,OAAO,EACL,YAAY,EACZ,eAAe,EACf,gBAAgB,GAGjB,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,EAAE,qBAAqB,EAA2B,MAAM,cAAc,CAAA;AAE7E,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAA;AACtE,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAQ7C,4EAA4E;AAC5E,MAAM,kBAAkB,GAAG,CAAC,CAAA;AAE5B;;;;GAIG;AACH,MAAM,sBAAsB,GAAkC;IAC5D,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,gBAAgB,CAAC,KAAK,CAAC;IAC3C,SAAS,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM;CACnC,CAAA;AAED,MAAM,UAAU,eAAe,CAAC,EAC9B,OAAO,EACP,kBAAkB,EAClB,WAAW,EACX,OAAO,EACP,GAAG,MAAM,EACY;IACrB,MAAM,WAAW,GAAG,OAAO,CAAC,QAAQ,CAAA;IACpC,MAAM,SAAS,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,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EAAE,OAAO,EAAE,GAAG,MAAM,EAAE,EAAE,iBAAiB,
|
|
1
|
+
{"version":3,"file":"TableSubview.d.ts","sourceRoot":"","sources":["../../../src/components/subviews/TableSubview.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAkB,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAGlE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAE9C,UAAU,iBAAkB,SAAQ,YAAY;IAC9C,OAAO,EAAE,YAAY,CAAA;CACtB;AAED,wBAAgB,YAAY,CAAC,EAAE,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,GAAG,MAAM,EAAE,EAAE,iBAAiB,6BAyC3F"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "@opentui/react/jsx-runtime";
|
|
2
2
|
import { useMemo } from "react";
|
|
3
3
|
import { Table } from "@tooee/renderers";
|
|
4
|
-
import {
|
|
4
|
+
import { useDocumentController } from "@tooee/shell";
|
|
5
5
|
import { getTextContent } from "../../types.js";
|
|
6
6
|
import { useContentCommands } from "../../hooks/useContentCommands.js";
|
|
7
7
|
import { ViewScreen } from "../ViewScreen.js";
|
|
@@ -12,13 +12,13 @@ export function TableSubview({ content, decorations, actions, ...screen }) {
|
|
|
12
12
|
const adapter = useMemo(() => ({
|
|
13
13
|
getText: (row) => columns.map((column) => stringifyRowCell(row[column.key])).join("\t"),
|
|
14
14
|
}), [columns]);
|
|
15
|
-
const contextMenu = useMemo(() => actionsToContextMenuEntries(actions), [actions]);
|
|
16
15
|
const document = useDocumentController({
|
|
17
16
|
rows,
|
|
18
17
|
adapter,
|
|
19
18
|
multiSelect: true,
|
|
20
19
|
decorations,
|
|
21
|
-
|
|
20
|
+
// The controller projects the screen's actions onto menu entries at open time.
|
|
21
|
+
contextMenu: actions,
|
|
22
22
|
});
|
|
23
23
|
const statusItems = useMemo(() => [
|
|
24
24
|
{ label: "Format:", value: content.format },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableSubview.js","sourceRoot":"","sources":["../../../src/components/subviews/TableSubview.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AAC/B,OAAO,EAAE,KAAK,EAAiB,MAAM,kBAAkB,CAAA;AACvD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"TableSubview.js","sourceRoot":"","sources":["../../../src/components/subviews/TableSubview.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AAC/B,OAAO,EAAE,KAAK,EAAiB,MAAM,kBAAkB,CAAA;AACvD,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAA;AACpD,OAAO,EAAE,cAAc,EAAqB,MAAM,gBAAgB,CAAA;AAClE,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAA;AACtE,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAO7C,MAAM,UAAU,YAAY,CAAC,EAAE,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,GAAG,MAAM,EAAqB;IAC1F,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,cAAc,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAA;IACrE,MAAM,EAAE,eAAe,EAAE,GAAG,kBAAkB,CAAC,EAAE,OAAO,EAAE,WAAW,EAAE,CAAC,CAAA;IAExE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,OAAO,CAAA;IACjC,MAAM,OAAO,GAAG,OAAO,CACrB,GAAG,EAAE,CAAC,CAAC;QACL,OAAO,EAAE,CAAC,GAAa,EAAE,EAAE,CACzB,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,gBAAgB,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;KACxE,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AC;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.2.
|
|
3
|
+
"version": "0.2.2",
|
|
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.2.
|
|
41
|
-
"@tooee/config": "0.2.
|
|
42
|
-
"@tooee/layout": "0.2.
|
|
43
|
-
"@tooee/marks": "0.2.
|
|
44
|
-
"@tooee/overlays": "0.2.
|
|
45
|
-
"@tooee/renderers": "0.2.
|
|
46
|
-
"@tooee/search": "0.2.
|
|
47
|
-
"@tooee/shell": "0.2.
|
|
48
|
-
"@tooee/themes": "0.2.
|
|
40
|
+
"@tooee/commands": "0.2.2",
|
|
41
|
+
"@tooee/config": "0.2.2",
|
|
42
|
+
"@tooee/layout": "0.2.2",
|
|
43
|
+
"@tooee/marks": "0.2.2",
|
|
44
|
+
"@tooee/overlays": "0.2.2",
|
|
45
|
+
"@tooee/renderers": "0.2.2",
|
|
46
|
+
"@tooee/search": "0.2.2",
|
|
47
|
+
"@tooee/shell": "0.2.2",
|
|
48
|
+
"@tooee/themes": "0.2.2",
|
|
49
49
|
"marked": "^17.0.4"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useMemo } from "react"
|
|
2
2
|
import { CodeView, sourceLines, sourceLineAdapter, type SourceLineRow } from "@tooee/renderers"
|
|
3
|
-
import {
|
|
3
|
+
import { useDocumentController } from "@tooee/shell"
|
|
4
4
|
import type { CodeContent, TextContent } from "../../types.js"
|
|
5
5
|
import { useContentCommands } from "../../hooks/useContentCommands.js"
|
|
6
6
|
import { ViewScreen } from "../ViewScreen.js"
|
|
@@ -16,14 +16,14 @@ export function CodeSubview({ content, decorations, actions, ...screen }: CodeSu
|
|
|
16
16
|
const lineRows = useMemo(() => sourceLines(textContent), [textContent])
|
|
17
17
|
|
|
18
18
|
const { showLineNumbers } = useContentCommands({ content, textContent })
|
|
19
|
-
const contextMenu = useMemo(() => actionsToContextMenuEntries(actions), [actions])
|
|
20
19
|
|
|
21
20
|
const document = useDocumentController<SourceLineRow>({
|
|
22
21
|
rows: lineRows,
|
|
23
22
|
adapter: sourceLineAdapter,
|
|
24
23
|
multiSelect: true,
|
|
25
24
|
decorations,
|
|
26
|
-
|
|
25
|
+
// The controller projects the screen's actions onto menu entries at open time.
|
|
26
|
+
contextMenu: actions,
|
|
27
27
|
})
|
|
28
28
|
|
|
29
29
|
const statusItems = useMemo(
|
|
@@ -8,11 +8,7 @@ import {
|
|
|
8
8
|
type FlatBlock,
|
|
9
9
|
} from "@tooee/renderers"
|
|
10
10
|
import { useCommand } from "@tooee/commands"
|
|
11
|
-
import {
|
|
12
|
-
actionsToContextMenuEntries,
|
|
13
|
-
useDocumentController,
|
|
14
|
-
type DocumentRowAdapter,
|
|
15
|
-
} from "@tooee/shell"
|
|
11
|
+
import { useDocumentController, type DocumentRowAdapter } from "@tooee/shell"
|
|
16
12
|
import type { MarkdownContent } from "../../types.js"
|
|
17
13
|
import { useContentCommands } from "../../hooks/useContentCommands.js"
|
|
18
14
|
import { ViewScreen } from "../ViewScreen.js"
|
|
@@ -48,14 +44,14 @@ export function MarkdownSubview({
|
|
|
48
44
|
const blocks = useMemo(() => flattenMarkdown(content.markdown), [content.markdown])
|
|
49
45
|
|
|
50
46
|
const { showLineNumbers } = useContentCommands({ content, textContent })
|
|
51
|
-
const contextMenu = useMemo(() => actionsToContextMenuEntries(actions), [actions])
|
|
52
47
|
|
|
53
48
|
const document = useDocumentController<FlatBlock>({
|
|
54
49
|
rows: blocks,
|
|
55
50
|
adapter: MARKDOWN_BLOCK_ADAPTER,
|
|
56
51
|
multiSelect: true,
|
|
57
52
|
decorations,
|
|
58
|
-
|
|
53
|
+
// The controller projects the screen's actions onto menu entries at open time.
|
|
54
|
+
contextMenu: actions,
|
|
59
55
|
})
|
|
60
56
|
|
|
61
57
|
const hScrollableBlocksRef = useRef<Map<number, TextBufferRenderable>>(new Map())
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useMemo } from "react"
|
|
2
2
|
import { Table, type TableRow } from "@tooee/renderers"
|
|
3
|
-
import {
|
|
3
|
+
import { useDocumentController } from "@tooee/shell"
|
|
4
4
|
import { getTextContent, type TableContent } from "../../types.js"
|
|
5
5
|
import { useContentCommands } from "../../hooks/useContentCommands.js"
|
|
6
6
|
import { ViewScreen } from "../ViewScreen.js"
|
|
@@ -22,14 +22,13 @@ export function TableSubview({ content, decorations, actions, ...screen }: Table
|
|
|
22
22
|
}),
|
|
23
23
|
[columns],
|
|
24
24
|
)
|
|
25
|
-
const contextMenu = useMemo(() => actionsToContextMenuEntries(actions), [actions])
|
|
26
|
-
|
|
27
25
|
const document = useDocumentController<TableRow>({
|
|
28
26
|
rows,
|
|
29
27
|
adapter,
|
|
30
28
|
multiSelect: true,
|
|
31
29
|
decorations,
|
|
32
|
-
|
|
30
|
+
// The controller projects the screen's actions onto menu entries at open time.
|
|
31
|
+
contextMenu: actions,
|
|
33
32
|
})
|
|
34
33
|
|
|
35
34
|
const statusItems = useMemo(
|