markloom 0.3.0 → 0.4.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/dist/ai/index.cjs CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
 
8
8
 
9
- var _chunk7Q6AXLF2cjs = require('../chunk-7Q6AXLF2.cjs');
9
+ var _chunkLNSKDJMFcjs = require('../chunk-LNSKDJMF.cjs');
10
10
  require('../chunk-VVFIQLVR.cjs');
11
11
 
12
12
 
@@ -16,4 +16,4 @@ require('../chunk-VVFIQLVR.cjs');
16
16
 
17
17
 
18
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;
19
+ exports.MarkloomAi = _chunkLNSKDJMFcjs.MarkloomAi; exports.aiInstructionFromQuery = _chunkLNSKDJMFcjs.aiInstructionFromQuery; exports.blockPlainText = _chunkLNSKDJMFcjs.blockPlainText; exports.createAiStream = _chunkLNSKDJMFcjs.createAiStream; exports.focusBlockId = _chunkLNSKDJMFcjs.focusBlockId; exports.precedingPlainText = _chunkLNSKDJMFcjs.precedingPlainText; exports.startAiWrite = _chunkLNSKDJMFcjs.startAiWrite;
@@ -1,4 +1,4 @@
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';
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-Cd1Dprrk.cjs';
2
2
  import { E as ElementNode } from '../comments-USjT1wYN.cjs';
3
3
  import 'preact';
4
4
 
@@ -1,4 +1,4 @@
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';
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-B_wG2Wh-.js';
2
2
  import { E as ElementNode } from '../comments-USjT1wYN.js';
3
3
  import 'preact';
4
4
 
package/dist/ai/index.js CHANGED
@@ -1,15 +1,15 @@
1
1
  import {
2
- LoomAi,
2
+ MarkloomAi,
3
3
  aiInstructionFromQuery,
4
4
  blockPlainText,
5
5
  createAiStream,
6
6
  focusBlockId,
7
7
  precedingPlainText,
8
8
  startAiWrite
9
- } from "../chunk-GUPMZI6Q.js";
9
+ } from "../chunk-QXJHFQLJ.js";
10
10
  import "../chunk-J3QWW6CN.js";
