@open-document/core 0.13.3 → 0.14.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.
Files changed (67) hide show
  1. package/dist/{build-CvsOak5B.js → build-CyBlmrjS.js} +1 -1
  2. package/dist/{check-CbUBwYmf.js → check-DUKDEem-.js} +3 -3
  3. package/dist/cli/bin.js +10 -21
  4. package/dist/{config-BWtOZ1jc.d.ts → config-cAV1OCuY.d.ts} +9 -1
  5. package/dist/{config-CltJJVsw.js → config-cNpYUpF6.js} +2746 -369
  6. package/dist/{context-CWgfsHoE.js → context-BPApOW9n.js} +1 -1
  7. package/dist/{dev-B8H2qT6G.js → dev-DrnOvsX3.js} +1 -1
  8. package/dist/{diff-BvIjjgnc.js → diff-BPMD2Knh.js} +2 -2
  9. package/dist/{export-DX30_s2q.js → export-DeVtL8aX.js} +3 -3
  10. package/dist/{import-DgsdJT5e.js → import-WAgWsuOv.js} +3 -2
  11. package/dist/index.d.ts +2 -2
  12. package/dist/ops/index.d.ts +3 -1
  13. package/dist/ops/index.js +2 -2
  14. package/dist/{ops-CSR5RlrE.js → ops-raK6424A.js} +2 -854
  15. package/dist/{preview-DYMUNjXL.js → preview-B8Vw9QCh.js} +1 -1
  16. package/dist/rolldown-runtime-D7D4PA-g.js +13 -0
  17. package/dist/{templates-B5Tz0AKb.js → templates-D9jAFJ8R.js} +3 -3
  18. package/dist/vite/index.d.ts +1 -1
  19. package/dist/vite/index.js +1 -1
  20. package/package.json +1 -1
  21. package/skills/create-doc/SKILL.md +1 -1
  22. package/skills/doc-authoring/SKILL.md +6 -0
  23. package/src/app/app.tsx +2 -0
  24. package/src/app/components/agent/agent-dock.tsx +75 -0
  25. package/src/app/components/agent/agent-markdown.tsx +45 -0
  26. package/src/app/components/agent/agent-panel.tsx +690 -0
  27. package/src/app/components/agent/agent-presence.tsx +74 -0
  28. package/src/app/components/agent/composer.tsx +120 -0
  29. package/src/app/components/agent/connect-view.tsx +183 -0
  30. package/src/app/components/agent/history-view.tsx +134 -0
  31. package/src/app/components/agent/provider-logo.tsx +23 -0
  32. package/src/app/components/agent/transcript.tsx +609 -0
  33. package/src/app/components/comments/comments-panel.tsx +26 -2
  34. package/src/app/components/inspector/inspector.tsx +17 -0
  35. package/src/app/components/note-markdown.tsx +85 -0
  36. package/src/app/components/page-error-boundary.tsx +84 -0
  37. package/src/app/components/page-frame.tsx +2 -1
  38. package/src/app/components/panel/resize-handle.tsx +129 -0
  39. package/src/app/components/ui/button.tsx +97 -0
  40. package/src/app/components/ui/popover.tsx +144 -0
  41. package/src/app/components/ui/tooltip.tsx +123 -0
  42. package/src/app/lib/agent/use-agent.ts +543 -0
  43. package/src/app/lib/diagnostics.ts +13 -0
  44. package/src/app/lib/export-dom.ts +2 -1
  45. package/src/app/lib/export-pdf.ts +2 -1
  46. package/src/app/lib/i18n-ja/agent-panel.ts +107 -0
  47. package/src/app/lib/i18n-ja/agent.ts +9 -0
  48. package/src/app/lib/i18n-ja/index.ts +9 -1
  49. package/src/app/lib/i18n-ko/agent-panel.ts +106 -0
  50. package/src/app/lib/i18n-ko/agent.ts +9 -0
  51. package/src/app/lib/i18n-ko/index.ts +9 -1
  52. package/src/app/lib/i18n-zh-cn/agent-panel.ts +105 -0
  53. package/src/app/lib/i18n-zh-cn/agent.ts +9 -0
  54. package/src/app/lib/i18n-zh-cn/index.ts +9 -1
  55. package/src/app/lib/i18n-zh-tw/agent-panel.ts +105 -0
  56. package/src/app/lib/i18n-zh-tw/agent.ts +9 -0
  57. package/src/app/lib/i18n-zh-tw/index.ts +9 -1
  58. package/src/app/lib/note-markdown.ts +116 -0
  59. package/src/app/lib/toast.ts +50 -0
  60. package/src/app/lib/use-auto-grow.ts +15 -0
  61. package/src/app/lib/use-doc-titles.ts +28 -0
  62. package/src/app/lib/use-locale.ts +144 -0
  63. package/src/app/lib/utils.ts +4 -0
  64. package/src/app/routes/doc-preview.tsx +103 -0
  65. package/src/app/routes/doc.tsx +118 -11
  66. package/src/app/routes/home.tsx +43 -8
  67. package/src/app/styles.css +193 -0
