markloom 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 +125 -0
- package/dist/ai/index.cjs +19 -0
- package/dist/ai/index.d.cts +10 -0
- package/dist/ai/index.d.ts +10 -0
- package/dist/ai/index.js +19 -0
- package/dist/ai/theme.css +304 -0
- package/dist/chunk-2X6AF7XH.cjs +9030 -0
- package/dist/chunk-7Q6AXLF2.cjs +1076 -0
- package/dist/chunk-GUPMZI6Q.js +1076 -0
- package/dist/chunk-HA6XHJUD.cjs +218 -0
- package/dist/chunk-ITVAR2UM.js +218 -0
- package/dist/chunk-J3QWW6CN.js +2305 -0
- package/dist/chunk-UCNEQGMY.js +9030 -0
- package/dist/chunk-VVFIQLVR.cjs +2305 -0
- package/dist/comments-USjT1wYN.d.cts +105 -0
- package/dist/comments-USjT1wYN.d.ts +105 -0
- package/dist/controller-Dm4uLD3I.d.ts +507 -0
- package/dist/controller-cE9iEYp3.d.cts +507 -0
- package/dist/index.cjs +424 -0
- package/dist/index.d.cts +184 -0
- package/dist/index.d.ts +184 -0
- package/dist/index.js +424 -0
- package/dist/react/index.cjs +45 -0
- package/dist/react/index.d.cts +22 -0
- package/dist/react/index.d.ts +22 -0
- package/dist/react/index.js +45 -0
- package/dist/view/index.cjs +368 -0
- package/dist/view/index.d.cts +155 -0
- package/dist/view/index.d.ts +155 -0
- package/dist/view/index.js +368 -0
- package/dist/view/theme.css +2627 -0
- package/package.json +89 -0
package/README.md
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
# markloom
|
|
2
|
+
|
|
3
|
+
**The loom for Markdown** — rich text that stays honest with MD, and that AI can write into without a second model.
|
|
4
|
+
|
|
5
|
+
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
|
+
|
|
7
|
+
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.
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm i markloom
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
import { Editor } from 'markloom/view'
|
|
15
|
+
import 'markloom/view/theme.css'
|
|
16
|
+
|
|
17
|
+
const ed = new Editor(root, doc, {
|
|
18
|
+
onChange: d => save(d), // or persist with docToMd(d)
|
|
19
|
+
// optional: ai: { stream: yourStreamFn }
|
|
20
|
+
})
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## What you get
|
|
24
|
+
|
|
25
|
+
### 1. Markdown as a first-class citizen (lossless where it matters)
|
|
26
|
+
|
|
27
|
+
- **Tree ↔ Markdown isomorphism** via mdast: `mdToDoc` / `docToMd`.
|
|
28
|
+
- **Dirty-block local re-stringify**; clean blocks keep source **spans** so untouched prose doesn’t get reformatted away.
|
|
29
|
+
- Paste `text/plain` as MD; `text/html` as structured blocks — one pipeline, not two half-broken converters.
|
|
30
|
+
- AI and humans can both speak Markdown; the document remains a real tree (headings, lists, code, marks…), not a single string with hope.
|
|
31
|
+
|
|
32
|
+
This is not “we support export to `.md`.” The model is built so MD and the editor share the same shape.
|
|
33
|
+
|
|
34
|
+
### 2. Real structure, reversible edits
|
|
35
|
+
|
|
36
|
+
- Document = ordered tree under schema meta-bounds (depth / type budget) — expressive nested content without unbounded entropy.
|
|
37
|
+
- Every change is a **`Step`**: insert/delete text, replace node, splice children.
|
|
38
|
+
- **`apply ∘ invert = id`**: undo, history, and AI rollback are the same mechanism — not a parallel “AI history.”
|
|
39
|
+
- Stable **block ids** + path dual: agents address `id`, paths move when structure moves.
|
|
40
|
+
- **`diffById`**: block-level added / changed / removed / same for accept–reject UIs.
|
|
41
|
+
|
|
42
|
+
### 3. Fully controlled editor (DOM is projection)
|
|
43
|
+
|
|
44
|
+
- `markloom/view`: Preact, `contentEditable` fully owned via `beforeinput` → Steps.
|
|
45
|
+
- Model is the only truth; DOM cannot drift into a second document.
|
|
46
|
+
- IME handled as a first-class path (composition aligned to the model, not “hope the browser is fine”).
|
|
47
|
+
- Slash menu, bubble format bar, drag handle, gaps around atoms — product surface without forking the kernel.
|
|
48
|
+
|
|
49
|
+
### 4. AI write as a document transaction (not a floating card)
|
|
50
|
+
|
|
51
|
+
When you enable AI, generation is still the same tree and history:
|
|
52
|
+
|
|
53
|
+
| Step | What happens |
|
|
54
|
+
|------|----------------|
|
|
55
|
+
| `/ai` or format bar | In-doc prompt shell |
|
|
56
|
+
| Enter / stream | **Real top-level blocks** enter the body (faded = uncommitted) |
|
|
57
|
+
| Live preview | MD soft-close + `mdToDoc` each frame → rich structure while streaming |
|
|
58
|
+
| Accept | Strip draft marks, remove shell — **no second insert** |
|
|
59
|
+
| Discard | **`undo` the whole transaction** (one past entry) |
|
|
60
|
+
|
|
61
|
+
AI is strong because the rest of the model is strong — ids, Steps, MD, history — not because of a chat overlay.
|
|
62
|
+
|
|
63
|
+
### 5. Use the piece you need
|
|
64
|
+
|
|
65
|
+
```
|
|
66
|
+
markloom tree, Steps, history, MD, appendText / diffById
|
|
67
|
+
markloom/view editor + view/theme.css
|
|
68
|
+
markloom/ai AI controller + stream helper + ai/theme.css
|
|
69
|
+
markloom/react optional React wrapper (peer react, optional)
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
**Kernel only** (agents, SSG, no browser):
|
|
73
|
+
|
|
74
|
+
```ts
|
|
75
|
+
import { apply, appendText, mdToDoc, docToMd, diffById } from 'markloom'
|
|
76
|
+
|
|
77
|
+
const doc = mdToDoc(source)
|
|
78
|
+
const next = apply(doc, appendText(doc, blockId, token))
|
|
79
|
+
await save(docToMd(next))
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
**Editor + AI** (product):
|
|
83
|
+
|
|
84
|
+
```ts
|
|
85
|
+
import { Editor } from 'markloom/view'
|
|
86
|
+
import 'markloom/view/theme.css'
|
|
87
|
+
import 'markloom/ai/theme.css'
|
|
88
|
+
|
|
89
|
+
new Editor(el, doc, {
|
|
90
|
+
onChange: d => save(docToMd(d)),
|
|
91
|
+
ai: {
|
|
92
|
+
stream: async (input, onToken) => {
|
|
93
|
+
// your model or proxy
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
})
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## Why this stack
|
|
100
|
+
|
|
101
|
+
| Problem | Typical approach | markloom |
|
|
102
|
+
|---------|------------------|----------|
|
|
103
|
+
| MD round-trip ruins formatting | Best-effort export | Isomorphic projection + clean-block spans |
|
|
104
|
+
| AI preview ≠ document | Overlay then paste | Stream into real blocks; accept = commit |
|
|
105
|
+
| Undo of AI is messy | Multiple history systems | One `Step` history; AI amend + undo |
|
|
106
|
+
| Agent can’t address blocks | CSS selectors / offsets | Stable `id` + `pathOfId` |
|
|
107
|
+
| Want headless transforms | Fork the editor | Zero-DOM kernel |
|
|
108
|
+
|
|
109
|
+
## Runtime dependencies
|
|
110
|
+
|
|
111
|
+
Preact, `@floating-ui/dom`, unified/mdast GFM (`mdast-util-*`, `micromark-extension-gfm`).
|
|
112
|
+
**No ProseMirror / Tiptap.**
|
|
113
|
+
|
|
114
|
+
| Optional | When |
|
|
115
|
+
|----------|------|
|
|
116
|
+
| `react` ≥ 18 | Only if you use `markloom/react` |
|
|
117
|
+
|
|
118
|
+
## Limits (honest)
|
|
119
|
+
|
|
120
|
+
- Collaboration wire protocol (Yjs/OT network) not shipped; `map` / `rebase` foundations are in the kernel.
|
|
121
|
+
- Tables are **atoms** (full grid model inside; not free nesting in the prose grammar).
|
|
122
|
+
|
|
123
|
+
## License
|
|
124
|
+
|
|
125
|
+
MIT
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
var _chunk7Q6AXLF2cjs = require('../chunk-7Q6AXLF2.cjs');
|
|
10
|
+
require('../chunk-VVFIQLVR.cjs');
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
exports.LoomAi = _chunk7Q6AXLF2cjs.LoomAi; exports.aiInstructionFromQuery = _chunk7Q6AXLF2cjs.aiInstructionFromQuery; exports.blockPlainText = _chunk7Q6AXLF2cjs.blockPlainText; exports.createAiStream = _chunk7Q6AXLF2cjs.createAiStream; exports.focusBlockId = _chunk7Q6AXLF2cjs.focusBlockId; exports.precedingPlainText = _chunk7Q6AXLF2cjs.precedingPlainText; exports.startAiWrite = _chunk7Q6AXLF2cjs.startAiWrite;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { A as AiConfig, a as AiPromptMode, b as AiProvider, c as AiStreamFn, d as AiStreamInput, e as AiWriteMode, f as AiWriteSession, L as LoomAi, g as LoomAiOpts, h as blockPlainText, i as createAiStream, j as focusBlockId, s as startAiWrite } from '../controller-cE9iEYp3.cjs';
|
|
2
|
+
import { E as ElementNode } from '../comments-USjT1wYN.cjs';
|
|
3
|
+
import 'preact';
|
|
4
|
+
|
|
5
|
+
/** 顶层块 [0, blockIdx) 纯文本拼接(作 /ai 上下文) */
|
|
6
|
+
declare function precedingPlainText(doc: ElementNode, blockIdx: number): string;
|
|
7
|
+
/** `/ai` / `ai 写长一点` → 后缀指令 */
|
|
8
|
+
declare function aiInstructionFromQuery(query: string): string;
|
|
9
|
+
|
|
10
|
+
export { aiInstructionFromQuery, precedingPlainText };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { A as AiConfig, a as AiPromptMode, b as AiProvider, c as AiStreamFn, d as AiStreamInput, e as AiWriteMode, f as AiWriteSession, L as LoomAi, g as LoomAiOpts, h as blockPlainText, i as createAiStream, j as focusBlockId, s as startAiWrite } from '../controller-Dm4uLD3I.js';
|
|
2
|
+
import { E as ElementNode } from '../comments-USjT1wYN.js';
|
|
3
|
+
import 'preact';
|
|
4
|
+
|
|
5
|
+
/** 顶层块 [0, blockIdx) 纯文本拼接(作 /ai 上下文) */
|
|
6
|
+
declare function precedingPlainText(doc: ElementNode, blockIdx: number): string;
|
|
7
|
+
/** `/ai` / `ai 写长一点` → 后缀指令 */
|
|
8
|
+
declare function aiInstructionFromQuery(query: string): string;
|
|
9
|
+
|
|
10
|
+
export { aiInstructionFromQuery, precedingPlainText };
|
package/dist/ai/index.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import {
|
|
2
|
+
LoomAi,
|
|
3
|
+
aiInstructionFromQuery,
|
|
4
|
+
blockPlainText,
|
|
5
|
+
createAiStream,
|
|
6
|
+
focusBlockId,
|
|
7
|
+
precedingPlainText,
|
|
8
|
+
startAiWrite
|
|
9
|
+
} from "../chunk-GUPMZI6Q.js";
|
|
10
|
+
import "../chunk-J3QWW6CN.js";
|
|
11
|
+
export {
|
|
12
|
+
LoomAi,
|
|
13
|
+
aiInstructionFromQuery,
|
|
14
|
+
blockPlainText,
|
|
15
|
+
createAiStream,
|
|
16
|
+
focusBlockId,
|
|
17
|
+
precedingPlainText,
|
|
18
|
+
startAiWrite
|
|
19
|
+
};
|
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
/* loom/ai — 飞书式无边框;生成结果是正文流里的真段落,确认前 opacity 淡化 */
|
|
2
|
+
|
|
3
|
+
.loom-doc .loom-ai-block {
|
|
4
|
+
--ai-blue: #3370ff;
|
|
5
|
+
--ai-blue-soft: #e8f3ff;
|
|
6
|
+
--ai-muted: #8f959e;
|
|
7
|
+
--ai-text: #1f2329;
|
|
8
|
+
--ai-sub: #646a73;
|
|
9
|
+
--ai-hover: #eff0f1;
|
|
10
|
+
--ai-fill: #f5f6f7;
|
|
11
|
+
position: relative;
|
|
12
|
+
margin: 0.5rem 0 0.25rem;
|
|
13
|
+
padding: 10px 12px 8px;
|
|
14
|
+
border: 0;
|
|
15
|
+
border-radius: 8px;
|
|
16
|
+
background: var(--ai-fill);
|
|
17
|
+
box-shadow: none;
|
|
18
|
+
outline: none;
|
|
19
|
+
animation: loom-ai-in 0.14s ease-out;
|
|
20
|
+
}
|
|
21
|
+
.loom-doc .loom-ai-block[data-status='loading'] {
|
|
22
|
+
background: #f2f5ff;
|
|
23
|
+
}
|
|
24
|
+
.loom-doc .loom-ai-block[data-status='preview'] {
|
|
25
|
+
background: #f5f6f7;
|
|
26
|
+
}
|
|
27
|
+
.loom-doc .loom-ai-block[data-status='error'] {
|
|
28
|
+
background: #fef3f2;
|
|
29
|
+
}
|
|
30
|
+
.loom-doc .loom-ai-block:focus-within {
|
|
31
|
+
background: #f0f4ff;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
@keyframes loom-ai-in {
|
|
35
|
+
from { opacity: 0; transform: translateY(3px); }
|
|
36
|
+
to { opacity: 1; transform: none; }
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/* ── header ── */
|
|
40
|
+
.loom-doc .loom-ai-block-hd {
|
|
41
|
+
display: flex;
|
|
42
|
+
align-items: center;
|
|
43
|
+
justify-content: space-between;
|
|
44
|
+
gap: 8px;
|
|
45
|
+
padding: 0 0 2px;
|
|
46
|
+
user-select: none;
|
|
47
|
+
}
|
|
48
|
+
.loom-doc .loom-ai-block-brand {
|
|
49
|
+
display: inline-flex;
|
|
50
|
+
align-items: center;
|
|
51
|
+
gap: 6px;
|
|
52
|
+
min-width: 0;
|
|
53
|
+
}
|
|
54
|
+
.loom-doc .loom-ai-block-ico {
|
|
55
|
+
display: inline-flex;
|
|
56
|
+
align-items: center;
|
|
57
|
+
justify-content: center;
|
|
58
|
+
width: 20px;
|
|
59
|
+
height: 20px;
|
|
60
|
+
color: var(--ai-blue);
|
|
61
|
+
flex: none;
|
|
62
|
+
}
|
|
63
|
+
.loom-doc .loom-ai-block-svg {
|
|
64
|
+
display: block;
|
|
65
|
+
stroke-width: 1.75;
|
|
66
|
+
}
|
|
67
|
+
.loom-doc .loom-ai-block-title {
|
|
68
|
+
font: 500 13px/1.2 system-ui, -apple-system, 'Segoe UI', sans-serif;
|
|
69
|
+
color: var(--ai-blue);
|
|
70
|
+
}
|
|
71
|
+
.loom-doc .loom-ai-block-badge {
|
|
72
|
+
display: inline-flex;
|
|
73
|
+
align-items: center;
|
|
74
|
+
gap: 4px;
|
|
75
|
+
margin-left: 2px;
|
|
76
|
+
font: 400 12px/1.2 system-ui, sans-serif;
|
|
77
|
+
color: var(--ai-muted);
|
|
78
|
+
}
|
|
79
|
+
.loom-doc .loom-ai-block-badge-loading { color: var(--ai-blue); }
|
|
80
|
+
.loom-doc .loom-ai-block-badge-error { color: #f54a45; }
|
|
81
|
+
|
|
82
|
+
.loom-doc .loom-ai-block-seed {
|
|
83
|
+
display: flex;
|
|
84
|
+
align-items: baseline;
|
|
85
|
+
gap: 8px;
|
|
86
|
+
margin: 6px 0 0;
|
|
87
|
+
max-height: 1.4em;
|
|
88
|
+
overflow: hidden;
|
|
89
|
+
}
|
|
90
|
+
.loom-doc .loom-ai-block-seed-lab {
|
|
91
|
+
flex: none;
|
|
92
|
+
font: 400 12px/1.4 system-ui, sans-serif;
|
|
93
|
+
color: var(--ai-muted);
|
|
94
|
+
}
|
|
95
|
+
.loom-doc .loom-ai-block-seed-txt {
|
|
96
|
+
font: 400 12px/1.4 system-ui, sans-serif;
|
|
97
|
+
color: var(--ai-sub);
|
|
98
|
+
overflow: hidden;
|
|
99
|
+
text-overflow: ellipsis;
|
|
100
|
+
white-space: nowrap;
|
|
101
|
+
min-width: 0;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/* 指令 */
|
|
105
|
+
.loom-doc .loom-ai-block > p.loom-ai-prompt {
|
|
106
|
+
margin: 6px 0 4px;
|
|
107
|
+
padding: 4px 0;
|
|
108
|
+
min-height: 1.5em;
|
|
109
|
+
border: 0 !important;
|
|
110
|
+
background: transparent !important;
|
|
111
|
+
box-shadow: none !important;
|
|
112
|
+
font: 400 14px/1.6 system-ui, -apple-system, 'Segoe UI', sans-serif;
|
|
113
|
+
color: var(--ai-text);
|
|
114
|
+
}
|
|
115
|
+
.loom-doc .loom-ai-block[data-status='loading'] > p.loom-ai-prompt {
|
|
116
|
+
opacity: 0.5;
|
|
117
|
+
pointer-events: none;
|
|
118
|
+
}
|
|
119
|
+
.loom-doc .loom-ai-block > p.loom-ai-prompt[data-placeholder]::before {
|
|
120
|
+
content: attr(data-placeholder);
|
|
121
|
+
color: var(--ai-muted);
|
|
122
|
+
pointer-events: none;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/*
|
|
126
|
+
* 生成结果 = 文档顶层真块(段/标题/列表/代码/引用…)。
|
|
127
|
+
* 确认前 opacity 淡化;确认后去掉 data-ai-draft。
|
|
128
|
+
*/
|
|
129
|
+
.loom-doc > [data-ai-draft],
|
|
130
|
+
.loom-doc [data-ai-draft].loom-ai-draft {
|
|
131
|
+
opacity: 0.5;
|
|
132
|
+
transition: opacity 0.18s ease;
|
|
133
|
+
}
|
|
134
|
+
/* 列表/引用整体淡化时子元素别再叠一层 */
|
|
135
|
+
.loom-doc [data-ai-draft] [data-ai-draft] {
|
|
136
|
+
opacity: 1;
|
|
137
|
+
}
|
|
138
|
+
/* 流式末段光标(物化前的源码段) */
|
|
139
|
+
.loom-doc > p[data-ai-draft][data-ai-stream]::after,
|
|
140
|
+
.loom-doc p[data-ai-draft][data-ai-stream]::after {
|
|
141
|
+
content: '';
|
|
142
|
+
display: inline-block;
|
|
143
|
+
width: 2px;
|
|
144
|
+
height: 1em;
|
|
145
|
+
margin-left: 2px;
|
|
146
|
+
background: #3370ff;
|
|
147
|
+
vertical-align: text-bottom;
|
|
148
|
+
animation: loom-ai-caret 0.9s steps(1) infinite;
|
|
149
|
+
}
|
|
150
|
+
@keyframes loom-ai-caret {
|
|
151
|
+
50% { opacity: 0; }
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
.loom-doc .loom-ai-block-err {
|
|
155
|
+
margin: 4px 0 0;
|
|
156
|
+
font: 400 13px/1.45 system-ui, sans-serif;
|
|
157
|
+
color: #f54a45;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/* footer */
|
|
161
|
+
.loom-doc .loom-ai-block-ft {
|
|
162
|
+
display: flex;
|
|
163
|
+
align-items: center;
|
|
164
|
+
justify-content: space-between;
|
|
165
|
+
gap: 10px;
|
|
166
|
+
padding: 6px 0 0;
|
|
167
|
+
min-height: 32px;
|
|
168
|
+
}
|
|
169
|
+
.loom-doc .loom-ai-block-hint {
|
|
170
|
+
display: inline-flex;
|
|
171
|
+
align-items: center;
|
|
172
|
+
flex-wrap: wrap;
|
|
173
|
+
gap: 3px;
|
|
174
|
+
font: 400 12px/1.3 system-ui, sans-serif;
|
|
175
|
+
color: var(--ai-muted);
|
|
176
|
+
min-width: 0;
|
|
177
|
+
}
|
|
178
|
+
.loom-doc .loom-ai-block-hint.is-error { color: #f54a45; }
|
|
179
|
+
.loom-doc .loom-ai-block-loading { color: var(--ai-blue); }
|
|
180
|
+
.loom-doc .loom-ai-dot { opacity: 0.4; margin: 0 1px; }
|
|
181
|
+
.loom-doc .loom-ai-kbd {
|
|
182
|
+
display: inline-flex;
|
|
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;
|
|
190
|
+
background: rgba(31, 35, 41, 0.06);
|
|
191
|
+
font: 500 10px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
|
|
192
|
+
color: var(--ai-sub);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
.loom-doc .loom-ai-block-acts {
|
|
196
|
+
display: inline-flex;
|
|
197
|
+
align-items: center;
|
|
198
|
+
gap: 2px;
|
|
199
|
+
margin-left: auto;
|
|
200
|
+
flex: none;
|
|
201
|
+
}
|
|
202
|
+
.loom-doc .loom-ai-block-btn {
|
|
203
|
+
display: inline-flex;
|
|
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;
|
|
211
|
+
font: 500 13px/1 system-ui, -apple-system, 'Segoe UI', sans-serif;
|
|
212
|
+
color: var(--ai-sub);
|
|
213
|
+
cursor: pointer;
|
|
214
|
+
user-select: none;
|
|
215
|
+
transition: background 0.1s ease, color 0.1s ease;
|
|
216
|
+
}
|
|
217
|
+
.loom-doc .loom-ai-block-btn:hover {
|
|
218
|
+
background: var(--ai-hover);
|
|
219
|
+
color: var(--ai-text);
|
|
220
|
+
}
|
|
221
|
+
.loom-doc .loom-ai-block-btn-icon {
|
|
222
|
+
width: 28px;
|
|
223
|
+
padding: 0;
|
|
224
|
+
font-size: 16px;
|
|
225
|
+
font-weight: 400;
|
|
226
|
+
color: var(--ai-muted);
|
|
227
|
+
}
|
|
228
|
+
.loom-doc .loom-ai-block-btn-ghost,
|
|
229
|
+
.loom-doc .loom-ai-block-btn-soft {
|
|
230
|
+
background: transparent;
|
|
231
|
+
color: var(--ai-sub);
|
|
232
|
+
}
|
|
233
|
+
.loom-doc .loom-ai-block-btn-primary {
|
|
234
|
+
background: transparent;
|
|
235
|
+
color: var(--ai-blue);
|
|
236
|
+
}
|
|
237
|
+
.loom-doc .loom-ai-block-btn-primary:hover {
|
|
238
|
+
background: var(--ai-blue-soft);
|
|
239
|
+
color: var(--ai-blue);
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
.loom-doc .loom-ai-spin {
|
|
243
|
+
display: inline-block;
|
|
244
|
+
width: 12px;
|
|
245
|
+
height: 12px;
|
|
246
|
+
border: 1.5px solid currentColor;
|
|
247
|
+
border-right-color: transparent;
|
|
248
|
+
border-radius: 50%;
|
|
249
|
+
animation: loom-ai-spin 0.7s linear infinite;
|
|
250
|
+
flex: none;
|
|
251
|
+
vertical-align: -1px;
|
|
252
|
+
}
|
|
253
|
+
@keyframes loom-ai-spin {
|
|
254
|
+
to { transform: rotate(360deg); }
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
@media (prefers-reduced-motion: reduce) {
|
|
258
|
+
.loom-doc .loom-ai-block,
|
|
259
|
+
.loom-doc .loom-ai-spin,
|
|
260
|
+
.loom-doc p[data-ai-draft][data-ai-stream]::after {
|
|
261
|
+
animation: none !important;
|
|
262
|
+
}
|
|
263
|
+
.loom-doc p[data-ai-draft] {
|
|
264
|
+
transition: none;
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
@media (prefers-color-scheme: dark) {
|
|
269
|
+
.loom-doc .loom-ai-block {
|
|
270
|
+
--ai-blue: #7aafff;
|
|
271
|
+
--ai-blue-soft: rgba(122, 175, 255, 0.12);
|
|
272
|
+
--ai-muted: rgba(255, 255, 255, 0.4);
|
|
273
|
+
--ai-text: rgba(255, 255, 255, 0.9);
|
|
274
|
+
--ai-sub: rgba(255, 255, 255, 0.6);
|
|
275
|
+
--ai-hover: rgba(255, 255, 255, 0.08);
|
|
276
|
+
--ai-fill: rgba(255, 255, 255, 0.06);
|
|
277
|
+
background: var(--ai-fill);
|
|
278
|
+
}
|
|
279
|
+
.loom-doc .loom-ai-block[data-status='loading'],
|
|
280
|
+
.loom-doc .loom-ai-block:focus-within {
|
|
281
|
+
background: rgba(122, 175, 255, 0.08);
|
|
282
|
+
}
|
|
283
|
+
.loom-doc .loom-ai-block[data-status='error'] {
|
|
284
|
+
background: rgba(245, 74, 69, 0.1);
|
|
285
|
+
}
|
|
286
|
+
.loom-doc > [data-ai-draft],
|
|
287
|
+
.loom-doc [data-ai-draft].loom-ai-draft {
|
|
288
|
+
opacity: 0.55;
|
|
289
|
+
}
|
|
290
|
+
.loom-doc p[data-ai-draft][data-ai-stream]::after {
|
|
291
|
+
background: #7aafff;
|
|
292
|
+
}
|
|
293
|
+
.loom-doc .loom-ai-kbd {
|
|
294
|
+
background: rgba(255, 255, 255, 0.08);
|
|
295
|
+
}
|
|
296
|
+
.loom-doc .loom-ai-block-btn-primary:hover {
|
|
297
|
+
background: var(--ai-blue-soft);
|
|
298
|
+
}
|
|
299
|
+
.loom-doc .loom-ai-block-err,
|
|
300
|
+
.loom-doc .loom-ai-block-hint.is-error,
|
|
301
|
+
.loom-doc .loom-ai-block-badge-error {
|
|
302
|
+
color: #ff8a85;
|
|
303
|
+
}
|
|
304
|
+
}
|