markloom 0.5.1 → 0.6.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/PACKAGES.md +26 -0
- package/README.md +20 -2
- package/collab.md +42 -7
- package/dist/ai/index.cjs +4 -4
- package/dist/ai/index.d.cts +5 -4
- package/dist/ai/index.d.ts +5 -4
- package/dist/ai/index.js +3 -3
- package/dist/ai/theme.css +66 -102
- package/dist/{chunk-VXM7Q6P5.cjs → chunk-ACFYBYZJ.cjs} +2604 -966
- package/dist/chunk-CGYCJORO.js +759 -0
- package/dist/chunk-EADZKEU4.cjs +498 -0
- package/dist/chunk-EJSFZHGT.js +24 -0
- package/dist/{chunk-YIFOGP2D.cjs → chunk-I5VK4U7J.cjs} +103 -60
- package/dist/{chunk-ZMTLSFLO.js → chunk-KYZJIOOL.js} +2138 -500
- package/dist/chunk-QEVME6ZU.cjs +759 -0
- package/dist/{chunk-MFYF2A6U.js → chunk-SNFF6X45.js} +51 -1
- package/dist/{chunk-FCH7LZFI.js → chunk-TB2OY3D4.js} +50 -7
- package/dist/{chunk-4TMHVNL6.cjs → chunk-TWD5T4YC.cjs} +155 -105
- package/dist/{chunk-JS527FDV.cjs → chunk-U3JZDFL4.cjs} +49 -9
- package/dist/{chunk-RLTHVQNQ.js → chunk-VSBIMMI7.js} +45 -5
- package/dist/chunk-YBAT343I.js +498 -0
- package/dist/chunk-ZKQSQSSM.cjs +24 -0
- package/dist/{client-ZRZj2nkq.d.cts → client-CLYq17SW.d.ts} +63 -7
- package/dist/{client-6KiH4kGK.d.ts → client-DAth8pPq.d.cts} +63 -7
- package/dist/collab/index.cjs +16 -4
- package/dist/collab/index.d.cts +19 -6
- package/dist/collab/index.d.ts +19 -6
- package/dist/collab/index.js +18 -6
- package/dist/{controller-BNuuUM3E.d.ts → controller-6AJ36G52.d.ts} +99 -7
- package/dist/{controller-DQITsFhy.d.cts → controller-BIOO_XKJ.d.cts} +99 -7
- package/dist/index.cjs +57 -7
- package/dist/index.d.cts +18 -5
- package/dist/index.d.ts +18 -5
- package/dist/index.js +54 -4
- package/dist/io/index.cjs +1413 -0
- package/dist/io/index.d.cts +33 -0
- package/dist/io/index.d.ts +33 -0
- package/dist/io/index.js +1413 -0
- package/dist/react/index.cjs +8 -8
- package/dist/react/index.d.cts +5 -4
- package/dist/react/index.d.ts +5 -4
- package/dist/react/index.js +7 -7
- package/dist/{rebase-batch-8rL_aXEE.d.ts → rebase-batch-DlerAcFN.d.ts} +11 -9
- package/dist/{rebase-batch-bYnBJpRO.d.cts → rebase-batch-PjENQ742.d.cts} +11 -9
- package/dist/suggest-Bk4zLzuv.d.ts +120 -0
- package/dist/suggest-BkGGiPKA.d.cts +120 -0
- package/dist/types-COUweEav.d.cts +30 -0
- package/dist/types-COUweEav.d.ts +30 -0
- package/dist/versions-9mG1epfB.d.cts +51 -0
- package/dist/versions-Bubyo4pt.d.ts +51 -0
- package/dist/view/index.cjs +56 -12
- package/dist/view/index.d.cts +203 -11
- package/dist/view/index.d.ts +203 -11
- package/dist/view/index.js +52 -8
- package/dist/view/theme.css +1829 -1587
- package/io.md +38 -0
- package/package.json +21 -5
- package/dist/chunk-4JSJAHTB.js +0 -255
- package/dist/chunk-ALZ3A5CS.cjs +0 -255
- package/dist/chunk-GQ2HHRGI.cjs +0 -16
- package/dist/chunk-LA5SBCGQ.js +0 -16
- package/dist/chunk-LEYAQNJA.js +0 -220
- package/dist/chunk-YXQDCW4Y.cjs +0 -220
- package/dist/comments-DlExS6f-.d.cts +0 -43
- package/dist/comments-PhnR7Gkn.d.ts +0 -43
- package/dist/step-BrvHIK7O.d.cts +0 -65
- package/dist/step-BrvHIK7O.d.ts +0 -65
package/PACKAGES.md
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# markloom 包矩阵(O(1) 交付)
|
|
2
|
+
|
|
3
|
+
> 用户心智只到 import / 一个 options 字段。扩展点是作者工具,不是默认交付。
|
|
4
|
+
|
|
5
|
+
## 已立
|
|
6
|
+
|
|
7
|
+
| 入口 | 开关 | 能力 |
|
|
8
|
+
|---|---|---|
|
|
9
|
+
| `markloom` | — | 树 · Step · MD · find/replace · history · versions · suggest 纯函数 |
|
|
10
|
+
| `markloom/view` | 默认 kit | 编辑器 + 装饰层 |
|
|
11
|
+
| `markloom/view` | `search: true` | **查找替换** · Cmd/Ctrl+F |
|
|
12
|
+
| `markloom/view` | `versions: true` | **命名版本** · Cmd/Ctrl+Shift+S · 协作时上行房间 |
|
|
13
|
+
| `markloom/view` | `suggest: true` | **修订** · 跟踪插入/退格标删 · accept/reject · ⌘⇧G |
|
|
14
|
+
| `markloom/view` | `comments: {}` | 批注侧栏 |
|
|
15
|
+
| `markloom/view` | `toc: true` | 目录 |
|
|
16
|
+
| `markloom/ai` | `ai: {…}` | 流式写作 · draft 事务 |
|
|
17
|
+
| `markloom/collab` | `collab: { url, room, token? }` | OT + presence · 鉴权 · 心跳 · resync · **版本侧信道** |
|
|
18
|
+
| `markloom/io` | `import` | **DOCX 进/出** · store+deflate · 图 data URL / `docToDocxAsync` 拉远程 |
|
|
19
|
+
| `markloom/react` | peer react | React 壳 |
|
|
20
|
+
|
|
21
|
+
## 律
|
|
22
|
+
|
|
23
|
+
1. **不 import = 不存在**(体积与概念)
|
|
24
|
+
2. **import + 一字段 = 开箱**(禁止拼装手册当主路径)
|
|
25
|
+
3. **不占新节点类型**(M1=16 已满;企业能力走侧信道 / Step / 纯读)
|
|
26
|
+
4. **内核基础层不拆**(IME / 输入守卫 / map)
|
package/README.md
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
**The loom for Markdown** — rich text that stays honest with MD, and that AI can write into without a second model.
|
|
4
4
|
|
|
5
|
+
**Site:** [markloom-www.pages.dev](https://markloom-www.pages.dev) · [Docs](https://markloom-www.pages.dev/docs/)
|
|
6
|
+
|
|
5
7
|
Most editors pick one: a nice WYSIWYG that mangled MD on export, or a MD source that never becomes a real structured tree. Product teams re-glue paste, IME, undo, and AI cards. Agents stream text into a DOM they don’t own.
|
|
6
8
|
|
|
7
9
|
markloom is one document model: a **schema-constrained tree**, **reversible Steps**, **Markdown as an isomorphic projection** (not “export later”), and an optional **AI transaction** on real blocks. Kernel without DOM; view when you need an editor.
|
|
@@ -52,10 +54,11 @@ One options field: `/ai`, format bar, real draft blocks, accept / undo — same
|
|
|
52
54
|
### 5. Use the piece you need
|
|
53
55
|
|
|
54
56
|
```
|
|
55
|
-
markloom tree, Steps, history, MD,
|
|
56
|
-
markloom/view editor + view/theme.css
|
|
57
|
+
markloom tree, Steps, history, MD, search/versions/suggest pure fns
|
|
58
|
+
markloom/view editor + view/theme.css (search / versions / suggest / …)
|
|
57
59
|
markloom/ai AI controller + stream helper + ai/theme.css
|
|
58
60
|
markloom/collab realtime OT client (pair with worker/)
|
|
61
|
+
markloom/io DOCX import/export (docToDocx / docxToDoc)
|
|
59
62
|
markloom/react optional React wrapper (peer react, optional)
|
|
60
63
|
```
|
|
61
64
|
|
|
@@ -108,6 +111,21 @@ new Editor(el, doc, {
|
|
|
108
111
|
})
|
|
109
112
|
```
|
|
110
113
|
|
|
114
|
+
**Enterprise O(1)** (import + one option; no assembly manual):
|
|
115
|
+
|
|
116
|
+
```ts
|
|
117
|
+
new Editor(el, doc, {
|
|
118
|
+
search: true, // ⌘F find/replace
|
|
119
|
+
versions: true, // ⌘⇧S named snapshots (collab syncs when connected)
|
|
120
|
+
suggest: true, // ⌘⇧G track changes
|
|
121
|
+
collab: { url, room, token: 'optional-shared-secret' },
|
|
122
|
+
})
|
|
123
|
+
|
|
124
|
+
import { docToDocx, docxToDoc } from 'markloom/io'
|
|
125
|
+
const bytes = docToDocx(ed.doc)
|
|
126
|
+
const back = docxToDoc(bytes)
|
|
127
|
+
```
|
|
128
|
+
|
|
111
129
|
## Why this stack
|
|
112
130
|
|
|
113
131
|
|
package/collab.md
CHANGED
|
@@ -18,17 +18,30 @@ new Editor(el, doc, {
|
|
|
18
18
|
url: 'ws://127.0.0.1:8787', // or wss://your-worker.workers.dev
|
|
19
19
|
room: 'demo-room',
|
|
20
20
|
name: 'Alice',
|
|
21
|
+
// token: 'secret', // when worker COLLAB_TOKEN is set
|
|
22
|
+
// token: () => fetchToken(), // async ok
|
|
23
|
+
// onStatus: s => …, // connecting | open | closed | resyncing | auth-error
|
|
24
|
+
// onResync: v => …, // server forced snapshot
|
|
21
25
|
},
|
|
22
26
|
})
|
|
23
27
|
```
|
|
24
28
|
|
|
25
29
|
That is enough: local edits upload as Steps; remote Steps apply through OT. No extension list.
|
|
26
30
|
|
|
27
|
-
**Presence (built-in, Feishu-style):** top-right avatar stack (self + peers) and colored remote carets with name labels. Colors auto-assign by `siteId` unless you set `color`. No extra config.
|
|
31
|
+
**Presence (built-in, Feishu-style):** status dot + top-right avatar stack (self + peers) and colored remote carets with name labels. Colors auto-assign by `siteId` unless you set `color`. No extra config.
|
|
32
|
+
|
|
33
|
+
**Production hooks**
|
|
34
|
+
|
|
35
|
+
| Field | Role |
|
|
36
|
+
|-------|------|
|
|
37
|
+
| `token` / `() => token` | Join auth; worker rejects if `COLLAB_TOKEN` set and mismatch → `auth-error` (no reconnect storm) |
|
|
38
|
+
| `onStatus` | `connecting` · `open` · `closed` · `resyncing` · `auth-error` |
|
|
39
|
+
| `onResync` | Stale base / rebase fail → server snapshot; client clears pending |
|
|
40
|
+
| heartbeat | Client ping 20s; no pong 45s → reconnect |
|
|
28
41
|
|
|
29
42
|
Optional: `color`, `name`, `seed` (empty room init; default = constructor `doc`).
|
|
30
43
|
|
|
31
|
-
Programmatic: `ed.collab` → `CollabClient` (`peersList`, `close()`).
|
|
44
|
+
Programmatic: `ed.collab` → `CollabClient` (`peersList`, `status`, `close()`).
|
|
32
45
|
|
|
33
46
|
## Worker
|
|
34
47
|
|
|
@@ -47,17 +60,38 @@ Deploy: `bun run deploy` (Cloudflare account + `wrangler login`).
|
|
|
47
60
|
|
|
48
61
|
| Direction | Types |
|
|
49
62
|
|-----------|--------|
|
|
50
|
-
| C→S | `join`, `op`, `presence`, `ping` |
|
|
51
|
-
| S→C | `welcome
|
|
63
|
+
| C→S | `join`, `op`, `presence`, `ping`, `version-save`, `version-remove` |
|
|
64
|
+
| S→C | `welcome` (+`versions?`), `op`, `presence`, `peer-join` / `peer-leave`, `resync`, `error`, `versions` |
|
|
65
|
+
|
|
66
|
+
Named versions are a **side channel** (not OT steps): save/remove broadcast the full room list; `welcome` seeds late joiners. Enable with `versions: true` on the Editor — collab auto-uploads on save.
|
|
52
67
|
|
|
53
68
|
See `src/collab/protocol.ts`.
|
|
54
69
|
|
|
70
|
+
## Write paths (abstraction)
|
|
71
|
+
|
|
72
|
+
Exactly **two** ways the doc changes under collab:
|
|
73
|
+
|
|
74
|
+
| Path | API | Undo stack | Network |
|
|
75
|
+
|------|-----|------------|---------|
|
|
76
|
+
| **local** | `dispatch` / `dispatchStream` / `undo` / `redo` | `commit` / `amend` / pop | `push` |
|
|
77
|
+
| **foreign** | `applyRemote` → `applyForeign` | OT-map only, **never push** | inbound `op` |
|
|
78
|
+
|
|
79
|
+
Decorations (slash, table, bubble, …) only call `host.dispatch` → local.
|
|
80
|
+
No third path mutates `history.doc`.
|
|
81
|
+
|
|
82
|
+
## Undo / redo (per-person)
|
|
83
|
+
|
|
84
|
+
- **Local stack only**: remote ops use `applyForeign` — update the doc and OT-map your stack, but **never push remote onto `past`**.
|
|
85
|
+
- Multi-step commits / inverses use **sequential** OT (`transformSeqThroughOne`), not per-step independent map.
|
|
86
|
+
- **Cmd+Z** undoes *your* last commit; inverse is broadcast as a normal op.
|
|
87
|
+
- Foreign batches are applied **as sent** (gap steps already included by the author).
|
|
88
|
+
|
|
55
89
|
## Limits (honest)
|
|
56
90
|
|
|
57
91
|
- **TP2** (reordered remote undo chains) not proven; server serializes commits so common concurrent typing is covered by TP1 + central order.
|
|
58
|
-
|
|
59
|
-
-
|
|
60
|
-
- Presence
|
|
92
|
+
Strategy: pathological OT → **resync to authority** (not silent corruption). Prefer resync over inventing unproven multi-way undo transforms.
|
|
93
|
+
- Pathological OT corner cases may still `resync`; room id alone is weak capability — set `COLLAB_TOKEN` + client `token` for shared-secret auth.
|
|
94
|
+
- Presence multi-caret chrome is built-in; further product UI is optional.
|
|
61
95
|
|
|
62
96
|
## Lab
|
|
63
97
|
|
|
@@ -67,4 +101,5 @@ cd worker && bun run dev
|
|
|
67
101
|
# terminal 2
|
|
68
102
|
cd .. && bun run lab
|
|
69
103
|
# open two windows: http://localhost:5181/?room=demo
|
|
104
|
+
# with auth: wrangler vars COLLAB_TOKEN=secret → ?room=demo&token=secret
|
|
70
105
|
```
|
package/dist/ai/index.cjs
CHANGED
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
10
|
-
require('../chunk-
|
|
11
|
-
require('../chunk-
|
|
9
|
+
var _chunkI5VK4U7Jcjs = require('../chunk-I5VK4U7J.cjs');
|
|
10
|
+
require('../chunk-TWD5T4YC.cjs');
|
|
11
|
+
require('../chunk-ZKQSQSSM.cjs');
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
|
|
@@ -17,4 +17,4 @@ require('../chunk-GQ2HHRGI.cjs');
|
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
|
|
20
|
-
exports.MarkloomAi =
|
|
20
|
+
exports.MarkloomAi = _chunkI5VK4U7Jcjs.MarkloomAi; exports.aiInstructionFromQuery = _chunkI5VK4U7Jcjs.aiInstructionFromQuery; exports.blockPlainText = _chunkI5VK4U7Jcjs.blockPlainText; exports.createAiStream = _chunkI5VK4U7Jcjs.createAiStream; exports.focusBlockId = _chunkI5VK4U7Jcjs.focusBlockId; exports.precedingPlainText = _chunkI5VK4U7Jcjs.precedingPlainText; exports.startAiWrite = _chunkI5VK4U7Jcjs.startAiWrite;
|
package/dist/ai/index.d.cts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
export { A as AiConfig, a as AiPromptMode, b as AiProvider, c as AiStreamFn, d as AiStreamInput, e as AiWriteMode, f as AiWriteSession, M as MarkloomAi, g as MarkloomAiOpts, h as blockPlainText, i as createAiStream, j as focusBlockId, s as startAiWrite } from '../controller-
|
|
2
|
-
import { E as ElementNode } from '../
|
|
1
|
+
export { A as AiConfig, a as AiPromptMode, b as AiProvider, c as AiStreamFn, d as AiStreamInput, e as AiWriteMode, f as AiWriteSession, M as MarkloomAi, g as MarkloomAiOpts, h as blockPlainText, i as createAiStream, j as focusBlockId, s as startAiWrite } from '../controller-BIOO_XKJ.cjs';
|
|
2
|
+
import { E as ElementNode } from '../types-COUweEav.cjs';
|
|
3
|
+
import '../versions-9mG1epfB.cjs';
|
|
3
4
|
import 'preact';
|
|
4
|
-
import '../
|
|
5
|
-
import '../client-
|
|
5
|
+
import '../suggest-BkGGiPKA.cjs';
|
|
6
|
+
import '../client-DAth8pPq.cjs';
|
|
6
7
|
|
|
7
8
|
/** 顶层块 [0, blockIdx) 纯文本拼接(作 /ai 上下文) */
|
|
8
9
|
declare function precedingPlainText(doc: ElementNode, blockIdx: number): string;
|
package/dist/ai/index.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
export { A as AiConfig, a as AiPromptMode, b as AiProvider, c as AiStreamFn, d as AiStreamInput, e as AiWriteMode, f as AiWriteSession, M as MarkloomAi, g as MarkloomAiOpts, h as blockPlainText, i as createAiStream, j as focusBlockId, s as startAiWrite } from '../controller-
|
|
2
|
-
import { E as ElementNode } from '../
|
|
1
|
+
export { A as AiConfig, a as AiPromptMode, b as AiProvider, c as AiStreamFn, d as AiStreamInput, e as AiWriteMode, f as AiWriteSession, M as MarkloomAi, g as MarkloomAiOpts, h as blockPlainText, i as createAiStream, j as focusBlockId, s as startAiWrite } from '../controller-6AJ36G52.js';
|
|
2
|
+
import { E as ElementNode } from '../types-COUweEav.js';
|
|
3
|
+
import '../versions-Bubyo4pt.js';
|
|
3
4
|
import 'preact';
|
|
4
|
-
import '../
|
|
5
|
-
import '../client-
|
|
5
|
+
import '../suggest-Bk4zLzuv.js';
|
|
6
|
+
import '../client-CLYq17SW.js';
|
|
6
7
|
|
|
7
8
|
/** 顶层块 [0, blockIdx) 纯文本拼接(作 /ai 上下文) */
|
|
8
9
|
declare function precedingPlainText(doc: ElementNode, blockIdx: number): string;
|
package/dist/ai/index.js
CHANGED
|
@@ -6,9 +6,9 @@ import {
|
|
|
6
6
|
focusBlockId,
|
|
7
7
|
precedingPlainText,
|
|
8
8
|
startAiWrite
|
|
9
|
-
} from "../chunk-
|
|
10
|
-
import "../chunk-
|
|
11
|
-
import "../chunk-
|
|
9
|
+
} from "../chunk-TB2OY3D4.js";
|
|
10
|
+
import "../chunk-SNFF6X45.js";
|
|
11
|
+
import "../chunk-EJSFZHGT.js";
|
|
12
12
|
export {
|
|
13
13
|
MarkloomAi,
|
|
14
14
|
aiInstructionFromQuery,
|
package/dist/ai/theme.css
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
/* markloom/ai — 飞书式无边框;生成结果是正文流里的真段落,确认前 opacity 淡化
|
|
1
|
+
/* markloom/ai — 飞书式无边框;生成结果是正文流里的真段落,确认前 opacity 淡化
|
|
2
|
+
Converted toward Tailwind @apply. Residual: CSS vars, @keyframes, ::after stream caret,
|
|
3
|
+
data-status bg colors, prefers-reduced-motion, html.dark dual path. */
|
|
2
4
|
|
|
3
5
|
.markloom-doc .markloom-ai-block {
|
|
4
6
|
--ai-blue: #3370ff;
|
|
@@ -8,14 +10,8 @@
|
|
|
8
10
|
--ai-sub: #646a73;
|
|
9
11
|
--ai-hover: #eff0f1;
|
|
10
12
|
--ai-fill: #f5f6f7;
|
|
11
|
-
|
|
12
|
-
margin: 0.5rem 0 0.25rem;
|
|
13
|
-
padding: 10px 12px 8px;
|
|
14
|
-
border: 0;
|
|
15
|
-
border-radius: 8px;
|
|
13
|
+
@apply relative my-2 mb-1 px-3 pt-2.5 pb-2 border-0 rounded-lg outline-none shadow-none;
|
|
16
14
|
background: var(--ai-fill);
|
|
17
|
-
box-shadow: none;
|
|
18
|
-
outline: none;
|
|
19
15
|
animation: markloom-ai-in 0.14s ease-out;
|
|
20
16
|
}
|
|
21
17
|
.markloom-doc .markloom-ai-block[data-status='loading'] {
|
|
@@ -38,30 +34,17 @@
|
|
|
38
34
|
|
|
39
35
|
/* ── header ── */
|
|
40
36
|
.markloom-doc .markloom-ai-block-hd {
|
|
41
|
-
|
|
42
|
-
align-items: center;
|
|
43
|
-
justify-content: space-between;
|
|
44
|
-
gap: 8px;
|
|
45
|
-
padding: 0 0 2px;
|
|
46
|
-
user-select: none;
|
|
37
|
+
@apply flex items-center justify-between gap-2 pb-0.5 pt-0 px-0 select-none;
|
|
47
38
|
}
|
|
48
39
|
.markloom-doc .markloom-ai-block-brand {
|
|
49
|
-
|
|
50
|
-
align-items: center;
|
|
51
|
-
gap: 6px;
|
|
52
|
-
min-width: 0;
|
|
40
|
+
@apply inline-flex items-center gap-1.5 min-w-0;
|
|
53
41
|
}
|
|
54
42
|
.markloom-doc .markloom-ai-block-ico {
|
|
55
|
-
|
|
56
|
-
align-items: center;
|
|
57
|
-
justify-content: center;
|
|
58
|
-
width: 20px;
|
|
59
|
-
height: 20px;
|
|
43
|
+
@apply inline-flex items-center justify-center w-5 h-5 shrink-0;
|
|
60
44
|
color: var(--ai-blue);
|
|
61
|
-
flex: none;
|
|
62
45
|
}
|
|
63
46
|
.markloom-doc .markloom-ai-block-svg {
|
|
64
|
-
|
|
47
|
+
@apply block;
|
|
65
48
|
stroke-width: 1.75;
|
|
66
49
|
}
|
|
67
50
|
.markloom-doc .markloom-ai-block-title {
|
|
@@ -69,10 +52,7 @@
|
|
|
69
52
|
color: var(--ai-blue);
|
|
70
53
|
}
|
|
71
54
|
.markloom-doc .markloom-ai-block-badge {
|
|
72
|
-
|
|
73
|
-
align-items: center;
|
|
74
|
-
gap: 4px;
|
|
75
|
-
margin-left: 2px;
|
|
55
|
+
@apply inline-flex items-center gap-1 ml-0.5;
|
|
76
56
|
font: 400 12px/1.2 system-ui, sans-serif;
|
|
77
57
|
color: var(--ai-muted);
|
|
78
58
|
}
|
|
@@ -80,32 +60,22 @@
|
|
|
80
60
|
.markloom-doc .markloom-ai-block-badge-error { color: #f54a45; }
|
|
81
61
|
|
|
82
62
|
.markloom-doc .markloom-ai-block-seed {
|
|
83
|
-
|
|
84
|
-
align-items: baseline;
|
|
85
|
-
gap: 8px;
|
|
86
|
-
margin: 6px 0 0;
|
|
87
|
-
max-height: 1.4em;
|
|
88
|
-
overflow: hidden;
|
|
63
|
+
@apply flex items-baseline gap-2 mt-1.5 mb-0 max-h-[1.4em] overflow-hidden;
|
|
89
64
|
}
|
|
90
65
|
.markloom-doc .markloom-ai-block-seed-lab {
|
|
91
|
-
|
|
66
|
+
@apply shrink-0;
|
|
92
67
|
font: 400 12px/1.4 system-ui, sans-serif;
|
|
93
68
|
color: var(--ai-muted);
|
|
94
69
|
}
|
|
95
70
|
.markloom-doc .markloom-ai-block-seed-txt {
|
|
71
|
+
@apply overflow-hidden text-ellipsis whitespace-nowrap min-w-0;
|
|
96
72
|
font: 400 12px/1.4 system-ui, sans-serif;
|
|
97
73
|
color: var(--ai-sub);
|
|
98
|
-
overflow: hidden;
|
|
99
|
-
text-overflow: ellipsis;
|
|
100
|
-
white-space: nowrap;
|
|
101
|
-
min-width: 0;
|
|
102
74
|
}
|
|
103
75
|
|
|
104
76
|
/* 指令 */
|
|
105
77
|
.markloom-doc .markloom-ai-block > p.markloom-ai-prompt {
|
|
106
|
-
|
|
107
|
-
padding: 4px 0;
|
|
108
|
-
min-height: 1.5em;
|
|
78
|
+
@apply my-1.5 mt-1.5 mb-1 py-1 min-h-[1.5em];
|
|
109
79
|
border: 0 !important;
|
|
110
80
|
background: transparent !important;
|
|
111
81
|
box-shadow: none !important;
|
|
@@ -113,8 +83,7 @@
|
|
|
113
83
|
color: var(--ai-text);
|
|
114
84
|
}
|
|
115
85
|
.markloom-doc .markloom-ai-block[data-status='loading'] > p.markloom-ai-prompt {
|
|
116
|
-
opacity
|
|
117
|
-
pointer-events: none;
|
|
86
|
+
@apply opacity-50 pointer-events-none;
|
|
118
87
|
}
|
|
119
88
|
.markloom-doc .markloom-ai-block > p.markloom-ai-prompt[data-placeholder]::before {
|
|
120
89
|
content: attr(data-placeholder);
|
|
@@ -124,25 +93,21 @@
|
|
|
124
93
|
|
|
125
94
|
/*
|
|
126
95
|
* 生成结果 = 文档顶层真块(段/标题/列表/代码/引用…)。
|
|
127
|
-
*
|
|
96
|
+
* 确认前轻微淡化(别太虚);确认后去掉 data-ai-draft。
|
|
128
97
|
*/
|
|
129
98
|
.markloom-doc > [data-ai-draft],
|
|
130
99
|
.markloom-doc [data-ai-draft].markloom-ai-draft {
|
|
131
|
-
opacity
|
|
100
|
+
@apply opacity-[0.88];
|
|
132
101
|
transition: opacity 0.18s ease;
|
|
133
102
|
}
|
|
134
|
-
/* 列表/引用整体淡化时子元素别再叠一层 */
|
|
135
103
|
.markloom-doc [data-ai-draft] [data-ai-draft] {
|
|
136
|
-
opacity
|
|
104
|
+
@apply opacity-100;
|
|
137
105
|
}
|
|
138
|
-
/* 流式末段光标
|
|
106
|
+
/* 流式末段光标 */
|
|
139
107
|
.markloom-doc > p[data-ai-draft][data-ai-stream]::after,
|
|
140
108
|
.markloom-doc p[data-ai-draft][data-ai-stream]::after {
|
|
141
109
|
content: '';
|
|
142
|
-
|
|
143
|
-
width: 2px;
|
|
144
|
-
height: 1em;
|
|
145
|
-
margin-left: 2px;
|
|
110
|
+
@apply inline-block w-0.5 h-[1em] ml-0.5;
|
|
146
111
|
background: #3370ff;
|
|
147
112
|
vertical-align: text-bottom;
|
|
148
113
|
animation: markloom-ai-caret 0.9s steps(1) infinite;
|
|
@@ -152,66 +117,37 @@
|
|
|
152
117
|
}
|
|
153
118
|
|
|
154
119
|
.markloom-doc .markloom-ai-block-err {
|
|
155
|
-
|
|
120
|
+
@apply mt-1 mb-0;
|
|
156
121
|
font: 400 13px/1.45 system-ui, sans-serif;
|
|
157
122
|
color: #f54a45;
|
|
158
123
|
}
|
|
159
124
|
|
|
160
125
|
/* footer */
|
|
161
126
|
.markloom-doc .markloom-ai-block-ft {
|
|
162
|
-
|
|
163
|
-
align-items: center;
|
|
164
|
-
justify-content: space-between;
|
|
165
|
-
gap: 10px;
|
|
166
|
-
padding: 6px 0 0;
|
|
167
|
-
min-height: 32px;
|
|
127
|
+
@apply flex items-center justify-between gap-2.5 pt-1.5 pb-0 px-0 min-h-8;
|
|
168
128
|
}
|
|
169
129
|
.markloom-doc .markloom-ai-block-hint {
|
|
170
|
-
|
|
171
|
-
align-items: center;
|
|
172
|
-
flex-wrap: wrap;
|
|
173
|
-
gap: 3px;
|
|
130
|
+
@apply inline-flex items-center flex-wrap gap-[3px] min-w-0;
|
|
174
131
|
font: 400 12px/1.3 system-ui, sans-serif;
|
|
175
132
|
color: var(--ai-muted);
|
|
176
|
-
min-width: 0;
|
|
177
133
|
}
|
|
178
134
|
.markloom-doc .markloom-ai-block-hint.is-error { color: #f54a45; }
|
|
179
135
|
.markloom-doc .markloom-ai-block-loading { color: var(--ai-blue); }
|
|
180
|
-
.markloom-doc .markloom-ai-dot { opacity
|
|
136
|
+
.markloom-doc .markloom-ai-dot { @apply opacity-40 mx-px; }
|
|
181
137
|
.markloom-doc .markloom-ai-kbd {
|
|
182
|
-
|
|
183
|
-
align-items: center;
|
|
184
|
-
justify-content: center;
|
|
185
|
-
min-width: 1.2em;
|
|
186
|
-
height: 16px;
|
|
187
|
-
padding: 0 4px;
|
|
188
|
-
border: 0;
|
|
189
|
-
border-radius: 3px;
|
|
138
|
+
@apply inline-flex items-center justify-center min-w-[1.2em] h-4 px-1 border-0 rounded-sm;
|
|
190
139
|
background: rgba(31, 35, 41, 0.06);
|
|
191
140
|
font: 500 10px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
|
|
192
141
|
color: var(--ai-sub);
|
|
193
142
|
}
|
|
194
143
|
|
|
195
144
|
.markloom-doc .markloom-ai-block-acts {
|
|
196
|
-
|
|
197
|
-
align-items: center;
|
|
198
|
-
gap: 2px;
|
|
199
|
-
margin-left: auto;
|
|
200
|
-
flex: none;
|
|
145
|
+
@apply inline-flex items-center gap-0.5 ml-auto shrink-0;
|
|
201
146
|
}
|
|
202
147
|
.markloom-doc .markloom-ai-block-btn {
|
|
203
|
-
|
|
204
|
-
align-items: center;
|
|
205
|
-
justify-content: center;
|
|
206
|
-
height: 28px;
|
|
207
|
-
padding: 0 10px;
|
|
208
|
-
border: 0;
|
|
209
|
-
border-radius: 6px;
|
|
210
|
-
background: transparent;
|
|
148
|
+
@apply inline-flex items-center justify-center h-7 px-2.5 border-0 rounded-md bg-transparent cursor-pointer select-none;
|
|
211
149
|
font: 500 13px/1 system-ui, -apple-system, 'Segoe UI', sans-serif;
|
|
212
150
|
color: var(--ai-sub);
|
|
213
|
-
cursor: pointer;
|
|
214
|
-
user-select: none;
|
|
215
151
|
transition: background 0.1s ease, color 0.1s ease;
|
|
216
152
|
}
|
|
217
153
|
.markloom-doc .markloom-ai-block-btn:hover {
|
|
@@ -219,19 +155,16 @@
|
|
|
219
155
|
color: var(--ai-text);
|
|
220
156
|
}
|
|
221
157
|
.markloom-doc .markloom-ai-block-btn-icon {
|
|
222
|
-
|
|
223
|
-
padding: 0;
|
|
224
|
-
font-size: 16px;
|
|
225
|
-
font-weight: 400;
|
|
158
|
+
@apply w-7 p-0 text-base font-normal;
|
|
226
159
|
color: var(--ai-muted);
|
|
227
160
|
}
|
|
228
161
|
.markloom-doc .markloom-ai-block-btn-ghost,
|
|
229
162
|
.markloom-doc .markloom-ai-block-btn-soft {
|
|
230
|
-
|
|
163
|
+
@apply bg-transparent;
|
|
231
164
|
color: var(--ai-sub);
|
|
232
165
|
}
|
|
233
166
|
.markloom-doc .markloom-ai-block-btn-primary {
|
|
234
|
-
|
|
167
|
+
@apply bg-transparent;
|
|
235
168
|
color: var(--ai-blue);
|
|
236
169
|
}
|
|
237
170
|
.markloom-doc .markloom-ai-block-btn-primary:hover {
|
|
@@ -240,14 +173,10 @@
|
|
|
240
173
|
}
|
|
241
174
|
|
|
242
175
|
.markloom-doc .markloom-ai-spin {
|
|
243
|
-
|
|
244
|
-
width: 12px;
|
|
245
|
-
height: 12px;
|
|
176
|
+
@apply inline-block w-3 h-3 rounded-full shrink-0;
|
|
246
177
|
border: 1.5px solid currentColor;
|
|
247
178
|
border-right-color: transparent;
|
|
248
|
-
border-radius: 50%;
|
|
249
179
|
animation: markloom-ai-spin 0.7s linear infinite;
|
|
250
|
-
flex: none;
|
|
251
180
|
vertical-align: -1px;
|
|
252
181
|
}
|
|
253
182
|
@keyframes markloom-ai-spin {
|
|
@@ -285,7 +214,7 @@
|
|
|
285
214
|
}
|
|
286
215
|
.markloom-doc > [data-ai-draft],
|
|
287
216
|
.markloom-doc [data-ai-draft].markloom-ai-draft {
|
|
288
|
-
opacity: 0.
|
|
217
|
+
opacity: 0.9;
|
|
289
218
|
}
|
|
290
219
|
.markloom-doc p[data-ai-draft][data-ai-stream]::after {
|
|
291
220
|
background: #7aafff;
|
|
@@ -302,3 +231,38 @@
|
|
|
302
231
|
color: #ff8a85;
|
|
303
232
|
}
|
|
304
233
|
}
|
|
234
|
+
html.dark .markloom-doc .markloom-ai-block {
|
|
235
|
+
--ai-blue: #7aafff;
|
|
236
|
+
--ai-blue-soft: rgba(122, 175, 255, 0.12);
|
|
237
|
+
--ai-muted: rgba(255, 255, 255, 0.4);
|
|
238
|
+
--ai-text: rgba(255, 255, 255, 0.9);
|
|
239
|
+
--ai-sub: rgba(255, 255, 255, 0.6);
|
|
240
|
+
--ai-hover: rgba(255, 255, 255, 0.08);
|
|
241
|
+
--ai-fill: rgba(255, 255, 255, 0.06);
|
|
242
|
+
background: var(--ai-fill);
|
|
243
|
+
}
|
|
244
|
+
html.dark .markloom-doc .markloom-ai-block[data-status='loading'],
|
|
245
|
+
html.dark .markloom-doc .markloom-ai-block:focus-within {
|
|
246
|
+
background: rgba(122, 175, 255, 0.08);
|
|
247
|
+
}
|
|
248
|
+
html.dark .markloom-doc .markloom-ai-block[data-status='error'] {
|
|
249
|
+
background: rgba(245, 74, 69, 0.1);
|
|
250
|
+
}
|
|
251
|
+
html.dark .markloom-doc > [data-ai-draft],
|
|
252
|
+
html.dark .markloom-doc [data-ai-draft].markloom-ai-draft {
|
|
253
|
+
opacity: 0.9;
|
|
254
|
+
}
|
|
255
|
+
html.dark .markloom-doc p[data-ai-draft][data-ai-stream]::after {
|
|
256
|
+
background: #7aafff;
|
|
257
|
+
}
|
|
258
|
+
html.dark .markloom-doc .markloom-ai-kbd {
|
|
259
|
+
background: rgba(255, 255, 255, 0.08);
|
|
260
|
+
}
|
|
261
|
+
html.dark .markloom-doc .markloom-ai-block-btn-primary:hover {
|
|
262
|
+
background: var(--ai-blue-soft);
|
|
263
|
+
}
|
|
264
|
+
html.dark .markloom-doc .markloom-ai-block-err,
|
|
265
|
+
html.dark .markloom-doc .markloom-ai-block-hint.is-error,
|
|
266
|
+
html.dark .markloom-doc .markloom-ai-block-badge-error {
|
|
267
|
+
color: #ff8a85;
|
|
268
|
+
}
|