@xiongtao.xt/tau-plugins 0.0.0-stage → 0.2.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/LICENSE +21 -0
- package/README.md +4 -2
- package/package.json +31 -3
- package/runtime.js +1 -0
- package/types/packages/editor/api.d.ts +10 -0
- package/types/packages/editor/contracts.d.ts +3 -0
- package/types/packages/editor/src/api/command.d.ts +61 -0
- package/types/packages/editor/src/api/copy.d.ts +23 -0
- package/types/packages/editor/src/api/drag.d.ts +24 -0
- package/types/packages/editor/src/api/extension.d.ts +100 -0
- package/types/packages/editor/src/api/index.d.ts +54 -0
- package/types/packages/editor/src/api/ingest.d.ts +39 -0
- package/types/packages/editor/src/api/legacy.d.ts +10 -0
- package/types/packages/editor/src/api/marks.d.ts +35 -0
- package/types/packages/editor/src/api/menu.d.ts +37 -0
- package/types/packages/editor/src/api/submission.d.ts +38 -0
- package/types/packages/editor/src/api/toolbar.d.ts +3 -0
- package/types/packages/editor/src/components/AddParagraph/index.d.ts +11 -0
- package/types/packages/editor/src/components/BlockDrag/index.d.ts +35 -0
- package/types/packages/editor/src/components/ElementMenu/index.d.ts +11 -0
- package/types/packages/editor/src/components/FloatingToolbar/index.d.ts +23 -0
- package/types/packages/editor/src/components/HoveringToolbar/FloatingSubmenu.d.ts +19 -0
- package/types/packages/editor/src/components/HoveringToolbar/context.d.ts +8 -0
- package/types/packages/editor/src/components/HoveringToolbar/floatingPosition.d.ts +22 -0
- package/types/packages/editor/src/components/InlineChromiumBugFix/index.d.ts +2 -0
- package/types/packages/editor/src/components/OverlayBackDismiss/index.d.ts +4 -0
- package/types/packages/editor/src/hooks/useIsLastElement.d.ts +3 -0
- package/types/packages/editor/src/kit/elementEmpty.d.ts +5 -0
- package/types/packages/editor/src/menu/conversion.d.ts +3 -0
- package/types/packages/editor/src/model/paragraph.d.ts +5 -0
- package/types/packages/editor/src/services/editorNotifier.d.ts +4 -0
- package/types/packages/editor/src/services/errorReporter.d.ts +13 -0
- package/types/packages/editor/src/services/hooks.d.ts +11 -0
- package/types/packages/editor/src/services/notifier.d.ts +46 -0
- package/types/packages/editor/src/services/overlayBackDismiss.d.ts +10 -0
- package/types/packages/editor/src/services/registry.d.ts +6 -0
- package/types/packages/editor/src/services/tokens.d.ts +10 -0
- package/types/packages/editor/src/theme/ThemeService.d.ts +24 -0
- package/types/packages/editor/src/theme/context.d.ts +26 -0
- package/types/packages/editor/src/types/block-panel.d.ts +12 -0
- package/types/packages/editor/src/types/custom-element.d.ts +10 -0
- package/types/packages/editor/src/types/editor.d.ts +37 -0
- package/types/packages/editor/src/types/element/paragraph.d.ts +6 -0
- package/types/packages/editor/src/types/hotkeys.d.ts +6 -0
- package/types/packages/editor/src/types/hovering-bar.d.ts +8 -0
- package/types/packages/editor/src/types/index.d.ts +7 -0
- package/types/packages/editor/src/types/text.d.ts +1 -0
- package/types/packages/editor/src/types.d.ts +1 -0
- package/types/packages/editor/src/ui/CaretRight.d.ts +3 -0
- package/types/packages/editor/src/ui/Tooltip.d.ts +7 -0
- package/types/packages/editor/src/utils/blockNavigation.d.ts +28 -0
- package/types/packages/editor/src/utils/commandTarget.d.ts +4 -0
- package/types/packages/editor/src/utils/container.d.ts +3 -0
- package/types/packages/editor/src/utils/editor.d.ts +16 -0
- package/types/packages/editor/src/utils/element.d.ts +11 -0
- package/types/packages/editor/src/utils/insertElement.d.ts +11 -0
- package/types/packages/editor/src/utils/nodeOperations.d.ts +19 -0
- package/types/packages/editor/src/utils/paragraphShortcut.d.ts +4 -0
- package/types/packages/editor/src/utils/path.d.ts +6 -0
- package/types/packages/editor/src/utils/plugin.d.ts +4 -0
- package/types/packages/editor/src/utils/selectionSnapshot.d.ts +3 -0
- package/types/packages/editor/src/utils/zoomPan.d.ts +14 -0
- package/types/packages/markdown/src/codec.d.ts +86 -0
- package/types/packages/markdown/src/index.d.ts +7 -0
- package/types/packages/markdown/src/markdown-helper.d.ts +28 -0
- package/types/packages/markdown/src/markdown.d.ts +35 -0
- package/types/packages/markdown/src/markdownSerializerRegistry.d.ts +47 -0
- package/types/packages/markdown/src/model.d.ts +7 -0
- package/types/packages/markdown/src/positionMapper.d.ts +161 -0
- package/types/packages/markdown/src/processor.d.ts +27 -0
- package/types/packages/markdown/src/textCodec.d.ts +39 -0
- package/types/packages/markdown/src/types.d.ts +8 -0
- package/types/packages/plugins/src/contract.d.ts +49 -0
- package/types/packages/plugins/src/editor.d.ts +37 -0
- package/types/packages/plugins/src/index.d.ts +7 -0
- package/types/packages/plugins/src/pages.d.ts +23 -0
- package/types/packages/plugins/src/settings.d.ts +19 -0
- package/types/packages/plugins/src/sidebar.d.ts +29 -0
- package/types/packages/shared/service-contract.d.ts +6 -0
- package/types/packages/shared/service-registry.d.ts +25 -0
- package/types/packages/themes/src/bootstrap.d.ts +26 -0
- package/types/packages/themes/src/defineTheme.d.ts +45 -0
- package/types/packages/themes/src/index.d.ts +10 -0
- package/types/packages/themes/src/register.d.ts +9 -0
- package/types/packages/themes/src/themes/ink.theme.d.ts +11 -0
- package/types/packages/themes/src/themes/mint.theme.d.ts +11 -0
- package/types/packages/themes/src/themes/ocean.theme.d.ts +12 -0
- package/types/packages/themes/src/themes/paper.theme.d.ts +16 -0
- package/types/packages/themes/src/themes/sakura.theme.d.ts +11 -0
- package/types/packages/themes/src/themes/wisteria.theme.d.ts +10 -0
- package/types/packages/themes/src/tokenContract.d.ts +30 -0
- package/types/packages/ui/src/UiProvider.d.ts +17 -0
- package/types/packages/ui/src/cn.d.ts +23 -0
- package/types/packages/ui/src/hooks/fadeScrollClass.d.ts +8 -0
- package/types/packages/ui/src/hooks/index.d.ts +3 -0
- package/types/packages/ui/src/hooks/isEditableTarget.d.ts +2 -0
- package/types/packages/ui/src/hooks/lockBodyScroll.d.ts +1 -0
- package/types/packages/ui/src/hooks/scrollbarAutoHide.d.ts +9 -0
- package/types/packages/ui/src/hooks/useEdgeFade.d.ts +22 -0
- package/types/packages/ui/src/index.d.ts +47 -0
- package/types/packages/ui/src/patterns/FormRow.d.ts +20 -0
- package/types/packages/ui/src/primitives/AnchoredPanel.d.ts +53 -0
- package/types/packages/ui/src/primitives/Button.d.ts +31 -0
- package/types/packages/ui/src/primitives/Checkbox.d.ts +24 -0
- package/types/packages/ui/src/primitives/ConfirmDialog.d.ts +44 -0
- package/types/packages/ui/src/primitives/Dialog.d.ts +82 -0
- package/types/packages/ui/src/primitives/Drawer.d.ts +87 -0
- package/types/packages/ui/src/primitives/EditText.d.ts +32 -0
- package/types/packages/ui/src/primitives/ErrorBoundary.d.ts +16 -0
- package/types/packages/ui/src/primitives/FadeScroll.d.ts +18 -0
- package/types/packages/ui/src/primitives/FileDropZone.d.ts +14 -0
- package/types/packages/ui/src/primitives/FilterPill.d.ts +19 -0
- package/types/packages/ui/src/primitives/IconButton.d.ts +6 -0
- package/types/packages/ui/src/primitives/If.d.ts +6 -0
- package/types/packages/ui/src/primitives/ImagePreview.d.ts +16 -0
- package/types/packages/ui/src/primitives/Loading.d.ts +18 -0
- package/types/packages/ui/src/primitives/LoadingOverlay.d.ts +7 -0
- package/types/packages/ui/src/primitives/Menu.d.ts +93 -0
- package/types/packages/ui/src/primitives/Notification.d.ts +110 -0
- package/types/packages/ui/src/primitives/Panel.d.ts +28 -0
- package/types/packages/ui/src/primitives/Popover.d.ts +58 -0
- package/types/packages/ui/src/primitives/PortalToBody.d.ts +7 -0
- package/types/packages/ui/src/primitives/Radio.d.ts +27 -0
- package/types/packages/ui/src/primitives/RadioGroup.d.ts +32 -0
- package/types/packages/ui/src/primitives/ResizableAndHideableSidebar.d.ts +40 -0
- package/types/packages/ui/src/primitives/ResizeHandle.d.ts +23 -0
- package/types/packages/ui/src/primitives/Segmented.d.ts +44 -0
- package/types/packages/ui/src/primitives/Select.d.ts +78 -0
- package/types/packages/ui/src/primitives/Switch.d.ts +23 -0
- package/types/packages/ui/src/primitives/Tabs.d.ts +17 -0
- package/types/packages/ui/src/primitives/Tag.d.ts +24 -0
- package/types/packages/ui/src/primitives/Toast.d.ts +67 -0
- package/types/packages/ui/src/primitives/Tooltip.d.ts +40 -0
- package/types/packages/ui/src/primitives/ValueDisplay.d.ts +25 -0
- package/types/packages/ui/src/primitives/YearHeatmap.d.ts +15 -0
- package/types/packages/ui/src/primitives/anchoredPosition.d.ts +44 -0
- package/types/packages/ui/src/primitives/datepicker/DatePicker.d.ts +71 -0
- package/types/packages/ui/src/primitives/datepicker/DateRangePicker.d.ts +70 -0
- package/types/packages/ui/src/primitives/datepicker/calendarEngine.d.ts +45 -0
- package/types/packages/ui/src/primitives/editTextClasses.d.ts +1 -0
- package/types/packages/ui/src/primitives/input/Input.d.ts +35 -0
- package/types/packages/ui/src/primitives/input/NumberInput.d.ts +25 -0
- package/types/packages/ui/src/primitives/input/Textarea.d.ts +14 -0
- package/types/packages/ui/src/primitives/mergeRefs.d.ts +6 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { Descendant } from "slate";
|
|
2
|
+
import type { MarkdownTextRegistry } from "./textCodec";
|
|
3
|
+
import { PositionMapper } from "./positionMapper";
|
|
4
|
+
import type { CustomDirectiveHandler, MarkdownCodec } from "./codec";
|
|
5
|
+
export interface SlateWithPositions {
|
|
6
|
+
content: Descendant[];
|
|
7
|
+
positionMap: PositionMapper;
|
|
8
|
+
}
|
|
9
|
+
export interface ImportFromMarkdownOptions {
|
|
10
|
+
/** 宿主注册的业务 directive(container / leaf / text 三种都查),优先于内置分支 */
|
|
11
|
+
customDirectives?: Record<string, CustomDirectiveHandler>;
|
|
12
|
+
}
|
|
13
|
+
/** 处理器级配置:宿主 codec 合并后的结果(框架不自带任何元素类型) */
|
|
14
|
+
export interface ImportConfig {
|
|
15
|
+
textRegistry: MarkdownTextRegistry;
|
|
16
|
+
directives: Record<string, CustomDirectiveHandler>;
|
|
17
|
+
voidTypes: ReadonlySet<string>;
|
|
18
|
+
inlineWrapperDirectives: ReadonlySet<string>;
|
|
19
|
+
inlineHtmlWrappers?: ReadonlyMap<string, NonNullable<MarkdownCodec["inlineHtmlWrapper"]>>;
|
|
20
|
+
fenceByLanguage: ReadonlyMap<string, {
|
|
21
|
+
type: string;
|
|
22
|
+
property: string;
|
|
23
|
+
}>;
|
|
24
|
+
importNodes?: readonly NonNullable<MarkdownCodec["importNode"]>[];
|
|
25
|
+
fenceSourceProperties?: ReadonlyMap<string, string>;
|
|
26
|
+
normalizeHooks?: ReadonlyMap<string, NonNullable<MarkdownCodec["normalize"]>>;
|
|
27
|
+
inlineForms?: ReadonlyMap<string, NonNullable<MarkdownCodec["inlineForm"]>>;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Markdown 导入(带位置映射)
|
|
31
|
+
*/
|
|
32
|
+
export declare const importFromMarkdownWithPositionsUsing: (config: ImportConfig, markdown: string, ignoreTypes?: string[], options?: ImportFromMarkdownOptions) => SlateWithPositions;
|
|
33
|
+
export declare const importFromMarkdownUsing: (config: ImportConfig, markdown: string, ignoreTypes?: string[], options?: ImportFromMarkdownOptions) => Descendant[];
|
|
34
|
+
/** 粗判一段纯文本是否像 Markdown(粘贴时决定要不要按 Markdown 导入) */
|
|
35
|
+
export declare const isMarkdownLikeText: (text: string) => boolean;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { CustomElement } from "./types";
|
|
2
|
+
export interface SerializerOutput {
|
|
3
|
+
output: string;
|
|
4
|
+
childrenStart?: {
|
|
5
|
+
line: number;
|
|
6
|
+
ch: number;
|
|
7
|
+
};
|
|
8
|
+
perLineOffset?: number;
|
|
9
|
+
childLineShifts?: Array<{
|
|
10
|
+
startIndex: number;
|
|
11
|
+
lineDelta: number;
|
|
12
|
+
}>;
|
|
13
|
+
skipChildren?: boolean;
|
|
14
|
+
propertyMappings?: {
|
|
15
|
+
[propName: string]: {
|
|
16
|
+
start: {
|
|
17
|
+
line: number;
|
|
18
|
+
ch: number;
|
|
19
|
+
};
|
|
20
|
+
multiline: boolean;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
export interface MarkdownSerializer {
|
|
25
|
+
type: string;
|
|
26
|
+
isBlock?: boolean;
|
|
27
|
+
toMarkdown: (element: any, childrenStr: string, parentElement?: any) => string;
|
|
28
|
+
toMarkdownStructured?: (element: any, childrenStr: string, parentElement?: any) => SerializerOutput;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* 导出端序列化器注册表:元素类型 → Markdown 文本的唯一出处。
|
|
32
|
+
* 框架不自带任何序列化器,全部经 createMarkdownProcessor({ codecs }) 注入(各扩展的 markdown.ts)。
|
|
33
|
+
*/
|
|
34
|
+
export declare class MarkdownSerializerRegistry {
|
|
35
|
+
private serializers;
|
|
36
|
+
private blockTypes;
|
|
37
|
+
private footnoteCounter;
|
|
38
|
+
private footnoteDefinitions;
|
|
39
|
+
constructor(serializers?: MarkdownSerializer[]);
|
|
40
|
+
resetFootnotes(): void;
|
|
41
|
+
addFootnote(content: string): number;
|
|
42
|
+
getFootnoteDefinitions(): string;
|
|
43
|
+
register(serializer: MarkdownSerializer): void;
|
|
44
|
+
registerMany(serializers: MarkdownSerializer[]): void;
|
|
45
|
+
getSerializer(type: string): MarkdownSerializer | undefined;
|
|
46
|
+
isBlock(element: CustomElement): boolean;
|
|
47
|
+
}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Markdown 位置(CodeMirror 格式)
|
|
3
|
+
*/
|
|
4
|
+
export interface MarkdownPosition {
|
|
5
|
+
line: number;
|
|
6
|
+
ch: number;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Slate 位置
|
|
10
|
+
*/
|
|
11
|
+
export interface SlatePosition {
|
|
12
|
+
path: number[];
|
|
13
|
+
offset: number;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* 文本级别的映射条目
|
|
17
|
+
* 用于普通文本节点,支持字符级精确映射
|
|
18
|
+
*/
|
|
19
|
+
export interface TextMapping {
|
|
20
|
+
type: "text";
|
|
21
|
+
slateTextPath: number[];
|
|
22
|
+
slateOffset: number;
|
|
23
|
+
slateLength: number;
|
|
24
|
+
mdLine: number;
|
|
25
|
+
mdCh: number;
|
|
26
|
+
mdLength: number;
|
|
27
|
+
prefixLength: number;
|
|
28
|
+
suffixLength: number;
|
|
29
|
+
sourceOffsets?: readonly number[];
|
|
30
|
+
/** 手工改写的载体无法证明字符对应时,只提供首尾边界。 */
|
|
31
|
+
opaque?: boolean;
|
|
32
|
+
mdEnd?: MarkdownPosition;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* 元素级别的映射条目
|
|
36
|
+
* 用于 void 元素(code-block, image 等)
|
|
37
|
+
*/
|
|
38
|
+
export interface ElementMapping {
|
|
39
|
+
type: "element";
|
|
40
|
+
slateElementPath: number[];
|
|
41
|
+
elementType: string;
|
|
42
|
+
isVoid: true;
|
|
43
|
+
mdStartLine: number;
|
|
44
|
+
mdStartCh: number;
|
|
45
|
+
mdEndLine: number;
|
|
46
|
+
mdEndCh: number;
|
|
47
|
+
propertyMappings?: {
|
|
48
|
+
[propName: string]: {
|
|
49
|
+
mdStartLine: number;
|
|
50
|
+
mdStartCh: number;
|
|
51
|
+
mdEndLine: number;
|
|
52
|
+
mdEndCh: number;
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
export type PositionMapping = TextMapping | ElementMapping;
|
|
57
|
+
/**
|
|
58
|
+
* 位置映射器类(重新设计版本)
|
|
59
|
+
*
|
|
60
|
+
* 核心改进:
|
|
61
|
+
* 1. 文本节点级别映射(而非元素级别)
|
|
62
|
+
* 2. 支持格式标记的偏移处理
|
|
63
|
+
* 3. 双向映射都基于相同的数据结构
|
|
64
|
+
*/
|
|
65
|
+
export declare class PositionMapper {
|
|
66
|
+
private mappings;
|
|
67
|
+
/**
|
|
68
|
+
* 添加文本映射
|
|
69
|
+
*/
|
|
70
|
+
addTextMapping(mapping: TextMapping): void;
|
|
71
|
+
/**
|
|
72
|
+
* 添加元素映射(void 元素)
|
|
73
|
+
*/
|
|
74
|
+
addElementMapping(mapping: ElementMapping): void;
|
|
75
|
+
/**
|
|
76
|
+
* 清空映射表
|
|
77
|
+
*/
|
|
78
|
+
clear(): void;
|
|
79
|
+
/**
|
|
80
|
+
* Slate 位置 → Markdown 位置
|
|
81
|
+
*
|
|
82
|
+
* @param pos Slate position {path: [0, 0], offset: 5}
|
|
83
|
+
* @returns Markdown position {line: 2, ch: 15} 或 null
|
|
84
|
+
*/
|
|
85
|
+
slateToMarkdown(pos: SlatePosition): MarkdownPosition | null;
|
|
86
|
+
/**
|
|
87
|
+
* Markdown 位置 → Slate 位置
|
|
88
|
+
*
|
|
89
|
+
* @param pos Markdown position {line: 2, ch: 15}
|
|
90
|
+
* @returns Slate position {path: [0, 0], offset: 5} 或 null
|
|
91
|
+
*/
|
|
92
|
+
markdownToSlate(pos: MarkdownPosition): SlatePosition | null;
|
|
93
|
+
/**
|
|
94
|
+
* 获取所有映射(调试用)
|
|
95
|
+
*/
|
|
96
|
+
getMappings(): PositionMapping[];
|
|
97
|
+
/**
|
|
98
|
+
* 根据 Slate 元素路径查找元素映射
|
|
99
|
+
*/
|
|
100
|
+
getElementMappingBySlatePath(path: number[]): ElementMapping | null;
|
|
101
|
+
/**
|
|
102
|
+
* 根据 Markdown 位置查找元素映射与属性信息
|
|
103
|
+
*/
|
|
104
|
+
getElementPropertyByMarkdown(pos: MarkdownPosition): {
|
|
105
|
+
mapping: ElementMapping;
|
|
106
|
+
propertyName?: string;
|
|
107
|
+
relativePos?: MarkdownPosition;
|
|
108
|
+
} | null;
|
|
109
|
+
/**
|
|
110
|
+
* 清理无效路径的映射
|
|
111
|
+
*/
|
|
112
|
+
pruneInvalidPaths(isValidPath: (path: number[]) => boolean): void;
|
|
113
|
+
/**
|
|
114
|
+
* 打印映射表(调试用)
|
|
115
|
+
*/
|
|
116
|
+
debug(): void;
|
|
117
|
+
/**
|
|
118
|
+
* 调整子元素映射的位置(用于处理 childrenStart 和 perLineOffset)
|
|
119
|
+
*
|
|
120
|
+
* @param parentPath 父元素路径,如 [0]
|
|
121
|
+
* @param childrenStart 子元素内容在父输出中的起始位置
|
|
122
|
+
* @param perLineOffset 每行的额外偏移(用于 blockquote "> ", list "- " 等)
|
|
123
|
+
*/
|
|
124
|
+
adjustChildMappings(parentPath: number[], childrenStart: {
|
|
125
|
+
line: number;
|
|
126
|
+
ch: number;
|
|
127
|
+
}, perLineOffset?: number, baseLine?: number): void;
|
|
128
|
+
/**
|
|
129
|
+
* 对指定子元素索引之后的映射进行行号偏移
|
|
130
|
+
*/
|
|
131
|
+
shiftLinesForChildren(parentPath: number[], startIndex: number, lineDelta: number): void;
|
|
132
|
+
/**
|
|
133
|
+
* 调整内联包装元素(如 link)的子文本映射
|
|
134
|
+
*/
|
|
135
|
+
adjustChildMappingsForInlineWrapper(parentPath: number[], wrapperPrefixLength: number, wrapperSuffixLength: number): void;
|
|
136
|
+
/**
|
|
137
|
+
* 判断 childPath 是否是 parentPath 的子路径
|
|
138
|
+
* 例如:[0, 1, 2] 是 [0, 1] 的子路径
|
|
139
|
+
*/
|
|
140
|
+
private isChildPath;
|
|
141
|
+
/**
|
|
142
|
+
* 根据 Slate path 查找映射
|
|
143
|
+
*/
|
|
144
|
+
private findMappingBySlate;
|
|
145
|
+
/**
|
|
146
|
+
* 根据 Markdown 位置查找映射(二分查找)
|
|
147
|
+
*/
|
|
148
|
+
private findMappingByMarkdown;
|
|
149
|
+
/**
|
|
150
|
+
* 判断 Markdown 位置是否在元素范围内
|
|
151
|
+
*/
|
|
152
|
+
private isWithinElementRange;
|
|
153
|
+
/**
|
|
154
|
+
* 判断 Markdown 位置是否在范围内(end 为排他)
|
|
155
|
+
*/
|
|
156
|
+
private isWithinRange;
|
|
157
|
+
/**
|
|
158
|
+
* 判断位置是否落在区间结束边界(end inclusive,仅用于光标映射)
|
|
159
|
+
*/
|
|
160
|
+
private isAtRangeInclusiveEnd;
|
|
161
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { Descendant } from "slate";
|
|
2
|
+
import type { MarkdownCodec } from "./codec";
|
|
3
|
+
import { type ImportFromMarkdownOptions, type SlateWithPositions } from "./markdown";
|
|
4
|
+
import { type MarkdownWithPositions } from "./markdown-helper";
|
|
5
|
+
import type { CustomElement } from "./types";
|
|
6
|
+
import type { FormattedText } from "./model";
|
|
7
|
+
import { type MarkdownTextCodec, type LeafSerializationResult } from "./textCodec";
|
|
8
|
+
export interface MarkdownProcessor {
|
|
9
|
+
importFromMarkdown(markdown: string, ignoreTypes?: string[], options?: ImportFromMarkdownOptions): Descendant[];
|
|
10
|
+
importFromMarkdownWithPositions(markdown: string, ignoreTypes?: string[], options?: ImportFromMarkdownOptions): SlateWithPositions;
|
|
11
|
+
getMarkdown(value: Descendant[]): string;
|
|
12
|
+
getMarkdownWithPositions(value: Descendant[]): MarkdownWithPositions;
|
|
13
|
+
elementToMarkdown(element: CustomElement, parentElement: CustomElement | null): string;
|
|
14
|
+
leafToMarkdown(leaf: FormattedText): string;
|
|
15
|
+
leafToMarkdownStructured(leaf: FormattedText): LeafSerializationResult;
|
|
16
|
+
}
|
|
17
|
+
export interface MarkdownProcessorOptions {
|
|
18
|
+
/** 元素类型的编解码(各扩展的 markdown.ts 提供);处理器只认这里的类型,其余走 ER-006 兜底 */
|
|
19
|
+
codecs?: MarkdownCodec[];
|
|
20
|
+
textCodecs?: readonly MarkdownTextCodec[];
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* 创建 Markdown 处理器(01 §8.2):框架不带任何元素类型,全部经 codecs 注入,
|
|
24
|
+
* 宿主把扩展包的 codec 列表(如 @tau/editor/markdown)与自己的业务 codec 合成一次,
|
|
25
|
+
* 渲染进程和 Electron 主进程共用,避免两边漂移。
|
|
26
|
+
*/
|
|
27
|
+
export declare function createMarkdownProcessor(options?: MarkdownProcessorOptions): MarkdownProcessor;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { MarkdownImportNode } from "./codec";
|
|
2
|
+
import type { FormattedText } from "./model";
|
|
3
|
+
export interface MarkdownTextRule {
|
|
4
|
+
nodeType: string;
|
|
5
|
+
directive?: string;
|
|
6
|
+
content: "children" | "value";
|
|
7
|
+
/** children 模式的源码包裹范围;指令沿用外层以保持既有位置口径。 */
|
|
8
|
+
position?: "self" | "inherit";
|
|
9
|
+
readMarks(node: MarkdownImportNode): Readonly<Record<string, unknown>> | null;
|
|
10
|
+
}
|
|
11
|
+
export interface MarkdownTextCodec {
|
|
12
|
+
id: string;
|
|
13
|
+
keys: readonly string[];
|
|
14
|
+
importRules: readonly MarkdownTextRule[];
|
|
15
|
+
exportWrap(leaf: Readonly<FormattedText>): {
|
|
16
|
+
prefix: string;
|
|
17
|
+
suffix: string;
|
|
18
|
+
} | null;
|
|
19
|
+
}
|
|
20
|
+
export interface LeafSerializationResult {
|
|
21
|
+
output: string;
|
|
22
|
+
prefixLength: number;
|
|
23
|
+
suffixLength: number;
|
|
24
|
+
/** 转义载体中每个原文本边界相对 output 的偏移。 */
|
|
25
|
+
sourceOffsets?: readonly number[];
|
|
26
|
+
}
|
|
27
|
+
/** 处理器实例私有的纯标记注册表,不加载 UI 或默认格式。 */
|
|
28
|
+
export declare class MarkdownTextRegistry {
|
|
29
|
+
private readonly rules;
|
|
30
|
+
private readonly keys;
|
|
31
|
+
private readonly codecs;
|
|
32
|
+
constructor(codecs: readonly MarkdownTextCodec[]);
|
|
33
|
+
claim(node: MarkdownImportNode): {
|
|
34
|
+
rule: MarkdownTextRule;
|
|
35
|
+
marks: Readonly<Record<string, unknown>>;
|
|
36
|
+
} | null;
|
|
37
|
+
serialize(leaf: Readonly<FormattedText>): LeafSerializationResult;
|
|
38
|
+
private serializeKnown;
|
|
39
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { FormattedText } from "./model";
|
|
2
|
+
export type { FormattedText } from "./model";
|
|
3
|
+
/** 框架只看树结构;具体元素的字段和类型由 codec 解释。 */
|
|
4
|
+
export interface CustomElement {
|
|
5
|
+
type: string;
|
|
6
|
+
children: Array<CustomElement | FormattedText>;
|
|
7
|
+
}
|
|
8
|
+
export declare const isFormattedText: (node: CustomElement | FormattedText) => node is FormattedText;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { PluginPages } from "./pages";
|
|
2
|
+
import type { PluginEditor } from "./editor";
|
|
3
|
+
import type { PluginSettings } from "./settings";
|
|
4
|
+
import type { PluginSidebar } from "./sidebar";
|
|
5
|
+
export type JsonValue = null | boolean | number | string | JsonValue[] | {
|
|
6
|
+
[key: string]: JsonValue;
|
|
7
|
+
};
|
|
8
|
+
export interface Disposable {
|
|
9
|
+
dispose(): void | Promise<void>;
|
|
10
|
+
}
|
|
11
|
+
export interface PluginStorage {
|
|
12
|
+
get(key: string): Promise<JsonValue | undefined>;
|
|
13
|
+
set(key: string, value: JsonValue): Promise<void>;
|
|
14
|
+
delete(key: string): Promise<void>;
|
|
15
|
+
}
|
|
16
|
+
export interface PluginCommand {
|
|
17
|
+
/** 插件内的局部 ID,宿主会添加插件命名空间。 */
|
|
18
|
+
id: string;
|
|
19
|
+
title: string;
|
|
20
|
+
run(input: JsonValue): JsonValue | Promise<JsonValue>;
|
|
21
|
+
}
|
|
22
|
+
export interface PluginContext {
|
|
23
|
+
readonly pluginId: string;
|
|
24
|
+
readonly workspaceId: string;
|
|
25
|
+
readonly signal: AbortSignal;
|
|
26
|
+
readonly commands: {
|
|
27
|
+
register(command: PluginCommand): Disposable;
|
|
28
|
+
};
|
|
29
|
+
readonly storage: PluginStorage;
|
|
30
|
+
readonly pages: PluginPages;
|
|
31
|
+
readonly editor: PluginEditor;
|
|
32
|
+
readonly settings: PluginSettings;
|
|
33
|
+
readonly sidebar: PluginSidebar;
|
|
34
|
+
readonly fetch: typeof globalThis.fetch;
|
|
35
|
+
/** 将订阅等资源交给宿主,在停用或激活失败时逆序回收。 */
|
|
36
|
+
register(resource: Disposable): Disposable;
|
|
37
|
+
}
|
|
38
|
+
export interface PluginInstance {
|
|
39
|
+
activate(context: PluginContext): void | Promise<void>;
|
|
40
|
+
deactivate?(): void | Promise<void>;
|
|
41
|
+
}
|
|
42
|
+
export interface PluginDefinition {
|
|
43
|
+
readonly id: string;
|
|
44
|
+
readonly name: string;
|
|
45
|
+
readonly version: string;
|
|
46
|
+
readonly apiVersion: 1;
|
|
47
|
+
/** 每次启用创建新实例,运行状态不放在定义对象上。 */
|
|
48
|
+
create(): PluginInstance;
|
|
49
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { EditorExtension as InternalExtension } from "../../editor/contracts";
|
|
2
|
+
import type { MarkdownCodec } from "../../markdown/src/index";
|
|
3
|
+
import type { Disposable } from "./index";
|
|
4
|
+
export { defineElement as defineEditorElement } from "../../editor/contracts";
|
|
5
|
+
export type { ElementRenderProps as EditorElementRenderProps } from "../../editor/contracts";
|
|
6
|
+
export type { MarkdownCodec as EditorMarkdownCodec } from "../../markdown/src/index";
|
|
7
|
+
/** 作者通过模块增强登记自定义节点,无需引用编辑器内部包。 */
|
|
8
|
+
declare const elementMapBrand: unique symbol;
|
|
9
|
+
declare const inlineMapBrand: unique symbol;
|
|
10
|
+
export interface EditorElementMap {
|
|
11
|
+
[elementMapBrand]: never;
|
|
12
|
+
}
|
|
13
|
+
export interface EditorInlineElementMap {
|
|
14
|
+
[inlineMapBrand]: never;
|
|
15
|
+
}
|
|
16
|
+
declare module "../../editor/api" {
|
|
17
|
+
interface ExtensionElementMap extends EditorElementMap {
|
|
18
|
+
[elementMapBrand]: never;
|
|
19
|
+
}
|
|
20
|
+
interface ExtensionInlineElementMap extends EditorInlineElementMap {
|
|
21
|
+
[inlineMapBrand]: never;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
export type PluginEditorExtension = Pick<InternalExtension, "id" | "apiVersion" | "elements" | "commands" | "hotkeys" | "menu"> & {
|
|
25
|
+
plugins?: never;
|
|
26
|
+
};
|
|
27
|
+
export declare function defineEditorExtension(definition: Omit<PluginEditorExtension, "apiVersion">): PluginEditorExtension;
|
|
28
|
+
export interface PluginEditorContribution {
|
|
29
|
+
/** 目前只有开发台场景;其他场景需宿主明确接入后开放。 */
|
|
30
|
+
scene: "workbench";
|
|
31
|
+
extension: PluginEditorExtension;
|
|
32
|
+
/** 纯函数定义可由主进程独立导入,本次只在开发台装配。 */
|
|
33
|
+
codecs?: readonly MarkdownCodec[];
|
|
34
|
+
}
|
|
35
|
+
export interface PluginEditor {
|
|
36
|
+
register(contribution: PluginEditorContribution): Disposable;
|
|
37
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { PluginDefinition } from "./contract";
|
|
2
|
+
export type { JsonValue, Disposable, PluginStorage, PluginCommand, PluginContext, PluginInstance, PluginDefinition, } from "./contract";
|
|
3
|
+
export type { PluginSettings, PluginSettingsDefinition, PluginSettingsProps, PluginSettingsHandle, } from "./settings";
|
|
4
|
+
export * from "./editor";
|
|
5
|
+
export * from "./sidebar";
|
|
6
|
+
export type { PluginPageDefinition, PluginPageHandle, PluginPageParams, PluginPageProps, PluginPages, } from "./pages";
|
|
7
|
+
export declare function definePlugin(definition: Omit<PluginDefinition, "apiVersion">): PluginDefinition;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { ComponentType } from "react";
|
|
2
|
+
import type { Disposable, PluginContext } from "./index";
|
|
3
|
+
export type PluginPageParams = Record<string, string | number | boolean>;
|
|
4
|
+
export interface PluginPageProps {
|
|
5
|
+
readonly context: PluginContext;
|
|
6
|
+
readonly params: Readonly<PluginPageParams>;
|
|
7
|
+
}
|
|
8
|
+
export interface PluginPageDefinition {
|
|
9
|
+
id: string;
|
|
10
|
+
title: string;
|
|
11
|
+
component: ComponentType<PluginPageProps>;
|
|
12
|
+
match?: "single" | "params";
|
|
13
|
+
/** params 页缺省按完整参数区分实例;提供时只按该身份去重。 */
|
|
14
|
+
getId?(params: Readonly<PluginPageParams>): string;
|
|
15
|
+
}
|
|
16
|
+
export interface PluginPageHandle extends Disposable {
|
|
17
|
+
readonly id: string;
|
|
18
|
+
open(params?: PluginPageParams): Promise<void>;
|
|
19
|
+
}
|
|
20
|
+
export interface PluginPages {
|
|
21
|
+
register(definition: PluginPageDefinition): PluginPageHandle;
|
|
22
|
+
}
|
|
23
|
+
export declare function normalizePageParams(value: unknown): PluginPageParams;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ComponentType } from "react";
|
|
2
|
+
import type { Disposable, PluginContext } from "./index";
|
|
3
|
+
export interface PluginSettingsProps {
|
|
4
|
+
readonly context: PluginContext;
|
|
5
|
+
}
|
|
6
|
+
export interface PluginSettingsDefinition {
|
|
7
|
+
id: string;
|
|
8
|
+
title: string;
|
|
9
|
+
description?: string;
|
|
10
|
+
component: ComponentType<PluginSettingsProps>;
|
|
11
|
+
}
|
|
12
|
+
export interface PluginSettingsHandle extends Disposable {
|
|
13
|
+
readonly id: string;
|
|
14
|
+
open(): Promise<void>;
|
|
15
|
+
}
|
|
16
|
+
export interface PluginSettings {
|
|
17
|
+
/** 分区随本次激活回收,保存使用 context.storage。 */
|
|
18
|
+
register(definition: PluginSettingsDefinition): PluginSettingsHandle;
|
|
19
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { Disposable } from "./contract";
|
|
2
|
+
import type { PluginPageHandle, PluginPageParams } from "./pages";
|
|
3
|
+
export declare const SIDEBAR_GROUPS: Readonly<{
|
|
4
|
+
readonly daily: "daily";
|
|
5
|
+
readonly knowledge: "knowledge";
|
|
6
|
+
readonly learning: "learning";
|
|
7
|
+
readonly ai: "ai";
|
|
8
|
+
readonly sharing: "sharing";
|
|
9
|
+
readonly plugins: "plugins";
|
|
10
|
+
}>;
|
|
11
|
+
export interface PluginSidebarGroupDefinition {
|
|
12
|
+
id: string;
|
|
13
|
+
title: string;
|
|
14
|
+
}
|
|
15
|
+
export interface PluginSidebarGroupHandle extends Disposable {
|
|
16
|
+
readonly id: string;
|
|
17
|
+
}
|
|
18
|
+
export interface PluginSidebarItemDefinition {
|
|
19
|
+
id: string;
|
|
20
|
+
title: string;
|
|
21
|
+
/** 缺省或分组不存在时归入默认插件分组。 */
|
|
22
|
+
group?: string;
|
|
23
|
+
page: PluginPageHandle;
|
|
24
|
+
params?: PluginPageParams;
|
|
25
|
+
}
|
|
26
|
+
export interface PluginSidebar {
|
|
27
|
+
registerGroup(definition: PluginSidebarGroupDefinition): PluginSidebarGroupHandle;
|
|
28
|
+
registerItem(definition: PluginSidebarItemDefinition): Disposable;
|
|
29
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { ServiceIdentifier } from "./service-contract";
|
|
2
|
+
/**
|
|
3
|
+
* 服务注册表:宿主平台能力的统一容器。
|
|
4
|
+
* 注册与消费均以 ServiceIdentifier 匹配;可由编辑器、白板等宿主共享使用。
|
|
5
|
+
*/
|
|
6
|
+
export interface ServiceRegistry {
|
|
7
|
+
/** 获取必选服务,未注册时抛出包含服务 id 的错误 */
|
|
8
|
+
get<T>(id: ServiceIdentifier<T>): T;
|
|
9
|
+
/** 获取可选服务,未注册时返回 undefined;用于消费侧显式降级 */
|
|
10
|
+
tryGet<T>(id: ServiceIdentifier<T>): T | undefined;
|
|
11
|
+
has<T>(id: ServiceIdentifier<T>): boolean;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* 注册单个服务。实现值既可以是实例,也可以是 `(registry) => impl` 工厂:
|
|
15
|
+
* 工厂在首次 get 时才求值,因此注册顺序无关,且可在工厂内依赖其他服务。
|
|
16
|
+
* 注意:注册的值如果本身是函数,会被视为工厂。
|
|
17
|
+
*/
|
|
18
|
+
export type ServiceRegister = <T>(id: ServiceIdentifier<T>, impl: T | ((registry: ServiceRegistry) => T)) => void;
|
|
19
|
+
export type ServiceRegistration = (register: ServiceRegister) => void;
|
|
20
|
+
export declare function createServiceRegistry(...registrations: ServiceRegistration[]): ServiceRegistry;
|
|
21
|
+
/**
|
|
22
|
+
* 基于父注册表派生子注册表:get 时优先命中子级覆盖项,未命中则委托父级。
|
|
23
|
+
* 用于协同编辑等需要按上下文覆盖个别服务的场景,覆盖粒度可到单个服务。
|
|
24
|
+
*/
|
|
25
|
+
export declare function createChildRegistry(parent: ServiceRegistry, ...overrides: ServiceRegistration[]): ServiceRegistry;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type ThemeMode } from "./defineTheme";
|
|
2
|
+
import "./register";
|
|
3
|
+
/** 明暗偏好:固定浅色 / 固定深色 / 跟随系统(与主题族正交) */
|
|
4
|
+
export type Appearance = ThemeMode | "system";
|
|
5
|
+
export declare const DEFAULT_THEME_KEY = "paper";
|
|
6
|
+
export declare const DEFAULT_APPEARANCE: Appearance;
|
|
7
|
+
export declare const THEME_STORAGE_KEY = "tau-theme";
|
|
8
|
+
export declare const APPEARANCE_STORAGE_KEY = "tau-appearance";
|
|
9
|
+
export interface ThemeRuntimeConfig {
|
|
10
|
+
defaultTheme: string;
|
|
11
|
+
defaultAppearance: Appearance;
|
|
12
|
+
themeStorageKey: string;
|
|
13
|
+
appearanceStorageKey: string;
|
|
14
|
+
themes: string[];
|
|
15
|
+
}
|
|
16
|
+
export interface ResolvedThemePreference {
|
|
17
|
+
theme: string;
|
|
18
|
+
appearance: Appearance;
|
|
19
|
+
mode: ThemeMode;
|
|
20
|
+
}
|
|
21
|
+
export declare function themeRuntimeConfig(overrides?: Partial<Omit<ThemeRuntimeConfig, "themes">>): ThemeRuntimeConfig;
|
|
22
|
+
/**
|
|
23
|
+
* 存储值 → 生效主题。首帧内联脚本经 toString() 内嵌本函数,必须自包含(不引用模块内其它符号)。
|
|
24
|
+
*/
|
|
25
|
+
export declare function resolveThemePreference(savedTheme: string | null, savedAppearance: string | null, prefersDark: boolean, config: ThemeRuntimeConfig): ResolvedThemePreference;
|
|
26
|
+
export declare function createThemeBootstrapScript(config?: ThemeRuntimeConfig): string;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* defineTheme 协议 —— 一个文件声明一个主题族的全部。
|
|
3
|
+
*
|
|
4
|
+
* 与 definePage 同构的声明式协议(设计见 docs/redesign/02-UI设计系统规范.md §2.2):
|
|
5
|
+
* - 一个主题族 = key/名字 + 浅色、深色两套 palette/tokens 映射函数;深浅都是必填,
|
|
6
|
+
* 不存在「只有浅色的主题」,明暗是与主题族正交的维度(用户偏好 light/dark/system);
|
|
7
|
+
* - tokens() 返回值被约束为全键 SemanticTokens,漏键 = 编译错误(杜绝补丁式主题);
|
|
8
|
+
* - 派生逻辑(accent hover/soft 等)写在映射函数里,显式可读,不藏在 CSS calc 中;
|
|
9
|
+
* - 注册进纯数据注册表;运行时由 theme.ts 切换 data-theme / data-mode。
|
|
10
|
+
*
|
|
11
|
+
* 运行时:tokens.css 的 [data-theme][data-mode] 数据块级联取值(index.html 内联脚本首帧
|
|
12
|
+
* 预置,theme.ts 只切属性 + 持久化),数据块与 tokens() 产物由 theme-parity 测试守护;
|
|
13
|
+
* 后续优化为构建期 codegen(`pnpm ui:themes` 生成数据块),协议不变。
|
|
14
|
+
*/
|
|
15
|
+
import type { SemanticTokens } from "./tokenContract";
|
|
16
|
+
export type ThemeMode = "light" | "dark";
|
|
17
|
+
export declare const THEME_MODES: readonly ThemeMode[];
|
|
18
|
+
/** 原始色板输入(主题作者自由组织,不进组件;数值型输入用于派生计算) */
|
|
19
|
+
export type ThemePalette = Record<string, string | number>;
|
|
20
|
+
/** 主题族的一套明暗配色 */
|
|
21
|
+
export interface ThemeVariant {
|
|
22
|
+
palette: ThemePalette;
|
|
23
|
+
/** 色板 → 语义 token 的纯函数映射产物(全键强制) */
|
|
24
|
+
tokens: SemanticTokens;
|
|
25
|
+
}
|
|
26
|
+
export interface ThemeDefinition extends Record<ThemeMode, ThemeVariant> {
|
|
27
|
+
key: string;
|
|
28
|
+
name: string;
|
|
29
|
+
/** 设置页等列表中的排序权重(升序,同权重按注册顺序);缺省 0 */
|
|
30
|
+
order: number;
|
|
31
|
+
}
|
|
32
|
+
export interface ThemeVariantArgs {
|
|
33
|
+
palette: ThemePalette;
|
|
34
|
+
tokens: (p: ThemePalette) => SemanticTokens;
|
|
35
|
+
}
|
|
36
|
+
export interface ThemeDefinitionArgs extends Record<ThemeMode, ThemeVariantArgs> {
|
|
37
|
+
key: string;
|
|
38
|
+
name: string;
|
|
39
|
+
order?: number;
|
|
40
|
+
}
|
|
41
|
+
export declare function defineTheme(args: ThemeDefinitionArgs): ThemeDefinition;
|
|
42
|
+
export declare function getThemeRegistry(): ReadonlyMap<string, ThemeDefinition>;
|
|
43
|
+
/** 按 order 排序的主题列表(供设置页等枚举展示;不依赖注册 / import 顺序) */
|
|
44
|
+
export declare function listThemes(): ThemeDefinition[];
|
|
45
|
+
export declare function getTheme(key: string): ThemeDefinition | undefined;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 主题契约根入口:token 词汇表、defineTheme 协议与注册表、内置主题、偏好解析与首帧脚本生成。
|
|
3
|
+
* 纯数据 + 纯函数,不依赖 DOM / React,可在 Node(vite 配置、主进程、测试)中直接使用。
|
|
4
|
+
* DOM 应用见 `@tau/themes/dom`,React 运行时见 `@tau/themes/react`。
|
|
5
|
+
*/
|
|
6
|
+
import "./register";
|
|
7
|
+
export * from "./tokenContract";
|
|
8
|
+
export { THEME_MODES, defineTheme, getTheme, getThemeRegistry, listThemes } from "./defineTheme";
|
|
9
|
+
export type { ThemeDefinition, ThemeDefinitionArgs, ThemeMode, ThemePalette, ThemeVariant, ThemeVariantArgs, } from "./defineTheme";
|
|
10
|
+
export { APPEARANCE_STORAGE_KEY, DEFAULT_APPEARANCE, DEFAULT_THEME_KEY, THEME_STORAGE_KEY, createThemeBootstrapScript, resolveThemePreference, themeRuntimeConfig, type Appearance, type ResolvedThemePreference, type ThemeRuntimeConfig, } from "./bootstrap";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 主题「水墨」—— 宣纸落墨:近白而非纯白、近黑而非纯黑,彩度压到最低,素净留白。
|
|
3
|
+
*
|
|
4
|
+
* 浅色(宣纸):微暖米白纸底 + 浓墨;accent 取低饱和「青黛」(墨中带一丝蓝灰),仍是墨色却可辨识;
|
|
5
|
+
* 状态色取国画颜料(石绿 / 藤黄 / 朱砂 / 花青 / 赭石)并全部降饱和;阴影比其它主题更淡,画面更平静。
|
|
6
|
+
* 深色(松烟):暖黑墨底 + 宣纸色墨字 + 提亮青黛;层级口径同暖纸 · 夜。
|
|
7
|
+
*
|
|
8
|
+
* 对比度按 02 规范 §2.5,深浅两套均由 theme-parity.test.ts 校验。
|
|
9
|
+
*/
|
|
10
|
+
declare const _default: import("../defineTheme").ThemeDefinition;
|
|
11
|
+
export default _default;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 主题「薄荷」—— 取自移动端薄荷 Mint(浅色·清新):灰绿纸底 + 松墨 + 翠绿 accent。
|
|
3
|
+
*
|
|
4
|
+
* 浅色(晴):底色 / 墨色 / 状态色沿用移动端;ink-2 与 accent 按桌面 AA 门禁压深。
|
|
5
|
+
* 深色(夜林):移动端无深色版,按同色相推演——墨绿夜底 + 淡薄荷白墨 + 中饱和翠绿 accent;
|
|
6
|
+
* 绿调强度介于「整页泛绿」与「近中性(与水墨 · 松烟难分)」之间。
|
|
7
|
+
*
|
|
8
|
+
* 对比度按 02 规范 §2.5,深浅两套均由 theme-parity.test.ts 校验。
|
|
9
|
+
*/
|
|
10
|
+
declare const _default: import("../defineTheme").ThemeDefinition;
|
|
11
|
+
export default _default;
|