11
11
  export {
12
- LoomAi,
12
+ MarkloomAi,
13
13
  aiInstructionFromQuery,
14
14
  blockPlainText,
15
15
  createAiStream,
package/dist/ai/theme.css CHANGED
@@ -1,6 +1,6 @@
1
- /* loom/ai — 飞书式无边框;生成结果是正文流里的真段落,确认前 opacity 淡化 */
1
+ /* markloom/ai — 飞书式无边框;生成结果是正文流里的真段落,确认前 opacity 淡化 */
2
2
 
3
- .loom-doc .loom-ai-block {
3
+ .markloom-doc .markloom-ai-block {
4
4
  --ai-blue: #3370ff;
5
5
  --ai-blue-soft: #e8f3ff;
6
6
  --ai-muted: #8f959e;
@@ -16,28 +16,28 @@
16
16
  background: var(--ai-fill);
17
17
  box-shadow: none;
18
18
  outline: none;
19
- animation: loom-ai-in 0.14s ease-out;
19
+ animation: markloom-ai-in 0.14s ease-out;
20
20
  }
21
- .loom-doc .loom-ai-block[data-status='loading'] {
21
+ .markloom-doc .markloom-ai-block[data-status='loading'] {
22
22
  background: #f2f5ff;
23
23
  }
24
- .loom-doc .loom-ai-block[data-status='preview'] {
24
+ .markloom-doc .markloom-ai-block[data-status='preview'] {
25
25
  background: #f5f6f7;
26
26
  }
27
- .loom-doc .loom-ai-block[data-status='error'] {
27
+ .markloom-doc .markloom-ai-block[data-status='error'] {
28
28
  background: #fef3f2;
29
29
  }
30
- .loom-doc .loom-ai-block:focus-within {
30
+ .markloom-doc .markloom-ai-block:focus-within {
31
31
  background: #f0f4ff;
32
32
  }
33
33
 
34
- @keyframes loom-ai-in {
34
+ @keyframes markloom-ai-in {
35
35
  from { opacity: 0; transform: translateY(3px); }
36
36
  to { opacity: 1; transform: none; }
37
37
  }
38
38
 
39
39
  /* ── header ── */
40
- .loom-doc .loom-ai-block-hd {
40
+ .markloom-doc .markloom-ai-block-hd {
41
41
  display: flex;
42
42
  align-items: center;
43
43
  justify-content: space-between;
@@ -45,13 +45,13 @@
45
45
  padding: 0 0 2px;
46
46
  user-select: none;
47
47
  }
48
- .loom-doc .loom-ai-block-brand {
48
+ .markloom-doc .markloom-ai-block-brand {
49
49
  display: inline-flex;
50
50
  align-items: center;
51
51
  gap: 6px;
52
52
  min-width: 0;
53
53
  }
54
- .loom-doc .loom-ai-block-ico {
54
+ .markloom-doc .markloom-ai-block-ico {
55
55
  display: inline-flex;
56
56
  align-items: center;
57
57
  justify-content: center;
@@ -60,15 +60,15 @@
60
60
  color: var(--ai-blue);
61
61
  flex: none;
62
62
  }
63
- .loom-doc .loom-ai-block-svg {
63
+ .markloom-doc .markloom-ai-block-svg {
64
64
  display: block;
65
65
  stroke-width: 1.75;
66
66
  }
67
- .loom-doc .loom-ai-block-title {
67
+ .markloom-doc .markloom-ai-block-title {
68
68
  font: 500 13px/1.2 system-ui, -apple-system, 'Segoe UI', sans-serif;
69
69
  color: var(--ai-blue);
70
70
  }
71
- .loom-doc .loom-ai-block-badge {
71
+ .markloom-doc .markloom-ai-block-badge {
72
72
  display: inline-flex;
73
73
  align-items: center;
74
74
  gap: 4px;
@@ -76,10 +76,10 @@
76
76
  font: 400 12px/1.2 system-ui, sans-serif;
77
77
  color: var(--ai-muted);
78
78
  }
79
- .loom-doc .loom-ai-block-badge-loading { color: var(--ai-blue); }
80
- .loom-doc .loom-ai-block-badge-error { color: #f54a45; }
79
+ .markloom-doc .markloom-ai-block-badge-loading { color: var(--ai-blue); }
80
+ .markloom-doc .markloom-ai-block-badge-error { color: #f54a45; }
81
81
 
82
- .loom-doc .loom-ai-block-seed {
82
+ .markloom-doc .markloom-ai-block-seed {
83
83
  display: flex;
84
84
  align-items: baseline;
85
85
  gap: 8px;
@@ -87,12 +87,12 @@
87
87
  max-height: 1.4em;
88
88
  overflow: hidden;
89
89
  }
90
- .loom-doc .loom-ai-block-seed-lab {
90
+ .markloom-doc .markloom-ai-block-seed-lab {
91
91
  flex: none;
92
92
  font: 400 12px/1.4 system-ui, sans-serif;
93
93
  color: var(--ai-muted);
94
94
  }
95
- .loom-doc .loom-ai-block-seed-txt {
95
+ .markloom-doc .markloom-ai-block-seed-txt {
96
96
  font: 400 12px/1.4 system-ui, sans-serif;
97
97
  color: var(--ai-sub);
98
98
  overflow: hidden;
@@ -102,7 +102,7 @@
102
102
  }
103
103
 
104
104
  /* 指令 */
105
- .loom-doc .loom-ai-block > p.loom-ai-prompt {
105
+ .markloom-doc .markloom-ai-block > p.markloom-ai-prompt {
106
106
  margin: 6px 0 4px;
107
107
  padding: 4px 0;
108
108
  min-height: 1.5em;
@@ -112,11 +112,11 @@
112
112
  font: 400 14px/1.6 system-ui, -apple-system, 'Segoe UI', sans-serif;
113
113
  color: var(--ai-text);
114
114
  }
115
- .loom-doc .loom-ai-block[data-status='loading'] > p.loom-ai-prompt {
115
+ .markloom-doc .markloom-ai-block[data-status='loading'] > p.markloom-ai-prompt {
116
116
  opacity: 0.5;
117
117
  pointer-events: none;
118
118
  }
119
- .loom-doc .loom-ai-block > p.loom-ai-prompt[data-placeholder]::before {
119
+ .markloom-doc .markloom-ai-block > p.markloom-ai-prompt[data-placeholder]::before {
120
120
  content: attr(data-placeholder);
121
121
  color: var(--ai-muted);
122
122
  pointer-events: none;
@@ -126,18 +126,18 @@
126
126
  * 生成结果 = 文档顶层真块(段/标题/列表/代码/引用…)。
127
127
  * 确认前 opacity 淡化;确认后去掉 data-ai-draft。
128
128
  */
129
- .loom-doc > [data-ai-draft],
130
- .loom-doc [data-ai-draft].loom-ai-draft {
129
+ .markloom-doc > [data-ai-draft],
130
+ .markloom-doc [data-ai-draft].markloom-ai-draft {
131
131
  opacity: 0.5;
132
132
  transition: opacity 0.18s ease;
133
133
  }
134
134
  /* 列表/引用整体淡化时子元素别再叠一层 */
135
- .loom-doc [data-ai-draft] [data-ai-draft] {
135
+ .markloom-doc [data-ai-draft] [data-ai-draft] {
136
136
  opacity: 1;
137
137
  }
138
138
  /* 流式末段光标(物化前的源码段) */
139
- .loom-doc > p[data-ai-draft][data-ai-stream]::after,
140
- .loom-doc p[data-ai-draft][data-ai-stream]::after {
139
+ .markloom-doc > p[data-ai-draft][data-ai-stream]::after,
140
+ .markloom-doc p[data-ai-draft][data-ai-stream]::after {
141
141
  content: '';
142
142
  display: inline-block;
143
143
  width: 2px;
@@ -145,20 +145,20 @@
145
145
  margin-left: 2px;
146
146
  background: #3370ff;
147
147
  vertical-align: text-bottom;
148
- animation: loom-ai-caret 0.9s steps(1) infinite;
148
+ animation: markloom-ai-caret 0.9s steps(1) infinite;
149
149
  }
150
- @keyframes loom-ai-caret {
150
+ @keyframes markloom-ai-caret {
151
151
  50% { opacity: 0; }
152
152
  }
153
153
 
154
- .loom-doc .loom-ai-block-err {
154
+ .markloom-doc .markloom-ai-block-err {
155
155
  margin: 4px 0 0;
156
156
  font: 400 13px/1.45 system-ui, sans-serif;
157
157
  color: #f54a45;
158
158
  }
159
159
 
160
160
  /* footer */
161
- .loom-doc .loom-ai-block-ft {
161
+ .markloom-doc .markloom-ai-block-ft {
162
162
  display: flex;
163
163
  align-items: center;
164
164
  justify-content: space-between;
@@ -166,7 +166,7 @@
166
166
  padding: 6px 0 0;
167
167
  min-height: 32px;
168
168
  }
169
- .loom-doc .loom-ai-block-hint {
169
+ .markloom-doc .markloom-ai-block-hint {
170
170
  display: inline-flex;
171
171
  align-items: center;
172
172
  flex-wrap: wrap;
@@ -175,10 +175,10 @@
175
175
  color: var(--ai-muted);
176
176
  min-width: 0;
177
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 {
178
+ .markloom-doc .markloom-ai-block-hint.is-error { color: #f54a45; }
179
+ .markloom-doc .markloom-ai-block-loading { color: var(--ai-blue); }
180
+ .markloom-doc .markloom-ai-dot { opacity: 0.4; margin: 0 1px; }
181
+ .markloom-doc .markloom-ai-kbd {
182
182
  display: inline-flex;
183
183
  align-items: center;
184
184
  justify-content: center;
@@ -192,14 +192,14 @@
192
192
  color: var(--ai-sub);
193
193
  }
194
194
 
195
- .loom-doc .loom-ai-block-acts {
195
+ .markloom-doc .markloom-ai-block-acts {
196
196
  display: inline-flex;
197
197
  align-items: center;
198
198
  gap: 2px;
199
199
  margin-left: auto;
200
200
  flex: none;
201
201
  }
202
- .loom-doc .loom-ai-block-btn {
202
+ .markloom-doc .markloom-ai-block-btn {
203
203
  display: inline-flex;
204
204
  align-items: center;
205
205
  justify-content: center;
@@ -214,59 +214,59 @@
214
214
  user-select: none;
215
215
  transition: background 0.1s ease, color 0.1s ease;
216
216
  }
217
- .loom-doc .loom-ai-block-btn:hover {
217
+ .markloom-doc .markloom-ai-block-btn:hover {
218
218
  background: var(--ai-hover);
219
219
  color: var(--ai-text);
220
220
  }
221
- .loom-doc .loom-ai-block-btn-icon {
221
+ .markloom-doc .markloom-ai-block-btn-icon {
222
222
  width: 28px;
223
223
  padding: 0;
224
224
  font-size: 16px;
225
225
  font-weight: 400;
226
226
  color: var(--ai-muted);
227
227
  }
228
- .loom-doc .loom-ai-block-btn-ghost,
229
- .loom-doc .loom-ai-block-btn-soft {
228
+ .markloom-doc .markloom-ai-block-btn-ghost,
229
+ .markloom-doc .markloom-ai-block-btn-soft {
230
230
  background: transparent;
231
231
  color: var(--ai-sub);
232
232
  }
233
- .loom-doc .loom-ai-block-btn-primary {
233
+ .markloom-doc .markloom-ai-block-btn-primary {
234
234
  background: transparent;
235
235
  color: var(--ai-blue);
236
236
  }
237
- .loom-doc .loom-ai-block-btn-primary:hover {
237
+ .markloom-doc .markloom-ai-block-btn-primary:hover {
238
238
  background: var(--ai-blue-soft);
239
239
  color: var(--ai-blue);
240
240
  }
241
241
 
242
- .loom-doc .loom-ai-spin {
242
+ .markloom-doc .markloom-ai-spin {
243
243
  display: inline-block;
244
244
  width: 12px;
245
245
  height: 12px;
246
246
  border: 1.5px solid currentColor;
247
247
  border-right-color: transparent;
248
248
  border-radius: 50%;
249
- animation: loom-ai-spin 0.7s linear infinite;
249
+ animation: markloom-ai-spin 0.7s linear infinite;
250
250
  flex: none;
251
251
  vertical-align: -1px;
252
252
  }
253
- @keyframes loom-ai-spin {
253
+ @keyframes markloom-ai-spin {
254
254
  to { transform: rotate(360deg); }
255
255
  }
256
256
 
257
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 {
258
+ .markloom-doc .markloom-ai-block,
259
+ .markloom-doc .markloom-ai-spin,
260
+ .markloom-doc p[data-ai-draft][data-ai-stream]::after {
261
261
  animation: none !important;
262
262
  }
263
- .loom-doc p[data-ai-draft] {
263
+ .markloom-doc p[data-ai-draft] {
264
264
  transition: none;
265
265
  }
266
266
  }
267
267
 
268
268
  @media (prefers-color-scheme: dark) {
269
- .loom-doc .loom-ai-block {
269
+ .markloom-doc .markloom-ai-block {
270
270
  --ai-blue: #7aafff;
271
271
  --ai-blue-soft: rgba(122, 175, 255, 0.12);
272
272
  --ai-muted: rgba(255, 255, 255, 0.4);
@@ -276,29 +276,29 @@
276
276
  --ai-fill: rgba(255, 255, 255, 0.06);
277
277
  background: var(--ai-fill);
278
278
  }
279
- .loom-doc .loom-ai-block[data-status='loading'],
280
- .loom-doc .loom-ai-block:focus-within {
279
+ .markloom-doc .markloom-ai-block[data-status='loading'],
280
+ .markloom-doc .markloom-ai-block:focus-within {
281
281
  background: rgba(122, 175, 255, 0.08);
282
282
  }
283
- .loom-doc .loom-ai-block[data-status='error'] {
283
+ .markloom-doc .markloom-ai-block[data-status='error'] {
284
284
  background: rgba(245, 74, 69, 0.1);
285
285
  }
286
- .loom-doc > [data-ai-draft],
287
- .loom-doc [data-ai-draft].loom-ai-draft {
286
+ .markloom-doc > [data-ai-draft],
287
+ .markloom-doc [data-ai-draft].markloom-ai-draft {
288
288
  opacity: 0.55;
289
289
  }
290
- .loom-doc p[data-ai-draft][data-ai-stream]::after {
290
+ .markloom-doc p[data-ai-draft][data-ai-stream]::after {
291
291
  background: #7aafff;
292
292
  }
293
- .loom-doc .loom-ai-kbd {
293
+ .markloom-doc .markloom-ai-kbd {
294
294
  background: rgba(255, 255, 255, 0.08);
295
295
  }
296
- .loom-doc .loom-ai-block-btn-primary:hover {
296
+ .markloom-doc .markloom-ai-block-btn-primary:hover {
297
297
  background: var(--ai-blue-soft);
298
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 {
299
+ .markloom-doc .markloom-ai-block-err,
300
+ .markloom-doc .markloom-ai-block-hint.is-error,
301
+ .markloom-doc .markloom-ai-block-badge-error {
302
302
  color: #ff8a85;
303
303
  }
304
304
  }
@@ -10,7 +10,7 @@ var _chunkVVFIQLVRcjs = require('./chunk-VVFIQLVR.cjs');
10
10
 
11
11
  // src/view/selection.ts
12
12
  function rootEl(root) {
13
- return _nullishCoalesce(root.querySelector(".loom-doc"), () => ( root));
13
+ return _nullishCoalesce(root.querySelector(".markloom-doc"), () => ( root));
14
14
  }
15
15
  function pointToDom(root, doc, pos) {
16
16
  const path = pos.path;
@@ -337,7 +337,7 @@ function aiInstructionFromQuery(query) {
337
337
  var newAiId = () => _nullishCoalesce(_optionalChain([crypto, 'access', _14 => _14.randomUUID, 'optionalCall', _15 => _15()]), () => ( `ai${Math.random().toString(36).slice(2)}`));
338
338
 
339
339
  // src/ai/controller.ts
340
- var LoomAi = (_class = class {
340
+ var MarkloomAi = (_class = class {
341
341
 
342
342
 
343
343
  __init() {this.abort = null}
@@ -1073,4 +1073,4 @@ function createAiStream(cfg) {
1073
1073
 
1074
1074
 
1075
1075
 
1076
- exports.rootEl = rootEl; exports.pointToDom = pointToDom; exports.domToPoint = domToPoint; exports.readSelection = readSelection; exports.writeSelection = writeSelection; exports.elementChildren = elementChildren; exports.focusBlockId = focusBlockId; exports.blockPlainText = blockPlainText; exports.startAiWrite = startAiWrite; exports.precedingPlainText = precedingPlainText; exports.aiInstructionFromQuery = aiInstructionFromQuery; exports.LoomAi = LoomAi; exports.createAiStream = createAiStream;
1076
+ exports.rootEl = rootEl; exports.pointToDom = pointToDom; exports.domToPoint = domToPoint; exports.readSelection = readSelection; exports.writeSelection = writeSelection; exports.elementChildren = elementChildren; exports.focusBlockId = focusBlockId; exports.blockPlainText = blockPlainText; exports.startAiWrite = startAiWrite; exports.precedingPlainText = precedingPlainText; exports.aiInstructionFromQuery = aiInstructionFromQuery; exports.MarkloomAi = MarkloomAi; exports.createAiStream = createAiStream;
@@ -10,7 +10,7 @@ import {
10
10
 
11
11
  // src/view/selection.ts
12
12
  function rootEl(root) {
13
- return root.querySelector(".loom-doc") ?? root;
13
+ return root.querySelector(".markloom-doc") ?? root;
14
14
  }
15
15
  function pointToDom(root, doc, pos) {
16
16
  const path = pos.path;
@@ -337,7 +337,7 @@ function aiInstructionFromQuery(query) {
337
337
  var newAiId = () => crypto.randomUUID?.() ?? `ai${Math.random().toString(36).slice(2)}`;
338
338
 
339
339
  // src/ai/controller.ts
340
- var LoomAi = class {
340
+ var MarkloomAi = class {
341
341
  getEditor;
342
342
  opts;
343
343
  abort = null;
@@ -1071,6 +1071,6 @@ export {
1071
1071
  startAiWrite,
1072
1072
  precedingPlainText,
1073
1073
  aiInstructionFromQuery,
1074
- LoomAi,
1074
+ MarkloomAi,
1075
1075
  createAiStream
1076
1076
  };