egregore-artifacts 0.10.0 → 0.10.2

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/lib/edit-shell.js DELETED
@@ -1,64 +0,0 @@
1
- // HTML shell for the /edit browser annotation surface.
2
- //
3
- // Served by view-server at /edit/<base64url-doc> (see bin/view-server.mjs).
4
- // Inlines the styles + client JS so the editor is a single self-contained
5
- // document — no extra HTTP round-trips for assets, simpler caching story.
6
- //
7
- // The shell deliberately renders an empty body. The client script reads
8
- // `?token=…&doc=…` from the URL, calls /api/edit/render, and injects the
9
- // source-mapped HTML into #eg-edit-body.
10
-
11
- import { editStyles } from './edit-styles.js';
12
- import { editClientScript } from './edit-client.js';
13
-
14
- export function editShell() {
15
- return `<!DOCTYPE html>
16
- <html lang="en">
17
- <head>
18
- <meta charset="UTF-8">
19
- <meta name="viewport" content="width=device-width, initial-scale=1">
20
- <title>Egregore — Edit</title>
21
- <link rel="preconnect" href="https://fonts.googleapis.com">
22
- <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
23
- <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500&display=swap" rel="stylesheet">
24
- <style>
25
- ${editStyles()}
26
- </style>
27
- </head>
28
- <body>
29
- <header class="eg-edit-topbar">
30
- <span class="eg-edit-sigil">◐</span>
31
- <span class="eg-edit-title" id="eg-edit-title">loading…</span>
32
- <span class="eg-edit-mode" title="Initiative mode for /edit-process">
33
- <label><input type="radio" name="eg-init-mode" value="review_each_yellow" checked> review each yellow</label>
34
- <label><input type="radio" name="eg-init-mode" value="apply_all"> apply all</label>
35
- </span>
36
- <button class="eg-edit-btn eg-edit-btn-secondary" id="eg-edit-refresh">Refresh</button>
37
- <button class="eg-edit-btn" id="eg-edit-send">Send to session</button>
38
- </header>
39
- <main class="eg-edit-main">
40
- <section class="eg-edit-body-wrap">
41
- <article class="eg-edit-body" id="eg-edit-body">
42
- <div class="eg-edit-status">Initializing…</div>
43
- </article>
44
- </section>
45
- <aside class="eg-edit-sidebar">
46
- <div class="eg-edit-sidebar-head">
47
- <div class="eg-edit-sidebar-title">Annotations</div>
48
- <div class="eg-edit-filter" id="eg-edit-filter">
49
- <button class="eg-edit-filter-btn" data-color="all">all</button>
50
- <button class="eg-edit-filter-btn" data-color="green">green</button>
51
- <button class="eg-edit-filter-btn" data-color="yellow">yellow</button>
52
- <button class="eg-edit-filter-btn" data-color="red">red</button>
53
- <button class="eg-edit-filter-btn" data-color="null">uncolored</button>
54
- </div>
55
- </div>
56
- <div class="eg-edit-sidebar-list" id="eg-edit-sidebar-list"></div>
57
- </aside>
58
- </main>
59
- <script>
60
- ${editClientScript()}
61
- </script>
62
- </body>
63
- </html>`;
64
- }
@@ -1,537 +0,0 @@
1
- // CSS for the /edit browser annotation surface.
2
- //
3
- // Visual style mirrors `lib/shell.js` (Egregore brand: cream/black/terracotta,
4
- // IBM Plex Mono + Inter + serif). Uses the same CSS variable names so the
5
- // classification colors layer on top of the existing palette.
6
- //
7
- // Structural layout:
8
- // ┌──────────────────────────────────────────────┐
9
- // │ topbar (doc title, refresh, send-to-session) │
10
- // ├─────────────────────────────────┬────────────┤
11
- // │ │ │
12
- // │ doc body (rendered HTML) │ sidebar │
13
- // │ │ │
14
- // └─────────────────────────────────┴────────────┘
15
- //
16
- // The selection popup floats above the body absolutely.
17
-
18
- import { colors, fonts } from './tokens.js';
19
-
20
- export function editStyles() {
21
- return `
22
- :root {
23
- --cream: ${colors.cream};
24
- --black: ${colors.black};
25
- --terracotta: ${colors.terracotta};
26
- --blue-muted: ${colors.blueMuted};
27
- --dark: ${colors.dark};
28
- --border: ${colors.border};
29
- --muted: ${colors.muted};
30
- --warm-gray: ${colors.warmGray};
31
- --terminal-bg: ${colors.terminalBg};
32
- --terminal-text: ${colors.terminalText};
33
- --font-serif: ${fonts.serif};
34
- --font-sans: ${fonts.sans};
35
- --font-mono: ${fonts.mono};
36
- --surface: #ffffff;
37
- --hairline: rgba(224, 216, 204, 0.5);
38
- --subtle-fill: rgba(59, 45, 33, 0.06);
39
- --neutral-chip: rgba(0, 0, 0, 0.04);
40
-
41
- /* Classification — green / yellow / red */
42
- --green: #2A7B5B;
43
- --green-bg: rgba(42, 123, 91, 0.12);
44
- --green-soft: rgba(42, 123, 91, 0.22);
45
- --yellow: #C29A2C;
46
- --yellow-bg: rgba(194, 154, 44, 0.14);
47
- --yellow-soft: rgba(194, 154, 44, 0.28);
48
- --red: #B7472A;
49
- --red-bg: rgba(183, 71, 42, 0.12);
50
- --red-soft: rgba(183, 71, 42, 0.22);
51
- --uncolored-bg: rgba(123, 157, 183, 0.08);
52
- }
53
-
54
- *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
55
-
56
- html, body {
57
- height: 100%;
58
- background: var(--cream);
59
- color: var(--black);
60
- font-family: var(--font-sans);
61
- font-size: 16px;
62
- line-height: 1.65;
63
- -webkit-font-smoothing: antialiased;
64
- -moz-osx-font-smoothing: grayscale;
65
- }
66
-
67
- ::selection { background: var(--terracotta); color: var(--cream); }
68
-
69
- /* ── Topbar ───────────────────────────────────── */
70
- .eg-edit-topbar {
71
- display: flex;
72
- align-items: center;
73
- gap: 16px;
74
- padding: 12px 20px;
75
- background: var(--surface);
76
- border-bottom: 1px solid var(--border);
77
- position: sticky;
78
- top: 0;
79
- z-index: 50;
80
- }
81
- .eg-edit-sigil { color: var(--terracotta); font-size: 18px; }
82
- .eg-edit-title {
83
- font-family: var(--font-mono);
84
- font-size: 13px;
85
- color: var(--muted);
86
- letter-spacing: 0.02em;
87
- flex: 1;
88
- overflow: hidden;
89
- text-overflow: ellipsis;
90
- white-space: nowrap;
91
- }
92
- .eg-edit-mode {
93
- display: flex;
94
- gap: 6px;
95
- align-items: center;
96
- font-family: var(--font-mono);
97
- font-size: 11px;
98
- color: var(--muted);
99
- }
100
- .eg-edit-mode label { cursor: pointer; padding: 3px 8px; border-radius: 3px; }
101
- .eg-edit-mode label:hover { background: var(--neutral-chip); }
102
- .eg-edit-mode input { vertical-align: -1px; margin-right: 4px; }
103
- .eg-edit-btn {
104
- background: var(--terracotta);
105
- color: white;
106
- border: none;
107
- border-radius: 4px;
108
- padding: 7px 14px;
109
- font-family: var(--font-sans);
110
- font-size: 13px;
111
- font-weight: 500;
112
- cursor: pointer;
113
- }
114
- .eg-edit-btn:hover { filter: brightness(1.05); }
115
- .eg-edit-btn-secondary {
116
- background: transparent;
117
- color: var(--dark);
118
- border: 1px solid var(--border);
119
- }
120
- .eg-edit-btn-secondary:hover { background: var(--neutral-chip); }
121
-
122
- /* ── Layout ───────────────────────────────────── */
123
- .eg-edit-main {
124
- display: grid;
125
- grid-template-columns: 1fr 360px;
126
- min-height: calc(100vh - 49px);
127
- }
128
- .eg-edit-body-wrap {
129
- overflow-y: auto;
130
- padding: 2.5rem 2rem 4rem;
131
- }
132
- .eg-edit-body {
133
- max-width: 720px;
134
- margin: 0 auto;
135
- font-size: 15px;
136
- line-height: 1.65;
137
- color: var(--dark);
138
- }
139
- .eg-edit-body h2, .eg-edit-body h3, .eg-edit-body h4 {
140
- color: var(--black);
141
- }
142
-
143
- /* ── Sidebar ──────────────────────────────────── */
144
- .eg-edit-sidebar {
145
- background: var(--surface);
146
- border-left: 1px solid var(--border);
147
- overflow-y: auto;
148
- display: flex;
149
- flex-direction: column;
150
- }
151
- .eg-edit-sidebar-head {
152
- padding: 12px 16px;
153
- border-bottom: 1px solid var(--border);
154
- position: sticky;
155
- top: 0;
156
- background: var(--surface);
157
- z-index: 5;
158
- }
159
- .eg-edit-sidebar-title {
160
- font-family: var(--font-mono);
161
- font-size: 11px;
162
- color: var(--muted);
163
- text-transform: uppercase;
164
- letter-spacing: 0.06em;
165
- margin-bottom: 8px;
166
- }
167
- .eg-edit-filter {
168
- display: flex;
169
- gap: 4px;
170
- flex-wrap: wrap;
171
- }
172
- .eg-edit-filter-btn {
173
- background: transparent;
174
- border: 1px solid var(--border);
175
- color: var(--dark);
176
- font-family: var(--font-mono);
177
- font-size: 11px;
178
- padding: 3px 8px;
179
- border-radius: 3px;
180
- cursor: pointer;
181
- }
182
- .eg-edit-filter-btn.active {
183
- background: var(--black);
184
- color: var(--cream);
185
- border-color: var(--black);
186
- }
187
- .eg-edit-filter-btn[data-color="green"].active { background: var(--green); border-color: var(--green); color: white; }
188
- .eg-edit-filter-btn[data-color="yellow"].active { background: var(--yellow); border-color: var(--yellow); color: white; }
189
- .eg-edit-filter-btn[data-color="red"].active { background: var(--red); border-color: var(--red); color: white; }
190
-
191
- .eg-edit-sidebar-list {
192
- padding: 8px 0;
193
- flex: 1;
194
- }
195
- .eg-edit-section-group {
196
- margin-bottom: 8px;
197
- }
198
- .eg-edit-section-label {
199
- font-family: var(--font-mono);
200
- font-size: 10px;
201
- color: var(--muted);
202
- text-transform: uppercase;
203
- letter-spacing: 0.06em;
204
- padding: 6px 16px 4px;
205
- }
206
-
207
- .eg-edit-ann-card {
208
- margin: 0 12px 6px;
209
- padding: 10px 12px;
210
- border-radius: 5px;
211
- background: var(--surface);
212
- border: 1px solid var(--hairline);
213
- border-left: 3px solid var(--border);
214
- cursor: pointer;
215
- transition: background 0.1s;
216
- }
217
- .eg-edit-ann-card:hover { background: var(--neutral-chip); }
218
- .eg-edit-ann-card[data-color="green"] { border-left-color: var(--green); }
219
- .eg-edit-ann-card[data-color="yellow"] { border-left-color: var(--yellow); }
220
- .eg-edit-ann-card[data-color="red"] { border-left-color: var(--red); }
221
- .eg-edit-ann-card[data-color="null"] { border-left-color: var(--blue-muted); }
222
- .eg-edit-ann-card.eg-orphaned { opacity: 0.7; border-left-style: dashed; }
223
-
224
- .eg-edit-ann-meta {
225
- display: flex;
226
- align-items: center;
227
- gap: 6px;
228
- margin-bottom: 4px;
229
- }
230
- .eg-edit-color-badge {
231
- display: inline-block;
232
- width: 9px;
233
- height: 9px;
234
- border-radius: 50%;
235
- flex-shrink: 0;
236
- }
237
- .eg-edit-color-badge[data-color="green"] { background: var(--green); }
238
- .eg-edit-color-badge[data-color="yellow"] { background: var(--yellow); }
239
- .eg-edit-color-badge[data-color="red"] { background: var(--red); }
240
- .eg-edit-color-badge[data-color="null"] { background: var(--blue-muted); }
241
- .eg-edit-ann-author {
242
- font-family: var(--font-mono);
243
- font-size: 11px;
244
- color: var(--muted);
245
- }
246
- .eg-edit-status-badge {
247
- font-family: var(--font-mono);
248
- font-size: 9px;
249
- padding: 1px 5px;
250
- border-radius: 3px;
251
- background: var(--neutral-chip);
252
- color: var(--muted);
253
- text-transform: uppercase;
254
- letter-spacing: 0.05em;
255
- margin-left: auto;
256
- }
257
- .eg-edit-status-badge[data-status="orphaned"] {
258
- background: rgba(183, 71, 42, 0.12);
259
- color: var(--red);
260
- }
261
- .eg-edit-status-badge[data-status="accepted"] {
262
- background: var(--green-bg);
263
- color: var(--green);
264
- }
265
- .eg-edit-status-badge[data-status="discarded"] { opacity: 0.6; }
266
-
267
- .eg-edit-ann-snippet {
268
- font-family: var(--font-mono);
269
- font-size: 11px;
270
- color: var(--muted);
271
- margin-bottom: 5px;
272
- white-space: nowrap;
273
- overflow: hidden;
274
- text-overflow: ellipsis;
275
- }
276
- .eg-edit-ann-comment {
277
- font-size: 13px;
278
- line-height: 1.45;
279
- color: var(--dark);
280
- margin-bottom: 4px;
281
- word-break: break-word;
282
- }
283
- .eg-edit-ann-thread-count {
284
- font-family: var(--font-mono);
285
- font-size: 10px;
286
- color: var(--muted);
287
- }
288
-
289
- /* Thread display in sidebar */
290
- .eg-edit-thread {
291
- margin-top: 6px;
292
- padding-top: 6px;
293
- border-top: 1px dashed var(--hairline);
294
- display: none;
295
- }
296
- .eg-edit-ann-card.expanded .eg-edit-thread { display: block; }
297
- .eg-edit-reply {
298
- font-size: 12px;
299
- line-height: 1.45;
300
- margin-bottom: 6px;
301
- padding-left: 8px;
302
- border-left: 2px solid var(--hairline);
303
- }
304
- .eg-edit-reply-meta {
305
- font-family: var(--font-mono);
306
- font-size: 10px;
307
- color: var(--muted);
308
- margin-bottom: 2px;
309
- }
310
- .eg-edit-reply-text { color: var(--dark); }
311
- .eg-edit-reply-form {
312
- display: flex;
313
- gap: 4px;
314
- margin-top: 6px;
315
- }
316
- .eg-edit-reply-input {
317
- flex: 1;
318
- background: var(--cream);
319
- border: 1px solid var(--hairline);
320
- border-radius: 3px;
321
- padding: 4px 6px;
322
- font-family: var(--font-sans);
323
- font-size: 12px;
324
- color: var(--black);
325
- }
326
- .eg-edit-reply-input:focus { outline: none; border-color: var(--terracotta); }
327
- .eg-edit-reply-btn {
328
- background: var(--terracotta);
329
- color: white;
330
- border: none;
331
- border-radius: 3px;
332
- padding: 0 8px;
333
- font-family: var(--font-mono);
334
- font-size: 11px;
335
- cursor: pointer;
336
- }
337
-
338
- /* ── Highlights inside body ───────────────────── */
339
- .eg-edit-highlight {
340
- background: var(--uncolored-bg);
341
- border-bottom: 2px solid var(--blue-muted);
342
- cursor: pointer;
343
- border-radius: 2px;
344
- padding: 1px 0;
345
- }
346
- .eg-edit-highlight[data-color="green"] { background: var(--green-bg); border-bottom-color: var(--green); }
347
- .eg-edit-highlight[data-color="yellow"] { background: var(--yellow-bg); border-bottom-color: var(--yellow); }
348
- .eg-edit-highlight[data-color="red"] { background: var(--red-bg); border-bottom-color: var(--red); }
349
- .eg-edit-highlight.eg-flash { animation: eg-flash 1.2s ease; }
350
- @keyframes eg-flash {
351
- 0% { background: var(--terracotta); color: var(--cream); }
352
- 100% {}
353
- }
354
-
355
- /* ── Draft-highlight overlay (persists while popup is open) ─── */
356
- /*
357
- * Painted by paintDraftHighlight() over each rect from the live Range.
358
- * Position absolute; pointer-events:none so it doesn't block interaction.
359
- * Sits BELOW the popup (z-index 100 vs popup's 200) and ABOVE the document
360
- * body so the user always sees what they're commenting on, even after
361
- * the textarea takes focus and the live selection clears.
362
- */
363
- .eg-edit-draft-highlight {
364
- position: absolute;
365
- z-index: 100;
366
- background: rgba(255, 213, 79, 0.42); /* warm amber, translucent */
367
- pointer-events: none;
368
- border-radius: 1px;
369
- mix-blend-mode: multiply;
370
- transition: background 120ms ease;
371
- }
372
-
373
- /* ── Selection popup ──────────────────────────── */
374
- .eg-edit-popup {
375
- position: absolute;
376
- z-index: 200;
377
- background: var(--surface);
378
- border: 1px solid var(--border);
379
- border-radius: 8px;
380
- box-shadow: 0 10px 30px rgba(0,0,0,0.18);
381
- padding: 12px;
382
- width: 320px;
383
- font-family: var(--font-sans);
384
- }
385
- .eg-edit-popup-multipara-hint {
386
- font-size: 11px;
387
- color: var(--muted);
388
- background: var(--neutral-chip);
389
- border-left: 2px solid var(--accent, #d4a017);
390
- padding: 6px 8px;
391
- border-radius: 4px;
392
- margin-bottom: 8px;
393
- line-height: 1.35;
394
- }
395
- .eg-edit-popup-snippet {
396
- font-family: var(--font-mono);
397
- font-size: 11px;
398
- color: var(--muted);
399
- background: var(--neutral-chip);
400
- padding: 6px 8px;
401
- border-radius: 4px;
402
- margin-bottom: 8px;
403
- max-height: 60px;
404
- overflow: auto;
405
- word-break: break-word;
406
- }
407
- .eg-edit-popup-textarea {
408
- width: 100%;
409
- min-height: 70px;
410
- background: var(--cream);
411
- border: 1px solid var(--hairline);
412
- border-radius: 4px;
413
- padding: 6px 8px;
414
- font-family: var(--font-sans);
415
- font-size: 13px;
416
- color: var(--black);
417
- resize: vertical;
418
- margin-bottom: 8px;
419
- }
420
- .eg-edit-popup-textarea:focus { outline: none; border-color: var(--terracotta); }
421
-
422
- .eg-edit-color-row {
423
- display: flex;
424
- gap: 6px;
425
- margin-bottom: 8px;
426
- }
427
- .eg-edit-color-btn {
428
- flex: 1;
429
- background: transparent;
430
- border: 1px solid var(--border);
431
- border-radius: 4px;
432
- padding: 5px 6px;
433
- font-family: var(--font-mono);
434
- font-size: 11px;
435
- cursor: pointer;
436
- color: var(--dark);
437
- display: flex;
438
- align-items: center;
439
- justify-content: center;
440
- gap: 5px;
441
- }
442
- .eg-edit-color-btn:hover { background: var(--neutral-chip); }
443
- .eg-edit-color-btn[data-color="green"].selected { background: var(--green); border-color: var(--green); color: white; }
444
- .eg-edit-color-btn[data-color="yellow"].selected { background: var(--yellow); border-color: var(--yellow); color: white; }
445
- .eg-edit-color-btn[data-color="red"].selected { background: var(--red); border-color: var(--red); color: white; }
446
- .eg-edit-color-btn[data-color="null"].selected { background: var(--blue-muted); border-color: var(--blue-muted); color: white; }
447
- .eg-edit-color-btn.suggested {
448
- outline: 2px dashed var(--terracotta);
449
- outline-offset: 1px;
450
- }
451
- .eg-edit-color-dot {
452
- display: inline-block;
453
- width: 8px; height: 8px; border-radius: 50%;
454
- }
455
- .eg-edit-color-btn[data-color="green"] .eg-edit-color-dot { background: var(--green); }
456
- .eg-edit-color-btn[data-color="yellow"] .eg-edit-color-dot { background: var(--yellow); }
457
- .eg-edit-color-btn[data-color="red"] .eg-edit-color-dot { background: var(--red); }
458
- .eg-edit-color-btn[data-color="null"] .eg-edit-color-dot { background: var(--blue-muted); }
459
- .eg-edit-color-btn.selected .eg-edit-color-dot { background: rgba(255,255,255,0.7); }
460
-
461
- .eg-edit-popup-actions {
462
- display: flex;
463
- justify-content: space-between;
464
- gap: 6px;
465
- }
466
- .eg-edit-popup-cancel {
467
- background: transparent;
468
- border: 1px solid var(--border);
469
- color: var(--dark);
470
- border-radius: 4px;
471
- padding: 5px 12px;
472
- font-family: var(--font-sans);
473
- font-size: 12px;
474
- cursor: pointer;
475
- }
476
- .eg-edit-popup-save {
477
- background: var(--terracotta);
478
- color: white;
479
- border: none;
480
- border-radius: 4px;
481
- padding: 5px 16px;
482
- font-family: var(--font-sans);
483
- font-size: 12px;
484
- font-weight: 500;
485
- cursor: pointer;
486
- }
487
- .eg-edit-popup-suggest {
488
- font-family: var(--font-mono);
489
- font-size: 10px;
490
- color: var(--terracotta);
491
- margin-top: -4px;
492
- margin-bottom: 6px;
493
- min-height: 12px;
494
- }
495
-
496
- /* ── Toast ────────────────────────────────────── */
497
- .eg-edit-toast {
498
- position: fixed;
499
- bottom: 20px;
500
- left: 50%;
501
- transform: translateX(-50%);
502
- background: var(--black);
503
- color: var(--cream);
504
- font-family: var(--font-mono);
505
- font-size: 12px;
506
- padding: 8px 14px;
507
- border-radius: 4px;
508
- z-index: 500;
509
- box-shadow: 0 6px 18px rgba(0,0,0,0.25);
510
- opacity: 0;
511
- transition: opacity 0.2s;
512
- pointer-events: none;
513
- }
514
- .eg-edit-toast.show { opacity: 1; }
515
- .eg-edit-toast.error { background: var(--red); }
516
-
517
- /* ── Loading / error states ───────────────────── */
518
- .eg-edit-status {
519
- padding: 24px;
520
- font-family: var(--font-mono);
521
- font-size: 13px;
522
- color: var(--muted);
523
- text-align: center;
524
- }
525
- .eg-edit-status.error { color: var(--red); }
526
-
527
- /* ── Mobile collapse ──────────────────────────── */
528
- @media (max-width: 900px) {
529
- .eg-edit-main { grid-template-columns: 1fr; }
530
- .eg-edit-sidebar {
531
- border-left: none;
532
- border-top: 1px solid var(--border);
533
- max-height: 50vh;
534
- }
535
- }
536
- `;
537
- }