@echothink-ui/documents 0.1.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 +5 -0
- package/dist/components/AgentLockedDocumentPanel.d.ts +10 -0
- package/dist/components/DocumentEditorShell.d.ts +14 -0
- package/dist/components/DocumentLockBadge.d.ts +7 -0
- package/dist/components/DocumentOutline.d.ts +7 -0
- package/dist/components/DocumentToolbar.d.ts +10 -0
- package/dist/components/DocumentViewer.d.ts +10 -0
- package/dist/components/DocumentWorkspaceTemplate.d.ts +24 -0
- package/dist/components/types.d.ts +46 -0
- package/dist/components/utils.d.ts +9 -0
- package/dist/index.cjs +715 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.css +819 -0
- package/dist/index.css.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +683 -0
- package/dist/index.js.map +1 -0
- package/package.json +43 -0
- package/src/components/AgentLockedDocumentPanel.tsx +119 -0
- package/src/components/DocumentEditorShell.tsx +116 -0
- package/src/components/DocumentLockBadge.tsx +93 -0
- package/src/components/DocumentOutline.tsx +118 -0
- package/src/components/DocumentToolbar.tsx +179 -0
- package/src/components/DocumentViewer.tsx +81 -0
- package/src/components/DocumentWorkspaceTemplate.tsx +109 -0
- package/src/components/types.ts +63 -0
- package/src/components/utils.tsx +88 -0
- package/src/index.tsx +39 -0
- package/src/styles.css +962 -0
package/README.md
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
# @echothink-ui/documents
|
|
2
|
+
|
|
3
|
+
Documents package for EchoThink app-domain websites.
|
|
4
|
+
|
|
5
|
+
This package is part of the EchoThink-UI app-domain library. It is designed for normal website app domains rendered inside EchoThink Studio's Chromium shell, not for implementing the studio browser chrome itself.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { DocumentComponentBaseProps, DocumentOwner, DocumentPendingChange, DocumentReference } from "./types";
|
|
2
|
+
export interface AgentLockedDocumentPanelProps extends Omit<DocumentComponentBaseProps<HTMLElement>, "children" | "title"> {
|
|
3
|
+
documentRef: DocumentReference;
|
|
4
|
+
lockOwner?: DocumentOwner;
|
|
5
|
+
pendingChanges?: DocumentPendingChange[];
|
|
6
|
+
onTakeover?: () => void;
|
|
7
|
+
onRelease?: () => void;
|
|
8
|
+
onReviewChanges?: () => void;
|
|
9
|
+
}
|
|
10
|
+
export declare function AgentLockedDocumentPanel({ documentRef, lockOwner, pendingChanges, onTakeover, onRelease, onReviewChanges, density, className, ...props }: AgentLockedDocumentPanelProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { DocumentComponentBaseProps, DocumentLockState, DocumentMode, DocumentOwner, DocumentReference } from "./types";
|
|
3
|
+
export interface DocumentEditorShellProps extends Omit<DocumentComponentBaseProps<HTMLElement>, "children"> {
|
|
4
|
+
title: React.ReactNode;
|
|
5
|
+
documentRef: DocumentReference;
|
|
6
|
+
mode?: DocumentMode;
|
|
7
|
+
lockState?: DocumentLockState;
|
|
8
|
+
lockOwner?: DocumentOwner;
|
|
9
|
+
toolbar?: React.ReactNode;
|
|
10
|
+
outline?: React.ReactNode;
|
|
11
|
+
inspector?: React.ReactNode;
|
|
12
|
+
children: React.ReactNode;
|
|
13
|
+
}
|
|
14
|
+
export declare function DocumentEditorShell({ title, documentRef, mode, lockState, lockOwner, toolbar, outline, inspector, children, density, className, ...props }: DocumentEditorShellProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { DocumentComponentBaseProps, DocumentLockState, DocumentOwner } from "./types";
|
|
2
|
+
export interface DocumentLockBadgeProps extends Omit<DocumentComponentBaseProps<HTMLSpanElement>, "title"> {
|
|
3
|
+
lockState: DocumentLockState;
|
|
4
|
+
owner?: DocumentOwner;
|
|
5
|
+
since?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare function DocumentLockBadge({ lockState, owner, since, density, className, ...props }: DocumentLockBadgeProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { DocumentComponentBaseProps, DocumentHeading } from "./types";
|
|
2
|
+
export interface DocumentOutlineProps extends Omit<DocumentComponentBaseProps<HTMLElement>, "children" | "title"> {
|
|
3
|
+
headings: DocumentHeading[];
|
|
4
|
+
activeHeadingId?: string;
|
|
5
|
+
onSelect?: (id: string) => void;
|
|
6
|
+
}
|
|
7
|
+
export declare function DocumentOutline({ headings, activeHeadingId, onSelect, className, "aria-label": ariaLabel, ...props }: DocumentOutlineProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type EthAction, type EthDensity } from "@echothink-ui/core";
|
|
2
|
+
import type { DocumentComponentBaseProps, DocumentMode } from "./types";
|
|
3
|
+
export interface DocumentToolbarProps extends Omit<DocumentComponentBaseProps<HTMLDivElement>, "children" | "title"> {
|
|
4
|
+
actions: EthAction[];
|
|
5
|
+
formattingActions?: EthAction[];
|
|
6
|
+
mode?: DocumentMode;
|
|
7
|
+
onModeChange?: (mode: DocumentMode) => void;
|
|
8
|
+
density?: EthDensity;
|
|
9
|
+
}
|
|
10
|
+
export declare function DocumentToolbar({ actions, formattingActions, mode, onModeChange, density, className, ...props }: DocumentToolbarProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { DocumentAnnotation, DocumentComponentBaseProps, DocumentMetadataItem } from "./types";
|
|
3
|
+
export interface DocumentViewerProps extends Omit<DocumentComponentBaseProps<HTMLElement>, "children"> {
|
|
4
|
+
title: React.ReactNode;
|
|
5
|
+
content: React.ReactNode;
|
|
6
|
+
metadata?: DocumentMetadataItem[];
|
|
7
|
+
versionRef?: React.ReactNode;
|
|
8
|
+
annotations?: DocumentAnnotation[];
|
|
9
|
+
}
|
|
10
|
+
export declare function DocumentViewer({ title, content, metadata, versionRef, annotations, className, ...props }: DocumentViewerProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { type EthAction } from "@echothink-ui/core";
|
|
3
|
+
import type { DocumentAnnotation, DocumentComponentBaseProps, DocumentHeading, DocumentLockState, DocumentMetadataItem, DocumentMode, DocumentOwner, DocumentReference } from "./types";
|
|
4
|
+
export interface DocumentWorkspaceTemplateProps extends Omit<DocumentComponentBaseProps<HTMLElement>, "children"> {
|
|
5
|
+
title: React.ReactNode;
|
|
6
|
+
documentRef: DocumentReference;
|
|
7
|
+
mode?: DocumentMode;
|
|
8
|
+
lockState?: DocumentLockState;
|
|
9
|
+
lockOwner?: DocumentOwner;
|
|
10
|
+
actions?: EthAction[];
|
|
11
|
+
formattingActions?: EthAction[];
|
|
12
|
+
onModeChange?: (mode: DocumentMode) => void;
|
|
13
|
+
headings?: DocumentHeading[];
|
|
14
|
+
activeHeadingId?: string;
|
|
15
|
+
onSelectHeading?: (id: string) => void;
|
|
16
|
+
inspector?: React.ReactNode;
|
|
17
|
+
toolbar?: React.ReactNode;
|
|
18
|
+
metadata?: DocumentMetadataItem[];
|
|
19
|
+
versionRef?: React.ReactNode;
|
|
20
|
+
annotations?: DocumentAnnotation[];
|
|
21
|
+
content?: React.ReactNode;
|
|
22
|
+
children?: React.ReactNode;
|
|
23
|
+
}
|
|
24
|
+
export declare function DocumentWorkspaceTemplate({ title, documentRef, mode, lockState, lockOwner, actions, formattingActions, onModeChange, headings, activeHeadingId, onSelectHeading, inspector, toolbar, metadata, versionRef, annotations, content, children, density, ...props }: DocumentWorkspaceTemplateProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type * as React from "react";
|
|
2
|
+
import type { EthAction, EthDensity } from "@echothink-ui/core";
|
|
3
|
+
export type DocumentMode = "edit" | "review" | "view";
|
|
4
|
+
export type DocumentLockState = "unlocked" | "locked-by-user" | "locked-by-agent" | "locked-by-other";
|
|
5
|
+
export interface DocumentOwner {
|
|
6
|
+
id: string;
|
|
7
|
+
label: string;
|
|
8
|
+
}
|
|
9
|
+
export type DocumentReference = string | {
|
|
10
|
+
id: string;
|
|
11
|
+
label?: React.ReactNode;
|
|
12
|
+
href?: string;
|
|
13
|
+
kind?: string;
|
|
14
|
+
version?: string;
|
|
15
|
+
};
|
|
16
|
+
export interface DocumentMetadataItem {
|
|
17
|
+
label: React.ReactNode;
|
|
18
|
+
value: React.ReactNode;
|
|
19
|
+
}
|
|
20
|
+
export interface DocumentHeading {
|
|
21
|
+
id: string;
|
|
22
|
+
level: 1 | 2 | 3 | 4;
|
|
23
|
+
text: React.ReactNode;
|
|
24
|
+
href?: string;
|
|
25
|
+
}
|
|
26
|
+
export interface DocumentAnnotation {
|
|
27
|
+
id: string;
|
|
28
|
+
range?: string;
|
|
29
|
+
comment: React.ReactNode;
|
|
30
|
+
author: React.ReactNode;
|
|
31
|
+
createdAt: string;
|
|
32
|
+
}
|
|
33
|
+
export interface DocumentPendingChange {
|
|
34
|
+
id: string;
|
|
35
|
+
summary: React.ReactNode;
|
|
36
|
+
diffSnippet?: React.ReactNode;
|
|
37
|
+
}
|
|
38
|
+
export interface DocumentComponentBaseProps<T extends HTMLElement = HTMLElement> extends Omit<React.HTMLAttributes<T>, "title" | "content" | "onSelect"> {
|
|
39
|
+
title?: React.ReactNode;
|
|
40
|
+
density?: EthDensity;
|
|
41
|
+
"data-eth-component"?: string;
|
|
42
|
+
}
|
|
43
|
+
export interface DocumentToolbarActionGroup {
|
|
44
|
+
actions: EthAction[];
|
|
45
|
+
formattingActions?: EthAction[];
|
|
46
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { EthAction } from "@echothink-ui/core";
|
|
3
|
+
import type { DocumentMode, DocumentReference } from "./types";
|
|
4
|
+
export declare function cx(...classes: Array<string | false | null | undefined>): string;
|
|
5
|
+
export declare function documentRefLabel(documentRef: DocumentReference): string | number | bigint | true | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined>;
|
|
6
|
+
export declare function documentRefId(documentRef: DocumentReference): string;
|
|
7
|
+
export declare function formatDateTime(value?: string): string;
|
|
8
|
+
export declare function modeLabel(mode: DocumentMode): string;
|
|
9
|
+
export declare function actionIcon(action: EthAction): import("react/jsx-runtime").JSX.Element;
|