@@ -14,10 +14,12 @@ import {
14
14
  PencilLine,
15
15
  Plus,
16
16
  Search,
17
+ Sparkles,
17
18
  Trash2,
18
19
  } from 'lucide-react';
19
20
  import { useMemo, useState } from 'react';
20
21
  import { Link, useNavigate, useOutletContext } from 'react-router-dom';
22
+ import { ProviderLogo } from '../components/agent/provider-logo';
21
23
  import {
22
24
  CARD_GRID,
23
25
  CardText,
@@ -31,12 +33,14 @@ import { PageFrame } from '../components/page-frame';
31
33
  import { DOC_DND_MIME } from '../components/sidebar/folder-item';
32
34
  import { ALL_DOCS_ID, DRAFT_ID } from '../components/sidebar/sidebar';
33
35
  import { Menu, MenuItem, MenuSeparator } from '../components/ui/menu';
36
+ import { useAgentStatus, useCreateDoc } from '../lib/agent/use-agent';
34
37
  import { coverContent } from '../lib/doc-preview';
35
38
  import { docCreatedAt, docIds, docThemes, docTitles } from '../lib/docs';
36
39
  import { type Translate, useLocale, useT } from '../lib/i18n';
37
40
  import { pageLang, resolvePageGeometry } from '../lib/sdk';
38
41
  import { findTheme } from '../lib/themes';
39
42
  import { useDocModule } from '../lib/use-doc-module';
43
+ import { format, useLocale as useAgentLocale } from '../lib/use-locale';
40
44
  import type { HomeOutletContext } from './home-shell';
41
45
 
42
46
  /** Sheet and date, the two facts that tell documents apart at a glance. */
@@ -99,14 +103,17 @@ export function Home() {
99
103
  const inFolder =
100
104
  ctx.selectedId !== ALL_DOCS_ID && ctx.selectedId !== DRAFT_ID ? ctx.selectedId : null;
101
105
  const newButton = import.meta.env.DEV && (
102
- <button
103
- type="button"
104
- onClick={() => setCreating(true)}
105
- className="flex h-8 items-center gap-1.5 rounded-md bg-primary px-2.5 text-primary-foreground text-xs transition-opacity hover:opacity-90 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-foreground/60"
106
- >
107
- <Plus className="size-3.5" />
108
- {t('New document')}
109
- </button>
106
+ <>
107
+ <DraftWithAgentButton />
108
+ <button
109
+ type="button"
110
+ onClick={() => setCreating(true)}
111
+ className="flex h-8 items-center gap-1.5 rounded-md bg-primary px-2.5 text-primary-foreground text-xs transition-opacity hover:opacity-90 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-foreground/60"
112
+ >
113
+ <Plus className="size-3.5" />
114
+ {t('New document')}
115
+ </button>
116
+ </>
110
117
  );
111
118
 
112
119
  const setSort = (next: SortKey) => {
@@ -425,3 +432,31 @@ function DocCard({
425
432
  </div>
426
433
  );
427
434
  }
435
+
436
+ // Offered even before an agent is connected: the blank document opens the
437
+ // agent panel, which walks a first-time user through connecting one.
438
+ function DraftWithAgentButton() {
439
+ const t = useAgentLocale();
440
+ const { enabled, provider } = useAgentStatus();
441
+ const start = useCreateDoc();
442
+ if (!enabled) return null;
443
+ return (
444
+ <button
445
+ type="button"
446
+ onClick={() => void start()}
447
+ title={
448
+ provider
449
+ ? format(t.agent.createDocWith, { provider: provider.name })
450
+ : t.agent.quickCreateHint
451
+ }
452
+ className="flex h-8 items-center gap-1.5 rounded-md border border-border px-2.5 text-xs transition-colors hover:bg-accent focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-foreground/60"
453
+ >
454
+ {provider ? (
455
+ <ProviderLogo provider={provider.id} className="size-3.5" />
456
+ ) : (
457
+ <Sparkles className="size-3.5" />
458
+ )}
459
+ {t.agent.createDoc}
460
+ </button>
461
+ );
462
+ }
@@ -19,6 +19,27 @@
19
19
  --color-border: var(--border);
20
20
 
21
21
  --radius-md: 6px;
22
+
23
+ /* The agent panel is open-slide's, and reads its token names; here they
24
+ resolve to open-doc's own neutral palette. */
25
+ --color-card: var(--background);
26
+ --color-card-foreground: var(--foreground);
27
+ --color-popover: var(--background);
28
+ --color-popover-foreground: var(--foreground);
29
+ --color-secondary: var(--muted);
30
+ --color-secondary-foreground: var(--foreground);
31
+ --color-hairline: var(--border);
32
+ --color-ring: var(--comment-pin);
33
+ --color-destructive: var(--change-removed);
34
+ --color-brand: var(--comment-pin);
35
+ --color-brand-foreground: oklch(0.985 0 0);
36
+ --color-sidebar: var(--background);
37
+ --color-sidebar-foreground: var(--foreground);
38
+ --ease-swift: cubic-bezier(0.22, 1, 0.36, 1);
39
+ --shadow-edge: 0 0 0 0.5px oklch(0 0 0 / 0.06), 0 1px 0 oklch(0 0 0 / 0.025);
40
+ --shadow-floating:
41
+ 0 0 0 0.5px oklch(0 0 0 / 0.08), 0 1px 1px oklch(0 0 0 / 0.04),
42
+ 0 4px 16px -2px oklch(0 0 0 / 0.08);
22
43
  }
23
44
 
24
45
  :root {
@@ -258,3 +279,175 @@
258
279
  background-color: rgb(255 138 0 / 0.62);
259
280
  color: inherit;
260
281
  }
282
+
283
+ @keyframes island-enter {
284
+ from {
285
+ opacity: 0;
286
+ filter: blur(6px);
287
+ transform: translateY(6px) scale(0.9);
288
+ }
289
+ }
290
+
291
+ .island-enter {
292
+ animation: island-enter 420ms cubic-bezier(0.32, 0.72, 0, 1) both;
293
+ }
294
+
295
+ /* Agent presence: ring, write sweep and shimmer shown while an agent edits a deck. */
296
+ @property --agent-angle {
297
+ syntax: "<angle>";
298
+ inherits: false;
299
+ initial-value: 0deg;
300
+ }
301
+
302
+ [data-agent-provider] {
303
+ --agent-a: oklch(0.68 0.14 42);
304
+ --agent-b: oklch(0.82 0.12 75);
305
+ }
306
+
307
+ [data-agent-provider="codex"] {
308
+ --agent-a: oklch(0.64 0.13 170);
309
+ --agent-b: oklch(0.7 0.14 240);
310
+ }
311
+
312
+ @keyframes agent-spin {
313
+ to {
314
+ --agent-angle: 360deg;
315
+ }
316
+ }
317
+
318
+ @keyframes agent-fade-in {
319
+ from {
320
+ opacity: 0;
321
+ }
322
+ }
323
+
324
+ .agent-ring {
325
+ pointer-events: none;
326
+ position: absolute;
327
+ inset: 0;
328
+ border-radius: inherit;
329
+ padding: 1.5px;
330
+ background: conic-gradient(
331
+ from var(--agent-angle),
332
+ transparent 0deg,
333
+ var(--agent-a) 70deg,
334
+ var(--agent-b) 140deg,
335
+ transparent 210deg,
336
+ transparent 360deg
337
+ );
338
+ mask:
339
+ linear-gradient(#000 0 0) content-box exclude,
340
+ linear-gradient(#000 0 0);
341
+ animation:
342
+ agent-spin 3.6s linear infinite,
343
+ agent-fade-in 400ms var(--ease-swift) both;
344
+ }
345
+
346
+ .agent-glow {
347
+ pointer-events: none;
348
+ position: absolute;
349
+ inset: 0;
350
+ border-radius: inherit;
351
+ box-shadow:
352
+ inset 0 0 0 1px color-mix(in oklch, var(--agent-a) 35%, transparent),
353
+ inset 0 0 48px -12px color-mix(in oklch, var(--agent-a) 45%, transparent);
354
+ animation: agent-fade-in 400ms var(--ease-swift) both;
355
+ }
356
+
357
+ @keyframes agent-sweep {
358
+ from {
359
+ background-position: 120% 0;
360
+ opacity: 1;
361
+ }
362
+ to {
363
+ background-position: -20% 0;
364
+ opacity: 0;
365
+ }
366
+ }
367
+
368
+ .agent-sweep {
369
+ pointer-events: none;
370
+ position: absolute;
371
+ inset: 0;
372
+ border-radius: inherit;
373
+ background: linear-gradient(
374
+ 105deg,
375
+ transparent 35%,
376
+ color-mix(in oklch, var(--agent-b) 22%, transparent) 50%,
377
+ transparent 65%
378
+ );
379
+ background-size: 250% 100%;
380
+ animation: agent-sweep 900ms var(--ease-swift) both;
381
+ }
382
+
383
+ @keyframes agent-shimmer {
384
+ from {
385
+ background-position: 100% 0;
386
+ }
387
+ to {
388
+ background-position: 0% 0;
389
+ }
390
+ }
391
+
392
+ .agent-shimmer {
393
+ background: linear-gradient(
394
+ 90deg,
395
+ var(--muted-foreground) 35%,
396
+ var(--foreground) 50%,
397
+ var(--muted-foreground) 65%
398
+ );
399
+ background-size: 300% 100%;
400
+ background-clip: text;
401
+ color: transparent;
402
+ animation: agent-shimmer 1.8s linear infinite;
403
+ }
404
+
405
+ @keyframes agent-progress {
406
+ from {
407
+ transform: translateX(-100%);
408
+ }
409
+ to {
410
+ transform: translateX(250%);
411
+ }
412
+ }
413
+
414
+ .agent-progress {
415
+ pointer-events: none;
416
+ position: absolute;
417
+ inset-inline: 0;
418
+ top: 0;
419
+ height: 1.5px;
420
+ overflow: hidden;
421
+ }
422
+
423
+ .agent-progress::after {
424
+ content: "";
425
+ position: absolute;
426
+ inset-block: 0;
427
+ width: 40%;
428
+ background: linear-gradient(90deg, transparent, var(--agent-a), var(--agent-b), transparent);
429
+ animation: agent-progress 1.6s cubic-bezier(0.4, 0, 0.6, 1) infinite;
430
+ }
431
+
432
+ @media (prefers-reduced-motion: reduce) {
433
+ .agent-ring {
434
+ animation: agent-fade-in 160ms ease-out both;
435
+ --agent-angle: 120deg;
436
+ }
437
+
438
+ .agent-sweep {
439
+ display: none;
440
+ }
441
+
442
+ .agent-shimmer {
443
+ animation: none;
444
+ color: var(--foreground);
445
+ background: none;
446
+ }
447
+
448
+ .agent-progress::after {
449
+ animation: none;
450
+ width: 100%;
451
+ opacity: 0.6;
452
+ }
453
+ }