@tooee/view 0.2.4 → 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/README.md +15 -15
- package/dist/components/subviews/{CodeSubview.d.ts → code-subview.d.ts} +2 -2
- package/dist/components/subviews/code-subview.d.ts.map +1 -0
- package/dist/components/subviews/{CodeSubview.js → code-subview.js} +8 -8
- package/dist/components/subviews/code-subview.js.map +1 -0
- package/dist/components/subviews/custom-subview.d.ts +9 -0
- package/dist/components/subviews/custom-subview.d.ts.map +1 -0
- package/dist/components/subviews/{CustomSubview.js → custom-subview.js} +7 -7
- package/dist/components/subviews/custom-subview.js.map +1 -0
- package/dist/components/subviews/index.d.ts +4 -4
- package/dist/components/subviews/index.d.ts.map +1 -1
- package/dist/components/subviews/index.js +4 -4
- package/dist/components/subviews/index.js.map +1 -1
- package/dist/components/subviews/{MarkdownSubview.d.ts → markdown-subview.d.ts} +3 -3
- package/dist/components/subviews/markdown-subview.d.ts.map +1 -0
- package/dist/components/subviews/{MarkdownSubview.js → markdown-subview.js} +27 -25
- package/dist/components/subviews/markdown-subview.js.map +1 -0
- package/dist/components/subviews/table-subview.d.ts +8 -0
- package/dist/components/subviews/table-subview.d.ts.map +1 -0
- package/dist/components/subviews/{TableSubview.js → table-subview.js} +40 -22
- package/dist/components/subviews/table-subview.js.map +1 -0
- package/dist/components/subviews/types.d.ts.map +1 -1
- package/dist/components/{ViewScreen.d.ts → view-screen.d.ts} +3 -3
- package/dist/components/view-screen.d.ts.map +1 -0
- package/dist/components/{ViewScreen.js → view-screen.js} +11 -11
- package/dist/components/view-screen.js.map +1 -0
- package/dist/content-loader-store.d.ts +11 -7
- package/dist/content-loader-store.d.ts.map +1 -1
- package/dist/content-loader-store.js +70 -50
- package/dist/content-loader-store.js.map +1 -1
- package/dist/default-provider.d.ts +4 -4
- package/dist/default-provider.d.ts.map +1 -1
- package/dist/default-provider.js +48 -39
- package/dist/default-provider.js.map +1 -1
- package/dist/directory-provider.d.ts +2 -2
- package/dist/directory-provider.d.ts.map +1 -1
- package/dist/directory-provider.js +13 -10
- package/dist/directory-provider.js.map +1 -1
- package/dist/directory-view.d.ts +8 -0
- package/dist/directory-view.d.ts.map +1 -0
- package/dist/{DirectoryView.js → directory-view.js} +18 -12
- package/dist/directory-view.js.map +1 -0
- package/dist/hooks/index.d.ts +4 -4
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +3 -3
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/{useContentCommands.d.ts → use-content-commands.d.ts} +2 -2
- package/dist/hooks/use-content-commands.d.ts.map +1 -0
- package/dist/hooks/{useContentCommands.js → use-content-commands.js} +6 -4
- package/dist/hooks/use-content-commands.js.map +1 -0
- package/dist/hooks/{useContentLoader.d.ts → use-content-loader.d.ts} +4 -4
- package/dist/hooks/use-content-loader.d.ts.map +1 -0
- package/dist/hooks/use-content-loader.js +81 -0
- package/dist/hooks/use-content-loader.js.map +1 -0
- package/dist/hooks/{useViewCommandContext.d.ts → use-view-command-context.d.ts} +3 -3
- package/dist/hooks/use-view-command-context.d.ts.map +1 -0
- package/dist/hooks/{useViewCommandContext.js → use-view-command-context.js} +15 -13
- package/dist/hooks/use-view-command-context.js.map +1 -0
- package/dist/index.d.ts +4 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/launch.d.ts +2 -2
- package/dist/launch.d.ts.map +1 -1
- package/dist/launch.js +6 -6
- package/dist/launch.js.map +1 -1
- package/dist/types.d.ts +4 -4
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +46 -24
- package/dist/types.js.map +1 -1
- package/dist/{View.d.ts → view.d.ts} +3 -3
- package/dist/view.d.ts.map +1 -0
- package/dist/{View.js → view.js} +19 -13
- package/dist/view.js.map +1 -0
- package/package.json +10 -10
- package/src/components/subviews/{CodeSubview.tsx → code-subview.tsx} +25 -19
- package/src/components/subviews/{CustomSubview.tsx → custom-subview.tsx} +23 -21
- package/src/components/subviews/index.ts +5 -5
- package/src/components/subviews/{MarkdownSubview.tsx → markdown-subview.tsx} +53 -54
- package/src/components/subviews/table-subview.tsx +95 -0
- package/src/components/subviews/types.ts +14 -14
- package/src/components/{ViewScreen.tsx → view-screen.tsx} +33 -32
- package/src/content-loader-store.ts +131 -99
- package/src/default-provider.ts +84 -64
- package/src/directory-provider.ts +32 -24
- package/src/directory-view.tsx +79 -0
- package/src/hooks/index.ts +7 -4
- package/src/hooks/{useContentCommands.ts → use-content-commands.ts} +19 -14
- package/src/hooks/use-content-loader.ts +92 -0
- package/src/hooks/{useViewCommandContext.ts → use-view-command-context.ts} +40 -38
- package/src/index.ts +14 -14
- package/src/launch.tsx +20 -18
- package/src/types.ts +107 -78
- package/src/{View.tsx → view.tsx} +51 -44
- package/dist/DirectoryView.d.ts +0 -7
- package/dist/DirectoryView.d.ts.map +0 -1
- package/dist/DirectoryView.js.map +0 -1
- package/dist/View.d.ts.map +0 -1
- package/dist/View.js.map +0 -1
- package/dist/components/ViewScreen.d.ts.map +0 -1
- package/dist/components/ViewScreen.js.map +0 -1
- package/dist/components/subviews/CodeSubview.d.ts.map +0 -1
- package/dist/components/subviews/CodeSubview.js.map +0 -1
- package/dist/components/subviews/CustomSubview.d.ts +0 -9
- package/dist/components/subviews/CustomSubview.d.ts.map +0 -1
- package/dist/components/subviews/CustomSubview.js.map +0 -1
- package/dist/components/subviews/MarkdownSubview.d.ts.map +0 -1
- package/dist/components/subviews/MarkdownSubview.js.map +0 -1
- package/dist/components/subviews/TableSubview.d.ts +0 -8
- package/dist/components/subviews/TableSubview.d.ts.map +0 -1
- package/dist/components/subviews/TableSubview.js.map +0 -1
- package/dist/hooks/useContentCommands.d.ts.map +0 -1
- package/dist/hooks/useContentCommands.js.map +0 -1
- package/dist/hooks/useContentLoader.d.ts.map +0 -1
- package/dist/hooks/useContentLoader.js +0 -55
- package/dist/hooks/useContentLoader.js.map +0 -1
- package/dist/hooks/useViewCommandContext.d.ts.map +0 -1
- package/dist/hooks/useViewCommandContext.js.map +0 -1
- package/src/DirectoryView.tsx +0 -68
- package/src/components/subviews/TableSubview.tsx +0 -65
- package/src/hooks/useContentLoader.ts +0 -72
package/README.md
CHANGED
|
@@ -14,25 +14,25 @@ the document controller: `rowCount`, `cursor`, `activeKey`, `activeRow`,
|
|
|
14
14
|
row actions read the cursor from there:
|
|
15
15
|
|
|
16
16
|
```ts
|
|
17
|
-
handler: (ctx) => open(ctx.document?.activeRow)
|
|
17
|
+
handler: (ctx) => open(ctx.document?.activeRow);
|
|
18
18
|
```
|
|
19
19
|
|
|
20
20
|
`ctx.view` is content-only — what the viewer knows and the controller does not:
|
|
21
21
|
|
|
22
22
|
```ts
|
|
23
23
|
interface ViewCommandContext {
|
|
24
|
-
content: AnyContent
|
|
25
|
-
format: string
|
|
26
|
-
title?: string
|
|
27
|
-
data?: unknown
|
|
28
|
-
reload: () => void
|
|
24
|
+
content: AnyContent;
|
|
25
|
+
format: string;
|
|
26
|
+
title?: string;
|
|
27
|
+
data?: unknown;
|
|
28
|
+
reload: () => void;
|
|
29
29
|
marks: {
|
|
30
|
-
setMarkSet(set: MarkSet): void
|
|
31
|
-
clearNamespace(namespace: string): void
|
|
32
|
-
clearAll(): void
|
|
33
|
-
userMarks: MarkSet[]
|
|
34
|
-
providerMarks: MarkSet[]
|
|
35
|
-
}
|
|
30
|
+
setMarkSet(set: MarkSet): void;
|
|
31
|
+
clearNamespace(namespace: string): void;
|
|
32
|
+
clearAll(): void;
|
|
33
|
+
userMarks: MarkSet[];
|
|
34
|
+
providerMarks: MarkSet[];
|
|
35
|
+
};
|
|
36
36
|
}
|
|
37
37
|
```
|
|
38
38
|
|
|
@@ -42,13 +42,13 @@ Custom surfaces that behave like a view, but do not render the built-in `View`
|
|
|
42
42
|
component, can publish the `ctx.view` slice with `useProvideViewCommandContext`:
|
|
43
43
|
|
|
44
44
|
```tsx
|
|
45
|
-
import { useProvideViewCommandContext } from "@tooee/view"
|
|
45
|
+
import { useProvideViewCommandContext } from "@tooee/view";
|
|
46
46
|
|
|
47
47
|
useProvideViewCommandContext({
|
|
48
48
|
format: "stream-dashboard",
|
|
49
49
|
title: "Stream Dashboard",
|
|
50
50
|
data: { rowCount: rows.length },
|
|
51
|
-
})
|
|
51
|
+
});
|
|
52
52
|
```
|
|
53
53
|
|
|
54
54
|
The hook fills safe defaults for headless surfaces: synthetic custom content,
|
|
@@ -69,7 +69,7 @@ const KanbanRenderer: ContentRenderer = ({ content, document }) => (
|
|
|
69
69
|
<box onMouseDown={() => document.selectRow(0)}>
|
|
70
70
|
<text content={`cursor: ${document.activeIndex}`} />
|
|
71
71
|
</box>
|
|
72
|
-
)
|
|
72
|
+
);
|
|
73
73
|
```
|
|
74
74
|
|
|
75
75
|
A renderer that owns a `<row-document>` binds the controller directly — it
|
|
@@ -3,6 +3,6 @@ import type { SubviewProps } from "./types.js";
|
|
|
3
3
|
interface CodeSubviewProps extends SubviewProps {
|
|
4
4
|
content: CodeContent | TextContent;
|
|
5
5
|
}
|
|
6
|
-
export declare
|
|
6
|
+
export declare const CodeSubview: ({ content, decorations, actions, ...screen }: CodeSubviewProps) => React.ReactNode;
|
|
7
7
|
export {};
|
|
8
|
-
//# sourceMappingURL=
|
|
8
|
+
//# sourceMappingURL=code-subview.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"code-subview.d.ts","sourceRoot":"","sources":["../../../src/components/subviews/code-subview.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAG/D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/C,UAAU,gBAAiB,SAAQ,YAAY;IAC7C,OAAO,EAAE,WAAW,GAAG,WAAW,CAAC;CACpC;AAED,eAAO,MAAM,WAAW,GAAwB,8CAK7C,gBAAgB,KAAG,KAAK,CAAC,SAwC3B,CAAC"}
|
|
@@ -2,25 +2,25 @@ 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
4
|
import { useDocumentController } from "@tooee/shell";
|
|
5
|
-
import { useContentCommands } from "../../hooks/
|
|
6
|
-
import { ViewScreen } from "../
|
|
7
|
-
export function CodeSubview({ content, decorations, actions, ...screen }) {
|
|
5
|
+
import { useContentCommands } from "../../hooks/use-content-commands.js";
|
|
6
|
+
import { ViewScreen } from "../view-screen.js";
|
|
7
|
+
export const CodeSubview = function CodeSubview({ content, decorations, actions, ...screen }) {
|
|
8
8
|
const textContent = content.format === "code" ? content.code : content.text;
|
|
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
12
|
const document = useDocumentController({
|
|
13
|
-
rows: lineRows,
|
|
14
13
|
adapter: sourceLineAdapter,
|
|
15
|
-
multiSelect: true,
|
|
16
|
-
decorations,
|
|
17
14
|
// The controller projects the screen's actions onto menu entries at open time.
|
|
18
15
|
contextMenu: actions,
|
|
16
|
+
decorations,
|
|
17
|
+
multiSelect: true,
|
|
18
|
+
rows: lineRows,
|
|
19
19
|
});
|
|
20
20
|
const statusItems = useMemo(() => [
|
|
21
21
|
{ label: "Format:", value: content.format },
|
|
22
22
|
{ label: "Lines:", value: String(lineRows.length) },
|
|
23
23
|
], [content.format, lineRows.length]);
|
|
24
24
|
return (_jsx(ViewScreen, { content: content, controller: document, actions: actions, statusItems: statusItems, ...screen, children: _jsx(CodeView, { content: textContent, language: content.format === "code" ? content.language : undefined, showLineNumbers: showLineNumbers, document: document }) }));
|
|
25
|
-
}
|
|
26
|
-
//# sourceMappingURL=
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=code-subview.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1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,EAAE;KACpD,EACD,CAAC,OAAO,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,CAClC,CAAC;IAEF,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,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { CustomContent, ContentRenderer } from "../../types.js";
|
|
2
|
+
import type { SubviewProps } from "./types.js";
|
|
3
|
+
interface CustomSubviewProps extends SubviewProps {
|
|
4
|
+
content: CustomContent;
|
|
5
|
+
renderers?: Record<string, ContentRenderer>;
|
|
6
|
+
}
|
|
7
|
+
export declare const CustomSubview: ({ content, decorations, actions, renderers, ...screen }: CustomSubviewProps) => React.ReactNode;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=custom-subview.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"custom-subview.d.ts","sourceRoot":"","sources":["../../../src/components/subviews/custom-subview.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAGrE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/C,UAAU,kBAAmB,SAAQ,YAAY;IAC/C,OAAO,EAAE,aAAa,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;CAC7C;AAED,eAAO,MAAM,aAAa,GAA0B,yDAMjD,kBAAkB,KAAG,KAAK,CAAC,SAwC7B,CAAC"}
|
|
@@ -3,19 +3,19 @@ import { useMemo } from "react";
|
|
|
3
3
|
import { CodeView, sourceLines, sourceLineAdapter } from "@tooee/renderers";
|
|
4
4
|
import { useDocumentController } from "@tooee/shell";
|
|
5
5
|
import { getTextContent } from "../../types.js";
|
|
6
|
-
import { useContentCommands } from "../../hooks/
|
|
7
|
-
import { ViewScreen } from "../
|
|
8
|
-
export function CustomSubview({ content, decorations, actions, renderers, ...screen }) {
|
|
6
|
+
import { useContentCommands } from "../../hooks/use-content-commands.js";
|
|
7
|
+
import { ViewScreen } from "../view-screen.js";
|
|
8
|
+
export const CustomSubview = function CustomSubview({ content, decorations, actions, renderers, ...screen }) {
|
|
9
9
|
const textContent = useMemo(() => getTextContent(content), [content]);
|
|
10
10
|
// Fallback rows are source lines; row index is the source line.
|
|
11
11
|
const lineRows = useMemo(() => sourceLines(textContent), [textContent]);
|
|
12
12
|
useContentCommands({ content, textContent });
|
|
13
13
|
// Custom content has no action rows of its own, so no context menu is bound.
|
|
14
14
|
const document = useDocumentController({
|
|
15
|
-
rows: lineRows,
|
|
16
15
|
adapter: sourceLineAdapter,
|
|
17
|
-
multiSelect: true,
|
|
18
16
|
decorations,
|
|
17
|
+
multiSelect: true,
|
|
18
|
+
rows: lineRows,
|
|
19
19
|
});
|
|
20
20
|
const statusItems = useMemo(() => [
|
|
21
21
|
{ label: "Format:", value: content.format },
|
|
@@ -23,5 +23,5 @@ export function CustomSubview({ content, decorations, actions, renderers, ...scr
|
|
|
23
23
|
], [content.format, lineRows.length]);
|
|
24
24
|
const customRenderer = renderers?.[content.format];
|
|
25
25
|
return (_jsx(ViewScreen, { content: content, controller: document, actions: actions, statusItems: statusItems, ...screen, children: customRenderer ? (customRenderer({ content, document })) : (_jsx(CodeView, { content: textContent, showLineNumbers: false, document: document })) }));
|
|
26
|
-
}
|
|
27
|
-
//# sourceMappingURL=
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=custom-subview.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"custom-subview.js","sourceRoot":"","sources":["../../../src/components/subviews/custom-subview.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAChC,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAE5E,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAEhD,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AACzE,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAQ/C,MAAM,CAAC,MAAM,aAAa,GAAG,SAAS,aAAa,CAAC,EAClD,OAAO,EACP,WAAW,EACX,OAAO,EACP,SAAS,EACT,GAAG,MAAM,EACU;IACnB,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,cAAc,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;IACtE,gEAAgE;IAChE,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,WAAW,CAAC,WAAW,CAAC,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC;IAExE,kBAAkB,CAAC,EAAE,OAAO,EAAE,WAAW,EAAE,CAAC,CAAC;IAE7C,6EAA6E;IAC7E,MAAM,QAAQ,GAAG,qBAAqB,CAAgB;QACpD,OAAO,EAAE,iBAAiB;QAC1B,WAAW;QACX,WAAW,EAAE,IAAI;QACjB,IAAI,EAAE,QAAQ;KACf,CAAC,CAAC;IAEH,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,CAAC;IAEF,MAAM,cAAc,GAAG,SAAS,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAEnD,OAAO,CACL,KAAC,UAAU,IACT,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,QAAQ,EACpB,OAAO,EAAE,OAAO,EAChB,WAAW,EAAE,WAAW,KACpB,MAAM,YAET,cAAc,CAAC,CAAC,CAAC,CAChB,cAAc,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC,CACtC,CAAC,CAAC,CAAC,CACF,KAAC,QAAQ,IAAC,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,GAAI,CAC/E,GACU,CACd,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { MarkdownSubview } from "./
|
|
2
|
-
export { CodeSubview } from "./
|
|
3
|
-
export { TableSubview } from "./
|
|
4
|
-
export { CustomSubview } from "./
|
|
1
|
+
export { MarkdownSubview } from "./markdown-subview.js";
|
|
2
|
+
export { CodeSubview } from "./code-subview.js";
|
|
3
|
+
export { TableSubview } from "./table-subview.js";
|
|
4
|
+
export { CustomSubview } from "./custom-subview.js";
|
|
5
5
|
export type { SubviewProps } from "./types.js";
|
|
6
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/subviews/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/subviews/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,YAAY,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { MarkdownSubview } from "./
|
|
2
|
-
export { CodeSubview } from "./
|
|
3
|
-
export { TableSubview } from "./
|
|
4
|
-
export { CustomSubview } from "./
|
|
1
|
+
export { MarkdownSubview } from "./markdown-subview.js";
|
|
2
|
+
export { CodeSubview } from "./code-subview.js";
|
|
3
|
+
export { TableSubview } from "./table-subview.js";
|
|
4
|
+
export { CustomSubview } from "./custom-subview.js";
|
|
5
5
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/subviews/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/subviews/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { CodeBlockRenderer, MarkdownLinkHandler } from "@tooee/renderers";
|
|
2
2
|
import type { MarkdownContent } from "../../types.js";
|
|
3
3
|
import type { SubviewProps } from "./types.js";
|
|
4
4
|
interface MarkdownSubviewProps extends SubviewProps {
|
|
@@ -6,6 +6,6 @@ interface MarkdownSubviewProps extends SubviewProps {
|
|
|
6
6
|
codeBlockRenderers?: Record<string, CodeBlockRenderer>;
|
|
7
7
|
onLinkActivate?: MarkdownLinkHandler;
|
|
8
8
|
}
|
|
9
|
-
export declare
|
|
9
|
+
export declare const MarkdownSubview: ({ content, codeBlockRenderers, onLinkActivate, decorations, actions, ...screen }: MarkdownSubviewProps) => React.ReactNode;
|
|
10
10
|
export {};
|
|
11
|
-
//# sourceMappingURL=
|
|
11
|
+
//# sourceMappingURL=markdown-subview.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"markdown-subview.d.ts","sourceRoot":"","sources":["../../../src/components/subviews/markdown-subview.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,iBAAiB,EAAa,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAI1F,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAGtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/C,UAAU,oBAAqB,SAAQ,YAAY;IACjD,OAAO,EAAE,eAAe,CAAC;IACzB,kBAAkB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;IACvD,cAAc,CAAC,EAAE,mBAAmB,CAAC;CACtC;AAeD,eAAO,MAAM,eAAe,GAA4B,kFAOrD,oBAAoB,KAAG,KAAK,CAAC,SA2E/B,CAAC"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx } from "@opentui/react/jsx-runtime";
|
|
2
2
|
import { useMemo, useRef } from "react";
|
|
3
|
-
import { MarkdownView, flattenMarkdown, getFlatBlockText
|
|
3
|
+
import { MarkdownView, flattenMarkdown, getFlatBlockText } from "@tooee/renderers";
|
|
4
4
|
import { useCommand } from "@tooee/commands";
|
|
5
5
|
import { useDocumentController } from "@tooee/shell";
|
|
6
|
-
import { useContentCommands } from "../../hooks/
|
|
7
|
-
import { ViewScreen } from "../
|
|
6
|
+
import { useContentCommands } from "../../hooks/use-content-commands.js";
|
|
7
|
+
import { ViewScreen } from "../view-screen.js";
|
|
8
8
|
/** Columns moved per h/l press when scrolling a wide block horizontally. */
|
|
9
9
|
const BLOCK_HSCROLL_STEP = 4;
|
|
10
10
|
/**
|
|
@@ -13,54 +13,56 @@ const BLOCK_HSCROLL_STEP = 4;
|
|
|
13
13
|
* each block's Markdown provenance onto the controller's anchors.
|
|
14
14
|
*/
|
|
15
15
|
const MARKDOWN_BLOCK_ADAPTER = {
|
|
16
|
-
getText: (block) => getFlatBlockText(block),
|
|
17
16
|
getSource: (block) => block.source,
|
|
17
|
+
getText: (block) => getFlatBlockText(block),
|
|
18
18
|
};
|
|
19
|
-
export function MarkdownSubview({ content, codeBlockRenderers, onLinkActivate, decorations, actions, ...screen }) {
|
|
19
|
+
export const MarkdownSubview = function MarkdownSubview({ content, codeBlockRenderers, onLinkActivate, decorations, actions, ...screen }) {
|
|
20
20
|
const textContent = content.markdown;
|
|
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
24
|
const document = useDocumentController({
|
|
25
|
-
rows: blocks,
|
|
26
25
|
adapter: MARKDOWN_BLOCK_ADAPTER,
|
|
27
|
-
multiSelect: true,
|
|
28
|
-
decorations,
|
|
29
26
|
// The controller projects the screen's actions onto menu entries at open time.
|
|
30
27
|
contextMenu: actions,
|
|
28
|
+
decorations,
|
|
29
|
+
multiSelect: true,
|
|
30
|
+
rows: blocks,
|
|
31
31
|
});
|
|
32
32
|
const hScrollableBlocksRef = useRef(new Map());
|
|
33
|
-
const cursorScrollable = () => document.activeIndex
|
|
34
|
-
?
|
|
35
|
-
:
|
|
33
|
+
const cursorScrollable = () => document.activeIndex === null
|
|
34
|
+
? undefined
|
|
35
|
+
: hScrollableBlocksRef.current.get(document.activeIndex);
|
|
36
36
|
useCommand({
|
|
37
|
-
id: "block-scroll-left",
|
|
38
|
-
title: "Scroll block left",
|
|
39
|
-
hotkey: "h",
|
|
40
|
-
modes: ["cursor"],
|
|
41
|
-
when: () => cursorScrollable() != null,
|
|
42
37
|
handler: () => {
|
|
43
38
|
const target = cursorScrollable();
|
|
44
|
-
if (target)
|
|
39
|
+
if (target) {
|
|
45
40
|
target.scrollX -= BLOCK_HSCROLL_STEP;
|
|
41
|
+
}
|
|
46
42
|
},
|
|
43
|
+
hotkey: "h",
|
|
44
|
+
id: "block-scroll-left",
|
|
45
|
+
modes: ["cursor"],
|
|
46
|
+
title: "Scroll block left",
|
|
47
|
+
when: () => cursorScrollable() !== undefined,
|
|
47
48
|
});
|
|
48
49
|
useCommand({
|
|
49
|
-
id: "block-scroll-right",
|
|
50
|
-
title: "Scroll block right",
|
|
51
|
-
hotkey: "l",
|
|
52
|
-
modes: ["cursor"],
|
|
53
|
-
when: () => cursorScrollable() != null,
|
|
54
50
|
handler: () => {
|
|
55
51
|
const target = cursorScrollable();
|
|
56
|
-
if (target)
|
|
52
|
+
if (target) {
|
|
57
53
|
target.scrollX += BLOCK_HSCROLL_STEP;
|
|
54
|
+
}
|
|
58
55
|
},
|
|
56
|
+
hotkey: "l",
|
|
57
|
+
id: "block-scroll-right",
|
|
58
|
+
modes: ["cursor"],
|
|
59
|
+
title: "Scroll block right",
|
|
60
|
+
when: () => cursorScrollable() !== undefined,
|
|
59
61
|
});
|
|
60
62
|
const statusItems = useMemo(() => [
|
|
61
63
|
{ label: "Format:", value: content.format },
|
|
62
64
|
{ label: "Lines:", value: String(lineCount) },
|
|
63
65
|
], [content.format, lineCount]);
|
|
64
66
|
return (_jsx(ViewScreen, { content: content, controller: document, actions: actions, statusItems: statusItems, ...screen, children: _jsx(MarkdownView, { content: content.markdown, blocks: blocks, showLineNumbers: showLineNumbers, document: document, hScrollableBlocksRef: hScrollableBlocksRef, codeBlockRenderers: codeBlockRenderers, onLinkActivate: onLinkActivate }) }));
|
|
65
|
-
}
|
|
66
|
-
//# sourceMappingURL=
|
|
67
|
+
};
|
|
68
|
+
//# sourceMappingURL=markdown-subview.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"markdown-subview.js","sourceRoot":"","sources":["../../../src/components/subviews/markdown-subview.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAExC,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEnF,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAGrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AACzE,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAS/C,4EAA4E;AAC5E,MAAM,kBAAkB,GAAG,CAAC,CAAC;AAE7B;;;;GAIG;AACH,MAAM,sBAAsB,GAAkC;IAC5D,SAAS,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM;IAClC,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,gBAAgB,CAAC,KAAK,CAAC;CAC5C,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,GAAG,SAAS,eAAe,CAAC,EACtD,OAAO,EACP,kBAAkB,EAClB,cAAc,EACd,WAAW,EACX,OAAO,EACP,GAAG,MAAM,EACY;IACrB,MAAM,WAAW,GAAG,OAAO,CAAC,QAAQ,CAAC;IACrC,MAAM,SAAS,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC;IAC/E,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,eAAe,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC;IAEpF,MAAM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G,EAAE,CAAC,gBAAgB,EAAE,KAAK,SAAS;KAC7C,CAAC,CAAC;IAEH,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,SAAS,CAAC,EAAE;KAC9C,EACD,CAAC,OAAO,CAAC,MAAM,EAAE,SAAS,CAAC,CAC5B,CAAC;IAEF,OAAO,CACL,KAAC,UAAU,IACT,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,QAAQ,EACpB,OAAO,EAAE,OAAO,EAChB,WAAW,EAAE,WAAW,KACpB,MAAM,YAEV,KAAC,YAAY,IACX,OAAO,EAAE,OAAO,CAAC,QAAQ,EACzB,MAAM,EAAE,MAAM,EACd,eAAe,EAAE,eAAe,EAChC,QAAQ,EAAE,QAAQ,EAClB,oBAAoB,EAAE,oBAAoB,EAC1C,kBAAkB,EAAE,kBAAkB,EACtC,cAAc,EAAE,cAAc,GAC9B,GACS,CACd,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { TableContent } from "../../types.js";
|
|
2
|
+
import type { SubviewProps } from "./types.js";
|
|
3
|
+
interface TableSubviewProps extends SubviewProps {
|
|
4
|
+
content: TableContent;
|
|
5
|
+
}
|
|
6
|
+
export declare const TableSubview: ({ content, decorations, actions, ...screen }: TableSubviewProps) => React.ReactNode;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=table-subview.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table-subview.d.ts","sourceRoot":"","sources":["../../../src/components/subviews/table-subview.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAGnD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/C,UAAU,iBAAkB,SAAQ,YAAY;IAC9C,OAAO,EAAE,YAAY,CAAC;CACvB;AAoCD,eAAO,MAAM,YAAY,GAAyB,8CAK/C,iBAAiB,KAAG,KAAK,CAAC,SAyC5B,CAAC"}
|
|
@@ -3,9 +3,41 @@ import { useMemo } from "react";
|
|
|
3
3
|
import { Table } from "@tooee/renderers";
|
|
4
4
|
import { useDocumentController } from "@tooee/shell";
|
|
5
5
|
import { getTextContent } from "../../types.js";
|
|
6
|
-
import { useContentCommands } from "../../hooks/
|
|
7
|
-
import { ViewScreen } from "../
|
|
8
|
-
|
|
6
|
+
import { useContentCommands } from "../../hooks/use-content-commands.js";
|
|
7
|
+
import { ViewScreen } from "../view-screen.js";
|
|
8
|
+
const stringifyRowCell = function stringifyRowCell(value) {
|
|
9
|
+
if (value === null || value === undefined) {
|
|
10
|
+
return "";
|
|
11
|
+
}
|
|
12
|
+
if (typeof value === "string") {
|
|
13
|
+
return value;
|
|
14
|
+
}
|
|
15
|
+
if (typeof value === "number" || typeof value === "boolean") {
|
|
16
|
+
return String(value);
|
|
17
|
+
}
|
|
18
|
+
if (typeof value === "string") {
|
|
19
|
+
return value;
|
|
20
|
+
}
|
|
21
|
+
if (typeof value === "number" ||
|
|
22
|
+
typeof value === "bigint" ||
|
|
23
|
+
typeof value === "boolean" ||
|
|
24
|
+
typeof value === "symbol") {
|
|
25
|
+
return value.toString();
|
|
26
|
+
}
|
|
27
|
+
if (value === null || value === undefined) {
|
|
28
|
+
return String(value);
|
|
29
|
+
}
|
|
30
|
+
if (typeof value === "function") {
|
|
31
|
+
return Function.prototype.toString.call(value);
|
|
32
|
+
}
|
|
33
|
+
try {
|
|
34
|
+
return JSON.stringify(value);
|
|
35
|
+
}
|
|
36
|
+
catch {
|
|
37
|
+
return Array.isArray(value) ? value.join(",") : Object.prototype.toString.call(value);
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
export const TableSubview = function TableSubview({ content, decorations, actions, ...screen }) {
|
|
9
41
|
const textContent = useMemo(() => getTextContent(content), [content]);
|
|
10
42
|
const { showLineNumbers } = useContentCommands({ content, textContent });
|
|
11
43
|
const { columns, rows } = content;
|
|
@@ -13,12 +45,12 @@ export function TableSubview({ content, decorations, actions, ...screen }) {
|
|
|
13
45
|
getText: (row) => columns.map((column) => stringifyRowCell(row[column.key])).join("\t"),
|
|
14
46
|
}), [columns]);
|
|
15
47
|
const document = useDocumentController({
|
|
16
|
-
rows,
|
|
17
48
|
adapter,
|
|
18
|
-
multiSelect: true,
|
|
19
|
-
decorations,
|
|
20
49
|
// The controller projects the screen's actions onto menu entries at open time.
|
|
21
50
|
contextMenu: actions,
|
|
51
|
+
decorations,
|
|
52
|
+
multiSelect: true,
|
|
53
|
+
rows,
|
|
22
54
|
});
|
|
23
55
|
const statusItems = useMemo(() => [
|
|
24
56
|
{ label: "Format:", value: content.format },
|
|
@@ -26,19 +58,5 @@ export function TableSubview({ content, decorations, actions, ...screen }) {
|
|
|
26
58
|
{ label: "Cols:", value: String(columns.length) },
|
|
27
59
|
], [content.format, rows.length, columns.length]);
|
|
28
60
|
return (_jsx(ViewScreen, { content: content, controller: document, actions: actions, statusItems: statusItems, ...screen, children: _jsx(Table, { columns: columns, rows: rows, showLineNumbers: showLineNumbers, document: document }) }));
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
if (value == null)
|
|
32
|
-
return "";
|
|
33
|
-
if (typeof value === "string")
|
|
34
|
-
return value;
|
|
35
|
-
if (typeof value === "number" || typeof value === "boolean")
|
|
36
|
-
return String(value);
|
|
37
|
-
try {
|
|
38
|
-
return JSON.stringify(value);
|
|
39
|
-
}
|
|
40
|
-
catch {
|
|
41
|
-
return String(value);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
//# sourceMappingURL=TableSubview.js.map
|
|
61
|
+
};
|
|
62
|
+
//# sourceMappingURL=table-subview.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table-subview.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AAG,EAAE,CAAC;QACJ,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,CAAC,MAAM,EAAE;QAC3C,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE;QAC9C,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;KAClD,EACD,CAAC,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,CAC9C,CAAC;IAEF,OAAO,CACL,KAAC,UAAU,IACT,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,QAAQ,EACpB,OAAO,EAAE,OAAO,EAChB,WAAW,EAAE,WAAW,KACpB,MAAM,YAEV,KAAC,KAAK,IAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,eAAe,EAAE,eAAe,EAAE,QAAQ,EAAE,QAAQ,GAAI,GAClF,CACd,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/subviews/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/subviews/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEjD,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,UAAU,CAAC;IACpB;;;OAGG;IACH,WAAW,EAAE,eAAe,EAAE,CAAC;IAC/B,aAAa,EAAE,OAAO,EAAE,CAAC;IACzB,SAAS,EAAE,OAAO,EAAE,CAAC;IACrB,UAAU,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,IAAI,CAAC;IACnC,kBAAkB,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IAChD,iBAAiB,EAAE,MAAM,IAAI,CAAC;IAC9B,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,SAAS,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,gBAAgB,EAAE,CAAC;CAC9B"}
|
|
@@ -2,7 +2,7 @@ import type { ReactNode } from "react";
|
|
|
2
2
|
import type { ActionDefinition } from "@tooee/commands";
|
|
3
3
|
import type { StatusBarItem } from "@tooee/layout";
|
|
4
4
|
import type { MarkSet } from "@tooee/marks";
|
|
5
|
-
import {
|
|
5
|
+
import type { DocumentController } from "@tooee/shell";
|
|
6
6
|
import type { AnyContent } from "../types.js";
|
|
7
7
|
export interface ViewScreenProps<T> {
|
|
8
8
|
content: AnyContent;
|
|
@@ -24,5 +24,5 @@ export interface ViewScreenProps<T> {
|
|
|
24
24
|
* (theme/quit commands, actions, `ctx.document`, layout, standard status) plus
|
|
25
25
|
* the content-only `ctx.view` slice that viewers contribute on top.
|
|
26
26
|
*/
|
|
27
|
-
export declare
|
|
28
|
-
//# sourceMappingURL=
|
|
27
|
+
export declare const ViewScreen: <T>({ content, controller, streaming, actions, statusItems, reload, providerMarks, userMarks, setMarkSet, clearMarkNamespace, clearAllUserMarks, children, }: ViewScreenProps<T>) => ReactNode;
|
|
28
|
+
//# sourceMappingURL=view-screen.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"view-screen.d.ts","sourceRoot":"","sources":["../../src/components/view-screen.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAE5C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAEvD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C,MAAM,WAAW,eAAe,CAAC,CAAC;IAChC,OAAO,EAAE,UAAU,CAAC;IACpB,UAAU,EAAE,kBAAkB,CAAC,CAAC,CAAC,CAAC;IAClC,SAAS,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,gBAAgB,EAAE,CAAC;IAC7B,6EAA6E;IAC7E,WAAW,CAAC,EAAE,aAAa,EAAE,CAAC;IAC9B,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,aAAa,EAAE,OAAO,EAAE,CAAC;IACzB,SAAS,EAAE,OAAO,EAAE,CAAC;IACrB,UAAU,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,IAAI,CAAC;IACnC,kBAAkB,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IAChD,iBAAiB,EAAE,MAAM,IAAI,CAAC;IAC9B,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED;;;;GAIG;AACH,eAAO,MAAM,UAAU,GAAuB,CAAC,EAAE,0JAa9C,eAAe,CAAC,CAAC,CAAC,KAAG,SAiCvB,CAAC"}
|
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
import { jsx as _jsx } from "@opentui/react/jsx-runtime";
|
|
2
2
|
import { DocumentScreen } from "@tooee/shell";
|
|
3
|
-
import { useProvideViewCommandContext } from "../hooks/
|
|
3
|
+
import { useProvideViewCommandContext } from "../hooks/use-view-command-context.js";
|
|
4
4
|
/**
|
|
5
5
|
* The chrome every subview shares: `DocumentScreen` for the row-document half
|
|
6
6
|
* (theme/quit commands, actions, `ctx.document`, layout, standard status) plus
|
|
7
7
|
* the content-only `ctx.view` slice that viewers contribute on top.
|
|
8
8
|
*/
|
|
9
|
-
export function ViewScreen({ content, controller, streaming, actions, statusItems, reload, providerMarks, userMarks, setMarkSet, clearMarkNamespace, clearAllUserMarks, children, }) {
|
|
9
|
+
export const ViewScreen = function ViewScreen({ content, controller, streaming, actions, statusItems, reload, providerMarks, userMarks, setMarkSet, clearMarkNamespace, clearAllUserMarks, children, }) {
|
|
10
10
|
useProvideViewCommandContext({
|
|
11
11
|
content,
|
|
12
|
-
reload,
|
|
13
12
|
marks: {
|
|
14
|
-
setMarkSet,
|
|
15
|
-
clearNamespace: clearMarkNamespace,
|
|
16
13
|
clearAll: clearAllUserMarks,
|
|
17
|
-
|
|
14
|
+
clearNamespace: clearMarkNamespace,
|
|
18
15
|
providerMarks,
|
|
16
|
+
setMarkSet,
|
|
17
|
+
userMarks,
|
|
19
18
|
},
|
|
19
|
+
reload,
|
|
20
20
|
});
|
|
21
21
|
const items = [
|
|
22
22
|
...(statusItems ?? []),
|
|
23
23
|
...(streaming ? [{ label: "Status:", value: "streaming" }] : []),
|
|
24
24
|
];
|
|
25
|
-
return (_jsx(DocumentScreen, { controller: controller, titleBar: content.title
|
|
26
|
-
? {
|
|
27
|
-
: { title: content.format }, statusItems: items, actions: actions, context: { kind: content.format, title: content.title
|
|
28
|
-
}
|
|
29
|
-
//# sourceMappingURL=
|
|
25
|
+
return (_jsx(DocumentScreen, { controller: controller, titleBar: content.title !== undefined && content.title !== ""
|
|
26
|
+
? { subtitle: content.format, title: content.title }
|
|
27
|
+
: { title: content.format }, statusItems: items, actions: actions, context: { kind: content.format, reload, title: content.title }, children: children }));
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=view-screen.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"view-screen.js","sourceRoot":"","sources":["../../src/components/view-screen.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9C,OAAO,EAAE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string | undefined;
|
|
12
12
|
}
|
|
13
|
-
|
|
13
|
+
interface ContentLoaderEventPayloads {
|
|
14
14
|
loadStarted: {
|
|
15
15
|
marks: MarkSet[];
|
|
16
16
|
title?: string;
|
|
@@ -37,17 +37,21 @@ export type ContentLoaderEvents = {
|
|
|
37
37
|
loadCancelled: {
|
|
38
38
|
requestId: number;
|
|
39
39
|
};
|
|
40
|
-
reloadRequested:
|
|
40
|
+
reloadRequested: Record<PropertyKey, never>;
|
|
41
|
+
}
|
|
42
|
+
export type ContentLoaderEvents = {
|
|
43
|
+
[Event in keyof ContentLoaderEventPayloads]: ContentLoaderEventPayloads[Event];
|
|
41
44
|
};
|
|
42
|
-
export declare
|
|
43
|
-
export declare
|
|
44
|
-
export declare
|
|
45
|
-
export declare
|
|
46
|
-
export declare
|
|
45
|
+
export declare const isAsyncIterable: (value: unknown) => value is AsyncIterable<ContentChunk>;
|
|
46
|
+
export declare const createEmptyContent: (format: string, title?: string) => AnyContent;
|
|
47
|
+
export declare const applyContentChunk: (current: AnyContent | null, chunk: ContentChunk, title?: string) => AnyContent;
|
|
48
|
+
export declare const normalizeError: (error: unknown) => string;
|
|
49
|
+
export declare const createContentLoaderStore: () => import("@xstate/store").Store<ContentLoaderContext, ContentLoaderEvents, never>;
|
|
47
50
|
export declare const selectContent: (ctx: ContentLoaderContext) => AnyContent | null;
|
|
48
51
|
export declare const selectStatus: (ctx: ContentLoaderContext) => ContentLoaderStatus;
|
|
49
52
|
export declare const selectStreaming: (ctx: ContentLoaderContext) => boolean;
|
|
50
53
|
export declare const selectError: (ctx: ContentLoaderContext) => string | null;
|
|
51
54
|
export declare const selectProviderMarks: (ctx: ContentLoaderContext) => MarkSet[];
|
|
52
55
|
export declare const selectLoadSeq: (ctx: ContentLoaderContext) => number;
|
|
56
|
+
export {};
|
|
53
57
|
//# sourceMappingURL=content-loader-store.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"content-loader-store.d.ts","sourceRoot":"","sources":["../src/content-loader-store.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,
|
|
1
|
+
{"version":3,"file":"content-loader-store.d.ts","sourceRoot":"","sources":["../src/content-loader-store.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,EAAE,UAAU,EAAW,YAAY,EAAiB,MAAM,YAAY,CAAC;AAEnF,MAAM,MAAM,mBAAmB,GAAG,MAAM,GAAG,SAAS,GAAG,WAAW,GAAG,OAAO,GAAG,OAAO,CAAC;AAEvF,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,mBAAmB,CAAC;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,UAAU,GAAG,IAAI,CAAC;IAC3B,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,aAAa,EAAE,OAAO,EAAE,CAAC;IACzB,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;CAC3B;AAED,UAAU,0BAA0B;IAClC,WAAW,EAAE;QAAE,KAAK,EAAE,OAAO,EAAE,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAClD,aAAa,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IACrD,aAAa,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,YAAY,CAAA;KAAE,CAAC;IAC1D,MAAM,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,UAAU,CAAA;KAAE,CAAC;IACnD,WAAW,EAAE;QAAE,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC;IACnC,UAAU,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IACjD,aAAa,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