@asanchez-sa/abby 0.0.0-stage → 0.1.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 +217 -2
- package/dist/_virtual/_rolldown/runtime.js +26 -0
- package/dist/agents/approvals.d.ts +46 -0
- package/dist/agents/approvals.js +58 -0
- package/dist/agents/changes.d.ts +21 -0
- package/dist/agents/changes.js +21 -0
- package/dist/agents/hooks.d.ts +20 -0
- package/dist/agents/hooks.js +58 -0
- package/dist/agents/index.d.ts +11 -0
- package/dist/agents/index.js +9 -0
- package/dist/agents/run-tool.d.ts +44 -0
- package/dist/agents/run-tool.js +79 -0
- package/dist/agents/ui-sdk.d.ts +5 -0
- package/dist/agents/ui-sdk.js +3 -0
- package/dist/behaviors/canvas/index.d.ts +2 -0
- package/dist/behaviors/canvas/index.js +1 -0
- package/dist/behaviors/canvas/ui-sdk.d.ts +2 -0
- package/dist/behaviors/canvas/ui-sdk.js +1 -0
- package/dist/behaviors/drag-and-drop/index.d.ts +2 -0
- package/dist/behaviors/drag-and-drop/index.js +1 -0
- package/dist/behaviors/drag-and-drop/ui-sdk.d.ts +2 -0
- package/dist/behaviors/drag-and-drop/ui-sdk.js +1 -0
- package/dist/behaviors/dragging/index.d.ts +2 -0
- package/dist/behaviors/dragging/index.js +1 -0
- package/dist/behaviors/dragging/ui-sdk.d.ts +2 -0
- package/dist/behaviors/dragging/ui-sdk.js +1 -0
- package/dist/behaviors/focus/index.d.ts +2 -0
- package/dist/behaviors/focus/index.js +1 -0
- package/dist/behaviors/focus/ui-sdk.d.ts +2 -0
- package/dist/behaviors/focus/ui-sdk.js +1 -0
- package/dist/behaviors/lists/index.d.ts +3 -0
- package/dist/behaviors/lists/index.js +3 -0
- package/dist/behaviors/lists/ui-sdk.d.ts +3 -0
- package/dist/behaviors/lists/ui-sdk.js +3 -0
- package/dist/behaviors/popups/index.d.ts +3 -0
- package/dist/behaviors/popups/index.js +3 -0
- package/dist/behaviors/popups/ui-sdk.d.ts +3 -0
- package/dist/behaviors/popups/ui-sdk.js +3 -0
- package/dist/behaviors/preferences/index.d.ts +3 -0
- package/dist/behaviors/preferences/index.js +3 -0
- package/dist/behaviors/preferences/ui-sdk.d.ts +3 -0
- package/dist/behaviors/preferences/ui-sdk.js +3 -0
- package/dist/behaviors/selection/index.d.ts +3 -0
- package/dist/behaviors/selection/index.js +3 -0
- package/dist/behaviors/selection/indicator.d.ts +13 -0
- package/dist/behaviors/selection/indicator.js +20 -0
- package/dist/behaviors/selection/ui-sdk.d.ts +2 -0
- package/dist/behaviors/selection/ui-sdk.js +1 -0
- package/dist/behaviors/transitions/index.d.ts +3 -0
- package/dist/behaviors/transitions/index.js +3 -0
- package/dist/behaviors/transitions/ui-sdk.d.ts +3 -0
- package/dist/behaviors/transitions/ui-sdk.js +3 -0
- package/dist/behaviors/trees/index.d.ts +2 -0
- package/dist/behaviors/trees/index.js +1 -0
- package/dist/behaviors/trees/ui-sdk.d.ts +2 -0
- package/dist/behaviors/trees/ui-sdk.js +1 -0
- package/dist/components/accordion/accordion.d.ts +13 -0
- package/dist/components/accordion/accordion.js +165 -0
- package/dist/components/alert/alert.d.ts +13 -0
- package/dist/components/alert/alert.js +131 -0
- package/dist/components/alert-dialog/alert-dialog.d.ts +15 -0
- package/dist/components/alert-dialog/alert-dialog.js +257 -0
- package/dist/components/aspect-ratio/aspect-ratio.d.ts +7 -0
- package/dist/components/aspect-ratio/aspect-ratio.js +57 -0
- package/dist/components/attachment/attachment.d.ts +48 -0
- package/dist/components/attachment/attachment.js +372 -0
- package/dist/components/autocomplete/autocomplete.d.ts +32 -0
- package/dist/components/autocomplete/autocomplete.js +466 -0
- package/dist/components/avatar/avatar.d.ts +6 -0
- package/dist/components/avatar/avatar.js +100 -0
- package/dist/components/avatar-group/avatar-group.d.ts +9 -0
- package/dist/components/avatar-group/avatar-group.js +75 -0
- package/dist/components/badge/badge.d.ts +15 -0
- package/dist/components/badge/badge.js +31 -0
- package/dist/components/breadcrumb/breadcrumb.d.ts +24 -0
- package/dist/components/breadcrumb/breadcrumb.js +279 -0
- package/dist/components/bubble/bubble.d.ts +26 -0
- package/dist/components/bubble/bubble.js +173 -0
- package/dist/components/button/button.d.ts +18 -0
- package/dist/components/button/button.js +91 -0
- package/dist/components/button-group/button-group.d.ts +15 -0
- package/dist/components/button-group/button-group.js +71 -0
- package/dist/components/calendar/calendar.d.ts +29 -0
- package/dist/components/calendar/calendar.js +453 -0
- package/dist/components/card/card.d.ts +14 -0
- package/dist/components/card/card.js +213 -0
- package/dist/components/carousel/carousel.d.ts +16 -0
- package/dist/components/carousel/carousel.js +364 -0
- package/dist/components/chain-of-thought/chain-of-thought.d.ts +72 -0
- package/dist/components/chain-of-thought/chain-of-thought.js +491 -0
- package/dist/components/chat/chat.d.ts +48 -0
- package/dist/components/chat/chat.js +207 -0
- package/dist/components/checkbox/checkbox.d.ts +10 -0
- package/dist/components/checkbox/checkbox.js +118 -0
- package/dist/components/checkpoint/checkpoint.d.ts +24 -0
- package/dist/components/checkpoint/checkpoint.js +178 -0
- package/dist/components/choice-cards/choice-cards.d.ts +38 -0
- package/dist/components/choice-cards/choice-cards.js +255 -0
- package/dist/components/code-block/code-block.d.ts +58 -0
- package/dist/components/code-block/code-block.js +506 -0
- package/dist/components/code-block/highlighter.js +96 -0
- package/dist/components/code-block/use-highlighted-code.d.ts +11 -0
- package/dist/components/code-block/use-highlighted-code.js +54 -0
- package/dist/components/collapsible/collapsible.d.ts +10 -0
- package/dist/components/collapsible/collapsible.js +92 -0
- package/dist/components/color-picker/color-picker.d.ts +17 -0
- package/dist/components/color-picker/color-picker.js +395 -0
- package/dist/components/combobox/combobox.d.ts +54 -0
- package/dist/components/combobox/combobox.js +683 -0
- package/dist/components/command/command.d.ts +23 -0
- package/dist/components/command/command.js +373 -0
- package/dist/components/command-dock/command-dock.d.ts +118 -0
- package/dist/components/command-dock/command-dock.js +944 -0
- package/dist/components/confirmation/confirmation.d.ts +58 -0
- package/dist/components/confirmation/confirmation.js +181 -0
- package/dist/components/context/context.d.ts +82 -0
- package/dist/components/context/context.js +490 -0
- package/dist/components/date-input/date-input.d.ts +16 -0
- package/dist/components/date-input/date-input.js +89 -0
- package/dist/components/date-picker/date-picker.d.ts +28 -0
- package/dist/components/date-picker/date-picker.js +361 -0
- package/dist/components/dialog/dialog.d.ts +14 -0
- package/dist/components/dialog/dialog.js +261 -0
- package/dist/components/drawer/drawer.d.ts +16 -0
- package/dist/components/drawer/drawer.js +309 -0
- package/dist/components/empty/empty.d.ts +18 -0
- package/dist/components/empty/empty.js +192 -0
- package/dist/components/field/field.d.ts +15 -0
- package/dist/components/field/field.js +261 -0
- package/dist/components/file-input/file-input.d.ts +12 -0
- package/dist/components/file-input/file-input.js +216 -0
- package/dist/components/file-tree/file-tree.d.ts +45 -0
- package/dist/components/file-tree/file-tree.js +283 -0
- package/dist/components/hover-card/hover-card.d.ts +10 -0
- package/dist/components/hover-card/hover-card.js +118 -0
- package/dist/components/icon/icon.d.ts +14 -0
- package/dist/components/icon/icon.js +60 -0
- package/dist/components/image-cropper/image-cropper.d.ts +15 -0
- package/dist/components/image-cropper/image-cropper.js +334 -0
- package/dist/components/inline-citation/inline-citation.d.ts +46 -0
- package/dist/components/inline-citation/inline-citation.js +269 -0
- package/dist/components/input/input.d.ts +9 -0
- package/dist/components/input/input.js +43 -0
- package/dist/components/input-group/input-group.d.ts +42 -0
- package/dist/components/input-group/input-group.js +192 -0
- package/dist/components/item/item.d.ts +32 -0
- package/dist/components/item/item.js +394 -0
- package/dist/components/kbd/kbd.d.ts +9 -0
- package/dist/components/kbd/kbd.js +75 -0
- package/dist/components/label/label.d.ts +6 -0
- package/dist/components/label/label.js +40 -0
- package/dist/components/link/link.d.ts +21 -0
- package/dist/components/link/link.js +126 -0
- package/dist/components/listbox/listbox.d.ts +20 -0
- package/dist/components/listbox/listbox.js +199 -0
- package/dist/components/marker/marker.d.ts +11 -0
- package/dist/components/marker/marker.js +88 -0
- package/dist/components/menu/menu.d.ts +38 -0
- package/dist/components/menu/menu.js +553 -0
- package/dist/components/menubar/menubar.d.ts +9 -0
- package/dist/components/menubar/menubar.js +47 -0
- package/dist/components/message/message.d.ts +44 -0
- package/dist/components/message/message.js +328 -0
- package/dist/components/message-scroller/message-scroller.d.ts +111 -0
- package/dist/components/message-scroller/message-scroller.js +957 -0
- package/dist/components/meter/meter.d.ts +8 -0
- package/dist/components/meter/meter.js +162 -0
- package/dist/components/model-selector/model-selector.d.ts +155 -0
- package/dist/components/model-selector/model-selector.js +905 -0
- package/dist/components/native-select/native-select.d.ts +27 -0
- package/dist/components/native-select/native-select.js +226 -0
- package/dist/components/navigation-menu/navigation-menu.d.ts +29 -0
- package/dist/components/navigation-menu/navigation-menu.js +318 -0
- package/dist/components/not-label.js +9 -0
- package/dist/components/note-editor/blocks.d.ts +22 -0
- package/dist/components/note-editor/blocks.js +245 -0
- package/dist/components/note-editor/diff.d.ts +19 -0
- package/dist/components/note-editor/diff.js +64 -0
- package/dist/components/note-editor/editor.js +249 -0
- package/dist/components/note-editor/note-editor.d.ts +109 -0
- package/dist/components/note-editor/note-editor.js +954 -0
- package/dist/components/note-editor/parts/comments.d.ts +24 -0
- package/dist/components/note-editor/parts/comments.js +336 -0
- package/dist/components/note-editor/parts/header.d.ts +25 -0
- package/dist/components/note-editor/parts/header.js +263 -0
- package/dist/components/note-editor/parts/history.d.ts +56 -0
- package/dist/components/note-editor/parts/history.js +409 -0
- package/dist/components/note-editor/parts/presence.d.ts +31 -0
- package/dist/components/note-editor/parts/presence.js +140 -0
- package/dist/components/note-editor/parts/suggestions.d.ts +45 -0
- package/dist/components/note-editor/parts/suggestions.js +316 -0
- package/dist/components/note-editor/parts/toolbar.d.ts +38 -0
- package/dist/components/note-editor/parts/toolbar.js +683 -0
- package/dist/components/note-editor/people.d.ts +84 -0
- package/dist/components/note-editor/people.js +276 -0
- package/dist/components/note-editor/person.d.ts +11 -0
- package/dist/components/note-editor/person.js +15 -0
- package/dist/components/note-place/note-place.d.ts +42 -0
- package/dist/components/note-place/note-place.js +256 -0
- package/dist/components/note-status/note-status.d.ts +59 -0
- package/dist/components/note-status/note-status.js +380 -0
- package/dist/components/number-input/number-input.d.ts +12 -0
- package/dist/components/number-input/number-input.js +252 -0
- package/dist/components/otp-input/otp-input.d.ts +12 -0
- package/dist/components/otp-input/otp-input.js +136 -0
- package/dist/components/pagination/pagination.d.ts +23 -0
- package/dist/components/pagination/pagination.js +218 -0
- package/dist/components/password-input/password-input.d.ts +11 -0
- package/dist/components/password-input/password-input.js +117 -0
- package/dist/components/plan/plan.d.ts +51 -0
- package/dist/components/plan/plan.js +320 -0
- package/dist/components/popover/popover.d.ts +16 -0
- package/dist/components/popover/popover.js +268 -0
- package/dist/components/preferences/preferences.d.ts +5 -0
- package/dist/components/preferences/preferences.js +18 -0
- package/dist/components/progress/progress.d.ts +8 -0
- package/dist/components/progress/progress.js +162 -0
- package/dist/components/prompt-input/prompt-input.d.ts +247 -0
- package/dist/components/prompt-input/prompt-input.js +1367 -0
- package/dist/components/questionnaire/questionnaire.d.ts +174 -0
- package/dist/components/questionnaire/questionnaire.js +1628 -0
- package/dist/components/queue/queue.d.ts +82 -0
- package/dist/components/queue/queue.js +471 -0
- package/dist/components/radio/radio.d.ts +7 -0
- package/dist/components/radio/radio.js +101 -0
- package/dist/components/rating/rating.d.ts +10 -0
- package/dist/components/rating/rating.js +95 -0
- package/dist/components/reasoning/reasoning.d.ts +50 -0
- package/dist/components/reasoning/reasoning.js +233 -0
- package/dist/components/resizable/resizable.d.ts +6 -0
- package/dist/components/resizable/resizable.js +100 -0
- package/dist/components/scroll-area/scroll-area.d.ts +17 -0
- package/dist/components/scroll-area/scroll-area.js +211 -0
- package/dist/components/segmented-control/segmented-control.d.ts +16 -0
- package/dist/components/segmented-control/segmented-control.js +142 -0
- package/dist/components/select/select.d.ts +43 -0
- package/dist/components/select/select.js +577 -0
- package/dist/components/separator/separator.d.ts +4 -0
- package/dist/components/separator/separator.js +38 -0
- package/dist/components/sheet/sheet.d.ts +24 -0
- package/dist/components/sheet/sheet.js +330 -0
- package/dist/components/sidebar/sidebar.d.ts +138 -0
- package/dist/components/sidebar/sidebar.js +1374 -0
- package/dist/components/skeleton/skeleton.d.ts +4 -0
- package/dist/components/skeleton/skeleton.js +40 -0
- package/dist/components/slider/slider.d.ts +9 -0
- package/dist/components/slider/slider.js +193 -0
- package/dist/components/sources/sources.d.ts +35 -0
- package/dist/components/sources/sources.js +209 -0
- package/dist/components/spinner/spinner.d.ts +11 -0
- package/dist/components/spinner/spinner.js +59 -0
- package/dist/components/stack-trace/parse-stack-trace.d.ts +21 -0
- package/dist/components/stack-trace/parse-stack-trace.js +61 -0
- package/dist/components/stack-trace/stack-trace.d.ts +79 -0
- package/dist/components/stack-trace/stack-trace.js +434 -0
- package/dist/components/subagent/subagent.d.ts +71 -0
- package/dist/components/subagent/subagent.js +450 -0
- package/dist/components/suggestion/suggestion.d.ts +21 -0
- package/dist/components/suggestion/suggestion.js +130 -0
- package/dist/components/switch/switch.d.ts +6 -0
- package/dist/components/switch/switch.js +70 -0
- package/dist/components/table/table.d.ts +19 -0
- package/dist/components/table/table.js +284 -0
- package/dist/components/table-of-contents/spy.js +84 -0
- package/dist/components/table-of-contents/table-of-contents.d.ts +92 -0
- package/dist/components/table-of-contents/table-of-contents.js +787 -0
- package/dist/components/tabs/tabs.d.ts +25 -0
- package/dist/components/tabs/tabs.js +273 -0
- package/dist/components/task/task.d.ts +40 -0
- package/dist/components/task/task.js +262 -0
- package/dist/components/terminal/terminal.d.ts +82 -0
- package/dist/components/terminal/terminal.js +457 -0
- package/dist/components/test-results/test-results.d.ts +127 -0
- package/dist/components/test-results/test-results.js +687 -0
- package/dist/components/textarea/textarea.d.ts +8 -0
- package/dist/components/textarea/textarea.js +43 -0
- package/dist/components/time-input/time-input.d.ts +7 -0
- package/dist/components/time-input/time-input.js +82 -0
- package/dist/components/timeline/timeline.d.ts +19 -0
- package/dist/components/timeline/timeline.js +247 -0
- package/dist/components/toast/toast.d.ts +12 -0
- package/dist/components/toast/toast.js +285 -0
- package/dist/components/toggle/toggle.d.ts +15 -0
- package/dist/components/toggle/toggle.js +137 -0
- package/dist/components/token-input/token-input.d.ts +7 -0
- package/dist/components/token-input/token-input.js +117 -0
- package/dist/components/tool/tool.d.ts +66 -0
- package/dist/components/tool/tool.js +413 -0
- package/dist/components/toolbar/toolbar.d.ts +91 -0
- package/dist/components/toolbar/toolbar.js +655 -0
- package/dist/components/tooltip/tooltip.d.ts +8 -0
- package/dist/components/tooltip/tooltip.js +97 -0
- package/dist/components/trace/trace.d.ts +31 -0
- package/dist/components/trace/trace.js +309 -0
- package/dist/components/tree/tree.d.ts +13 -0
- package/dist/components/tree/tree.js +258 -0
- package/dist/components/trigger-menu/trigger-menu.d.ts +30 -0
- package/dist/components/trigger-menu/trigger-menu.js +352 -0
- package/dist/components/usage/usage.d.ts +132 -0
- package/dist/components/usage/usage.js +1368 -0
- package/dist/components/waterfall/waterfall.d.ts +20 -0
- package/dist/components/waterfall/waterfall.js +360 -0
- package/dist/components/week-strip/week-strip.d.ts +177 -0
- package/dist/components/week-strip/week-strip.js +1081 -0
- package/dist/core/index.d.ts +7 -0
- package/dist/core/index.js +27 -0
- package/dist/core/ui-sdk.d.ts +3 -0
- package/dist/core/ui-sdk.js +3 -0
- package/dist/core/use-primitive-state.d.ts +14 -0
- package/dist/core/use-primitive-state.js +25 -0
- package/dist/styles/LICENSE-shadcn.md +21 -0
- package/dist/styles/color-scheme.css +32 -0
- package/dist/styles/components.css +303 -0
- package/dist/styles/index.css +41 -0
- package/dist/styles/tokens.css +474 -0
- package/dist/styles/typeset/shadcn.css +506 -0
- package/dist/styles/typeset.css +70 -0
- package/dist/styles/utilities.css +555 -0
- package/dist/tools/observe/index.d.ts +2 -0
- package/dist/tools/observe/index.js +3 -0
- package/dist/tools/observe/ui-sdk.d.ts +1 -0
- package/dist/tools/observe/ui-sdk.js +2 -0
- package/dist/tools/testing/check-agent.d.ts +28 -0
- package/dist/tools/testing/check-agent.js +42 -0
- package/dist/tools/testing/index.d.ts +4 -0
- package/dist/tools/testing/index.js +4 -0
- package/dist/tools/testing/ui-sdk.d.ts +1 -0
- package/dist/tools/testing/ui-sdk.js +2 -0
- package/dist/utilities/cn/index.d.ts +12 -0
- package/dist/utilities/cn/index.js +47 -0
- package/dist/utilities/color/index.d.ts +2 -0
- package/dist/utilities/color/index.js +3 -0
- package/dist/utilities/color/ui-sdk.d.ts +1 -0
- package/dist/utilities/color/ui-sdk.js +2 -0
- package/dist/utilities/date/index.d.ts +2 -0
- package/dist/utilities/date/index.js +6 -0
- package/dist/utilities/date/ui-sdk.d.ts +1 -0
- package/dist/utilities/date/ui-sdk.js +2 -0
- package/dist/utilities/image/index.d.ts +2 -0
- package/dist/utilities/image/index.js +3 -0
- package/dist/utilities/image/ui-sdk.d.ts +1 -0
- package/dist/utilities/image/ui-sdk.js +2 -0
- package/dist/utilities/mobile/index.d.ts +2 -0
- package/dist/utilities/mobile/index.js +1 -0
- package/dist/utilities/mobile/ui-sdk.d.ts +2 -0
- package/dist/utilities/mobile/ui-sdk.js +1 -0
- package/dist/utilities/number/index.d.ts +2 -0
- package/dist/utilities/number/index.js +3 -0
- package/dist/utilities/number/ui-sdk.d.ts +1 -0
- package/dist/utilities/number/ui-sdk.js +2 -0
- package/dist/utilities/platform/index.d.ts +3 -0
- package/dist/utilities/platform/index.js +14 -0
- package/dist/utilities/platform/ui-sdk.d.ts +3 -0
- package/dist/utilities/platform/ui-sdk.js +3 -0
- package/dist/utilities/storage/index.d.ts +2 -0
- package/dist/utilities/storage/index.js +1 -0
- package/dist/utilities/storage/ui-sdk.d.ts +2 -0
- package/dist/utilities/storage/ui-sdk.js +1 -0
- package/dist/utilities/text/index.d.ts +3 -0
- package/dist/utilities/text/index.js +3 -0
- package/dist/utilities/text/ui-sdk.d.ts +3 -0
- package/dist/utilities/text/ui-sdk.js +3 -0
- package/package.json +192 -4
- package/skills/agent-ready-ui/SKILL.md +229 -0
- package/skills/blocks/SKILL.md +262 -0
- package/skills/compose-screens/SKILL.md +354 -0
- package/skills/note-editor/SKILL.md +493 -0
- package/skills/note-status/SKILL.md +295 -0
- package/skills/setup/SKILL.md +136 -0
- package/skills/theming/SKILL.md +216 -0
- package/src/blocks/notes/adapters.ts +77 -0
- package/src/blocks/notes/data.ts +508 -0
- package/src/blocks/notes/notes-block.tsx +244 -0
- package/src/blocks/notes/parts/home.tsx +219 -0
- package/src/blocks/notes/parts/no-access.tsx +84 -0
- package/src/blocks/notes/parts/note-screen.tsx +412 -0
- package/src/blocks/notes/parts/notes-sidebar.tsx +277 -0
- package/src/blocks/notes/parts/panels.tsx +393 -0
- package/src/blocks/notes/parts/place.ts +15 -0
- package/src/blocks/notes/parts/review-dialog.tsx +159 -0
- package/src/blocks/notes/parts/share.tsx +172 -0
- package/src/blocks/notes/texts.ts +135 -0
- package/src/blocks/shell/adapters.ts +69 -0
- package/src/blocks/shell/data.ts +281 -0
- package/src/blocks/shell/parts/compose.tsx +292 -0
- package/src/blocks/shell/parts/home.tsx +203 -0
- package/src/blocks/shell/parts/marks.tsx +144 -0
- package/src/blocks/shell/parts/rail.tsx +166 -0
- package/src/blocks/shell/parts/rooms-column.tsx +326 -0
- package/src/blocks/shell/shell-block.tsx +210 -0
- package/src/blocks/shell/texts.ts +80 -0
|
@@ -0,0 +1,493 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: note-editor
|
|
3
|
+
description: "Use when adding a Notion-style note or document editor to an app
|
|
4
|
+
built with abby: NoteEditor with its header, title, templates, the / and @
|
|
5
|
+
menus and the format toolbar; saving the note as blocks with ids and inline
|
|
6
|
+
Markdown; refusing a change; read-only notes; showing who else is in the note,
|
|
7
|
+
their cursors, comment threads and an offline bar; showing what the assistant
|
|
8
|
+
or an agent proposes; showing a past version with its changes and the history
|
|
9
|
+
column; and letting an AI agent read and edit the blocks and the threads."
|
|
10
|
+
metadata:
|
|
11
|
+
purpose: Shows how to put abby's block editor in an app, keep the note as blocks
|
|
12
|
+
the app owns, compose its header and menus, and let an agent edit the same
|
|
13
|
+
blocks a person does.
|
|
14
|
+
type: core
|
|
15
|
+
library: abby
|
|
16
|
+
library_version: 0.1.0
|
|
17
|
+
requires:
|
|
18
|
+
- compose-screens
|
|
19
|
+
- agent-ready-ui
|
|
20
|
+
sources:
|
|
21
|
+
- src/components/note-editor/note-editor.tsx
|
|
22
|
+
- src/components/note-editor/blocks.ts
|
|
23
|
+
- src/components/note-editor/editor.ts
|
|
24
|
+
- src/components/note-editor/people.ts
|
|
25
|
+
- src/components/note-editor/person.ts
|
|
26
|
+
- src/components/note-editor/diff.ts
|
|
27
|
+
- src/components/note-editor/parts/*.tsx
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
# Add a note editor with abby
|
|
31
|
+
|
|
32
|
+
Read the compose-screens skill first; read agent-ready-ui before letting an agent edit notes. `abby/note-editor` is a block editor on Tiptap that abby installs with itself: the app adds no editor package. The note is an array of blocks the app saves, not HTML.
|
|
33
|
+
|
|
34
|
+
## Setup
|
|
35
|
+
|
|
36
|
+
1. Make sure the app imports `abby/styles.css` once (see the setup skill).
|
|
37
|
+
2. Render a `NoteEditor` in a client component with the blocks the note starts with, and save what `onValueChange` reports.
|
|
38
|
+
|
|
39
|
+
```tsx
|
|
40
|
+
"use client";
|
|
41
|
+
|
|
42
|
+
import { NoteEditor, type NoteBlock } from "abby/note-editor";
|
|
43
|
+
|
|
44
|
+
const initial: NoteBlock[] = [
|
|
45
|
+
{ id: "goal", type: "heading-2", text: "Goal" },
|
|
46
|
+
{ id: "goal-text", type: "paragraph", text: "Ship the **Mac app** by June." },
|
|
47
|
+
{ id: "todo-1", type: "todo", text: "Write the release notes", checked: false },
|
|
48
|
+
];
|
|
49
|
+
|
|
50
|
+
export function ReleaseNote({ save }: { save: (blocks: NoteBlock[]) => void }) {
|
|
51
|
+
return (
|
|
52
|
+
<div className="mx-auto max-w-170">
|
|
53
|
+
<NoteEditor
|
|
54
|
+
label="Release plan"
|
|
55
|
+
defaultValue={initial}
|
|
56
|
+
onValueChange={(blocks) => save(blocks)}
|
|
57
|
+
/>
|
|
58
|
+
</div>
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Check: typing in the note calls `save` with the blocks, and `/` opens the block menu.
|
|
64
|
+
|
|
65
|
+
## The block model
|
|
66
|
+
|
|
67
|
+
Each block is `{ id, type, text }`, plus `checked` on a to-do, `indent` on a list item and `language` on code.
|
|
68
|
+
|
|
69
|
+
| `type` | What it is |
|
|
70
|
+
| ------------------------------------- | --------------------------------------- |
|
|
71
|
+
| `paragraph` | Text |
|
|
72
|
+
| `heading-1`, `heading-2`, `heading-3` | Headings |
|
|
73
|
+
| `bulleted`, `numbered`, `todo` | List items; `indent` nests them, from 0 |
|
|
74
|
+
| `quote`, `code`, `divider` | A quote, a code block, a rule |
|
|
75
|
+
|
|
76
|
+
- `text` is inline Markdown: `**bold**`, `*italic*`, `<u>underline</u>`, `~~strike~~`, `` `code` ``, `[link](https://…)`. A line break inside a block is `\n`. A code block's text is kept as typed.
|
|
77
|
+
- A mention is a link to `mention:<id>`: `[@Kofi Mensah](mention:kofi)`. Read mentions out of the blocks with that pattern to notify people. `mentions` on `NoteEditor` takes the people `@` suggests, as `{ value, label }` data or a loader `(query, { signal }) => Promise<items>`; without it, `@` is plain text.
|
|
78
|
+
- `id` is stable across edits; comments, presence and suggestions point at it. Keep the ids the editor reports. A block without an id gets one, and a repeated id is replaced.
|
|
79
|
+
- `noteBlockTypes` lists the types; an unknown type throws an error that lists them.
|
|
80
|
+
|
|
81
|
+
## Core Patterns
|
|
82
|
+
|
|
83
|
+
### Compose the whole note
|
|
84
|
+
|
|
85
|
+
With no children, `NoteEditor` renders `NoteEditorContent`, `NoteEditorMenu` (the `/` and `@` suggestions), `NoteEditorToolbar` (the toolbar over selected text), `NoteEditorComments` and `NoteEditorSuggestions`. To add the header and the templates, compose all of them yourself:
|
|
86
|
+
|
|
87
|
+
```tsx
|
|
88
|
+
"use client";
|
|
89
|
+
|
|
90
|
+
import {
|
|
91
|
+
NoteEditor,
|
|
92
|
+
NoteEditorContent,
|
|
93
|
+
NoteEditorHeader,
|
|
94
|
+
NoteEditorMenu,
|
|
95
|
+
NoteEditorMeta,
|
|
96
|
+
NoteEditorMetaMark,
|
|
97
|
+
NoteEditorTemplate,
|
|
98
|
+
NoteEditorTemplates,
|
|
99
|
+
NoteEditorTitle,
|
|
100
|
+
NoteEditorToolbar,
|
|
101
|
+
type NoteBlock,
|
|
102
|
+
type NoteBlockInput,
|
|
103
|
+
} from "abby/note-editor";
|
|
104
|
+
|
|
105
|
+
const prd: NoteBlockInput[] = [
|
|
106
|
+
{ type: "heading-2", text: "Problem" },
|
|
107
|
+
{ type: "paragraph", text: "" },
|
|
108
|
+
{ type: "heading-2", text: "Goals" },
|
|
109
|
+
{ type: "bulleted", text: "" },
|
|
110
|
+
];
|
|
111
|
+
|
|
112
|
+
type Props = {
|
|
113
|
+
title: string;
|
|
114
|
+
blocks: NoteBlock[];
|
|
115
|
+
onTitleChange: (title: string) => void;
|
|
116
|
+
onBlocksChange: (blocks: NoteBlock[]) => void;
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
export function Note({ title, blocks, onTitleChange, onBlocksChange }: Props) {
|
|
120
|
+
return (
|
|
121
|
+
<NoteEditor
|
|
122
|
+
label="Note"
|
|
123
|
+
value={blocks}
|
|
124
|
+
onValueChange={(next) => onBlocksChange(next)}
|
|
125
|
+
className="mx-auto max-w-170"
|
|
126
|
+
>
|
|
127
|
+
<NoteEditorHeader>
|
|
128
|
+
<NoteEditorMeta>
|
|
129
|
+
<NoteEditorMetaMark className="bg-brand" />
|
|
130
|
+
<span>Product</span>
|
|
131
|
+
<span aria-hidden="true">•</span>
|
|
132
|
+
<span>Edited 2 min ago</span>
|
|
133
|
+
</NoteEditorMeta>
|
|
134
|
+
<NoteEditorTitle value={title} onValueChange={(next) => onTitleChange(next)} />
|
|
135
|
+
</NoteEditorHeader>
|
|
136
|
+
<NoteEditorContent label="Note" />
|
|
137
|
+
<NoteEditorTemplates>
|
|
138
|
+
<span>Start with</span>
|
|
139
|
+
<NoteEditorTemplate blocks={prd}>PRD</NoteEditorTemplate>
|
|
140
|
+
</NoteEditorTemplates>
|
|
141
|
+
<NoteEditorMenu />
|
|
142
|
+
<NoteEditorToolbar />
|
|
143
|
+
</NoteEditor>
|
|
144
|
+
);
|
|
145
|
+
}
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
- `NoteEditorTitle` is a text field named "Title" that grows with the title; Enter moves to the note. The app keeps the title apart from the blocks.
|
|
149
|
+
- `NoteEditorTemplates` shows only while the note is empty and editable. `NoteEditorTemplate` replaces the blocks with its own.
|
|
150
|
+
- With children, also render `NoteEditorComments` if the note has threads and `NoteEditorSuggestions` if it has suggestions.
|
|
151
|
+
- `NoteEditorToolbar`'s children, like an "Ask the assistant" button, go after a separator. Its items are 28px tall with 8px corners, as in Alma's format toolbar: give a button `size="sm"`, and the toolbar rounds it to match.
|
|
152
|
+
|
|
153
|
+
Check: the note shows its meta line and title, an empty note shows the templates, and selecting text shows the toolbar.
|
|
154
|
+
|
|
155
|
+
### Save the note, or refuse a change
|
|
156
|
+
|
|
157
|
+
Pass `value` with `onValueChange` to control the blocks, or `defaultValue` alone. The second argument says why it changed (`details.reason`: `input-change`, `imperative`, `block-insert`, `block-update`, `block-remove`) and who changed it (`details.source`, `"agent"` for an agent). `details.cancel()` refuses it, and the editor puts the text back:
|
|
158
|
+
|
|
159
|
+
```tsx
|
|
160
|
+
"use client";
|
|
161
|
+
|
|
162
|
+
import { NoteEditor, type NoteBlock } from "abby/note-editor";
|
|
163
|
+
import { useState } from "react";
|
|
164
|
+
|
|
165
|
+
export function LockedHeadings({ initial }: { initial: NoteBlock[] }) {
|
|
166
|
+
const [blocks, setBlocks] = useState(initial);
|
|
167
|
+
return (
|
|
168
|
+
<NoteEditor
|
|
169
|
+
label="Spec"
|
|
170
|
+
value={blocks}
|
|
171
|
+
onValueChange={(next, details) => {
|
|
172
|
+
const removedHeading = blocks.some(
|
|
173
|
+
(block) => block.type.startsWith("heading") && !next.some((kept) => kept.id === block.id),
|
|
174
|
+
);
|
|
175
|
+
if (removedHeading) return details.cancel();
|
|
176
|
+
setBlocks(next);
|
|
177
|
+
}}
|
|
178
|
+
/>
|
|
179
|
+
);
|
|
180
|
+
}
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
Check: deleting a heading puts it back; other edits are kept.
|
|
184
|
+
|
|
185
|
+
### Translate or extend the `/` menu
|
|
186
|
+
|
|
187
|
+
`commands` replaces the menu's choices; `noteEditorCommands` is the default list, in English. A choice whose `value` is a block type turns the block into it. Any other value goes to `onCommand` with the id of the block it was typed in, after the `/` and its query are removed:
|
|
188
|
+
|
|
189
|
+
```tsx
|
|
190
|
+
"use client";
|
|
191
|
+
|
|
192
|
+
import { NoteEditor, noteEditorCommands } from "abby/note-editor";
|
|
193
|
+
|
|
194
|
+
// One label per block type in `noteBlockTypes`.
|
|
195
|
+
const spanish: Record<string, string> = { paragraph: "Texto", "heading-1": "Título 1" };
|
|
196
|
+
|
|
197
|
+
const commands = [
|
|
198
|
+
...noteEditorCommands.map((command) => ({
|
|
199
|
+
...command,
|
|
200
|
+
label: spanish[command.value] ?? command.label,
|
|
201
|
+
})),
|
|
202
|
+
{ value: "ask", label: "Preguntar al asistente", keywords: ["ia"] },
|
|
203
|
+
];
|
|
204
|
+
|
|
205
|
+
export function SpanishNote({ ask }: { ask: (blockId: string | undefined) => void }) {
|
|
206
|
+
return (
|
|
207
|
+
<NoteEditor label="Nota" commands={commands} onCommand={(value, { blockId }) => ask(blockId)} />
|
|
208
|
+
);
|
|
209
|
+
}
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
Translate the toolbar with `labels` on `NoteEditorToolbar` (`labels={{ toolbar: "Formato", bold: "Negrita", blocks: { paragraph: "Texto" } }}`), and the to-do's checkbox name with `todoLabel` on `NoteEditorContent`.
|
|
213
|
+
|
|
214
|
+
### Show a note read-only
|
|
215
|
+
|
|
216
|
+
`readOnly` keeps the note selectable and readable, with no menus, no toolbar, no templates and no edits. To-dos can't be ticked. Threads still open: commented text becomes a button (click, Enter or Space) and focus moves into the thread and back. The thread shows Reply only with `onCommentReply` and Resolve only with `onCommentResolve`, so leave them out for a note people only read.
|
|
217
|
+
|
|
218
|
+
### Show who else is in the note
|
|
219
|
+
|
|
220
|
+
abby draws the others; the app syncs them. Pass `presence`, one entry per other person, and send your own caret to them from `onCursorChange`:
|
|
221
|
+
|
|
222
|
+
```tsx
|
|
223
|
+
"use client";
|
|
224
|
+
|
|
225
|
+
import { WifiDisconnected01Icon } from "@hugeicons/core-free-icons";
|
|
226
|
+
import {
|
|
227
|
+
NoteEditor,
|
|
228
|
+
NoteEditorBanner,
|
|
229
|
+
NoteEditorPresence,
|
|
230
|
+
type NoteBlock,
|
|
231
|
+
type NoteCursor,
|
|
232
|
+
type NotePresence,
|
|
233
|
+
} from "abby/note-editor";
|
|
234
|
+
|
|
235
|
+
type Props = {
|
|
236
|
+
blocks: NoteBlock[];
|
|
237
|
+
others: NotePresence[];
|
|
238
|
+
online: boolean;
|
|
239
|
+
onBlocksChange: (blocks: NoteBlock[]) => void;
|
|
240
|
+
sendCursor: (cursor: NoteCursor | null) => void;
|
|
241
|
+
};
|
|
242
|
+
|
|
243
|
+
export function SharedNote({ blocks, others, online, onBlocksChange, sendCursor }: Props) {
|
|
244
|
+
return (
|
|
245
|
+
<div className="flex flex-col">
|
|
246
|
+
<header className="flex items-center gap-3 border-b border-border pb-3">
|
|
247
|
+
<h1 className="flex-1 text-label">Roadmap 2027</h1>
|
|
248
|
+
<NoteEditorPresence people={others} />
|
|
249
|
+
</header>
|
|
250
|
+
{!online && (
|
|
251
|
+
<NoteEditorBanner icon={WifiDisconnected01Icon}>
|
|
252
|
+
Offline. Your changes are saved here and merge when you're back.
|
|
253
|
+
</NoteEditorBanner>
|
|
254
|
+
)}
|
|
255
|
+
<NoteEditor
|
|
256
|
+
label="Roadmap 2027"
|
|
257
|
+
value={blocks}
|
|
258
|
+
onValueChange={(next) => onBlocksChange(next)}
|
|
259
|
+
presence={others}
|
|
260
|
+
onCursorChange={(cursor) => sendCursor(cursor)}
|
|
261
|
+
className="pt-6"
|
|
262
|
+
/>
|
|
263
|
+
</div>
|
|
264
|
+
);
|
|
265
|
+
}
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
- A person is `{ id, name, color?, image? }`, plus `cursor` (`{ blockId, offset }`) or a bare `blockId`. Each block with someone in it gets a bar in the margin; a cursor shows their name for 3 s after it moves.
|
|
269
|
+
- `offset` counts the characters a person reads in the block, a line break as one. It is not an index into the block's Markdown `text`: `**` and link targets don't count. Use the offsets `onCursorChange` reports as they are.
|
|
270
|
+
- `color` takes any CSS color. Without it, the person's `id` picks one of the four `presence-*` tokens, so a person keeps their color as others come and go. Leave out yourself.
|
|
271
|
+
- `NoteEditorPresence` shows nothing when `people` is empty. Inside `NoteEditor` it reads `presence` by itself. `label` translates its "{n} here".
|
|
272
|
+
- `NoteEditorBanner` is a quiet bar under the page's header, `role="status"`, never a floating toast. `media` and `end` take an avatar and a time for notices like "Marta moved it to In review".
|
|
273
|
+
|
|
274
|
+
Check: two windows of the app show each other's bars and named cursors, and the offline bar appears with the network off while typing goes on.
|
|
275
|
+
|
|
276
|
+
### Comment on text
|
|
277
|
+
|
|
278
|
+
The app keeps the threads. Pass them as `comments`; each one points at text in a block by quoting it:
|
|
279
|
+
|
|
280
|
+
```tsx
|
|
281
|
+
"use client";
|
|
282
|
+
|
|
283
|
+
import {
|
|
284
|
+
NoteEditor,
|
|
285
|
+
type NoteBlock,
|
|
286
|
+
type NoteComment,
|
|
287
|
+
type NoteCommentAnchor,
|
|
288
|
+
} from "abby/note-editor";
|
|
289
|
+
|
|
290
|
+
type Props = {
|
|
291
|
+
blocks: NoteBlock[];
|
|
292
|
+
threads: NoteComment[];
|
|
293
|
+
startThread: (anchor: NoteCommentAnchor, byAgent: boolean) => void;
|
|
294
|
+
reply: (threadId: string, text: string, byAgent: boolean) => void;
|
|
295
|
+
resolve: (threadId: string) => void;
|
|
296
|
+
};
|
|
297
|
+
|
|
298
|
+
export function ReviewedNote({ blocks, threads, startThread, reply, resolve }: Props) {
|
|
299
|
+
return (
|
|
300
|
+
<NoteEditor
|
|
301
|
+
label="Spec"
|
|
302
|
+
defaultValue={blocks}
|
|
303
|
+
comments={threads}
|
|
304
|
+
onComment={(anchor, details) => startThread(anchor, details.source === "agent")}
|
|
305
|
+
onCommentReply={(id, text, details) => reply(id, text, details.source === "agent")}
|
|
306
|
+
onCommentResolve={(id) => resolve(id)}
|
|
307
|
+
/>
|
|
308
|
+
);
|
|
309
|
+
}
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
- A thread is `{ id, blockId, quote, resolved?, messages }`, and a message `{ id, author, time?, text }`. The first match of `quote` in the block's visible text gets an amber underline; once that text is gone, the mark goes and the app can list the thread elsewhere. A resolved thread has no mark.
|
|
313
|
+
- The thread opens while the caret is in its text, without taking focus; Alt+F10 moves focus into it, Escape hides it. A thread with no messages yet focuses its field, which is how a new thread starts.
|
|
314
|
+
- With `onComment`, the format toolbar shows Comment for text inside one block. It reports `{ blockId, quote }`; add the thread to `comments` with `messages: []` and it opens at the caret. An agent's comment also carries `text`, its first message: start the thread with it.
|
|
315
|
+
- Every callback's last argument is `{ source: "person" | "agent" }`: pick the author from it.
|
|
316
|
+
- Translate the thread with `labels` on `NoteEditorComments` (`panel`, `reply(author)`, `replyPlaceholder`, `send`, `resolve`); compose it next to `NoteEditorToolbar` when you pass children.
|
|
317
|
+
|
|
318
|
+
Check: clicking underlined text opens its thread, a reply calls `onCommentReply`, and Resolve removes the underline.
|
|
319
|
+
|
|
320
|
+
### Show what the assistant or an agent proposes
|
|
321
|
+
|
|
322
|
+
A suggestion shows under its block and never writes into the note. The app keeps them, and on Accept applies the text through `value` and drops the suggestion:
|
|
323
|
+
|
|
324
|
+
```tsx
|
|
325
|
+
"use client";
|
|
326
|
+
|
|
327
|
+
import { NoteEditor, type NoteBlock, type NoteSuggestion } from "abby/note-editor";
|
|
328
|
+
|
|
329
|
+
type Props = {
|
|
330
|
+
blocks: NoteBlock[];
|
|
331
|
+
suggestions: NoteSuggestion[];
|
|
332
|
+
onBlocksChange: (blocks: NoteBlock[]) => void;
|
|
333
|
+
drop: (id: string) => void;
|
|
334
|
+
};
|
|
335
|
+
|
|
336
|
+
export function AssistedNote({ blocks, suggestions, onBlocksChange, drop }: Props) {
|
|
337
|
+
return (
|
|
338
|
+
<NoteEditor
|
|
339
|
+
label="Roadmap"
|
|
340
|
+
value={blocks}
|
|
341
|
+
onValueChange={(next) => onBlocksChange(next)}
|
|
342
|
+
suggestions={suggestions}
|
|
343
|
+
onSuggestionAccept={(suggestion) => {
|
|
344
|
+
onBlocksChange(
|
|
345
|
+
blocks.map((block) =>
|
|
346
|
+
block.id === suggestion.blockId
|
|
347
|
+
? { ...block, text: `${block.text}\n${suggestion.text}` }
|
|
348
|
+
: block,
|
|
349
|
+
),
|
|
350
|
+
);
|
|
351
|
+
drop(suggestion.id);
|
|
352
|
+
}}
|
|
353
|
+
onSuggestionDiscard={(suggestion) => drop(suggestion.id)}
|
|
354
|
+
/>
|
|
355
|
+
);
|
|
356
|
+
}
|
|
357
|
+
```
|
|
358
|
+
|
|
359
|
+
- A suggestion is `{ id, blockId, author, kind?, summary?, text, source?, state?, staleReason?, conflict? }`. `kind: "assistant"` is the note's own assistant, in the `assistant` violet; `"agent"`, the default, is a plain card. `summary` follows the author's name ("proposes adding to bet 1"), `source` says what it read, `conflict` is an amber line said before anyone accepts.
|
|
360
|
+
- `state`: `writing` (dashed, with a caret and no buttons), `proposed` (the default: Discard and Accept), `stale` (the block changed after: "Out of date · {staleReason}", with Redo when `onSuggestionRedo` is passed and Discard, never Accept).
|
|
361
|
+
- Accept carries `data-agent-confirm`: an agent can discard a suggestion, but accepting needs the person. Each button is named "{Accept}: {author}'s suggestion on «{block}»", so several never share a name.
|
|
362
|
+
- `NoteEditorSuggestion` draws one suggestion anywhere, like a list beside the note, with `onAccept`, `onDiscard` and `onRedo`. Translate either with `labels` (`accept`, `discard`, `redo`, `stale`, `suggestion(author, block)`).
|
|
363
|
+
|
|
364
|
+
Check: accepting writes the text into the note as normal text and the suggestion goes; typing above it keeps it under its block.
|
|
365
|
+
|
|
366
|
+
### Show a past version and the history
|
|
367
|
+
|
|
368
|
+
`diffNotes(before, after)` compares two versions block by block, by id. Show the result in a read-only note; a column of `NoteEditorHistory` parts lists the versions:
|
|
369
|
+
|
|
370
|
+
```tsx
|
|
371
|
+
"use client";
|
|
372
|
+
|
|
373
|
+
import { PencilEdit02Icon } from "@hugeicons/core-free-icons";
|
|
374
|
+
import {
|
|
375
|
+
diffNotes,
|
|
376
|
+
NoteEditor,
|
|
377
|
+
NoteEditorHistory,
|
|
378
|
+
NoteEditorHistoryDay,
|
|
379
|
+
NoteEditorHistoryEvent,
|
|
380
|
+
NoteEditorHistoryEventDetail,
|
|
381
|
+
NoteEditorHistoryEventTitle,
|
|
382
|
+
type NoteBlock,
|
|
383
|
+
} from "abby/note-editor";
|
|
384
|
+
|
|
385
|
+
type Props = { before: NoteBlock[]; version: NoteBlock[] };
|
|
386
|
+
|
|
387
|
+
export function VersionPage({ before, version }: Props) {
|
|
388
|
+
const diff = diffNotes(before, version);
|
|
389
|
+
return (
|
|
390
|
+
<div className="flex gap-6">
|
|
391
|
+
<NoteEditor
|
|
392
|
+
label="Yesterday's version"
|
|
393
|
+
readOnly
|
|
394
|
+
value={diff.blocks}
|
|
395
|
+
changes={diff.changes}
|
|
396
|
+
className="flex-1"
|
|
397
|
+
/>
|
|
398
|
+
<NoteEditorHistory className="w-85 shrink-0 border-s border-border ps-5">
|
|
399
|
+
<NoteEditorHistoryDay label="Yesterday">
|
|
400
|
+
<NoteEditorHistoryEvent icon={PencilEdit02Icon} viewing>
|
|
401
|
+
<NoteEditorHistoryEventTitle time="17:42">
|
|
402
|
+
<strong>Ana</strong> edited «Three bets»
|
|
403
|
+
</NoteEditorHistoryEventTitle>
|
|
404
|
+
<NoteEditorHistoryEventDetail>{diff.added} added</NoteEditorHistoryEventDetail>
|
|
405
|
+
</NoteEditorHistoryEvent>
|
|
406
|
+
</NoteEditorHistoryDay>
|
|
407
|
+
</NoteEditorHistory>
|
|
408
|
+
</div>
|
|
409
|
+
);
|
|
410
|
+
}
|
|
411
|
+
```
|
|
412
|
+
|
|
413
|
+
- The version is read-only, so it takes `value` with no `onValueChange`: nothing in it can change.
|
|
414
|
+
- A changed block shows its old text struck through (`removed`) above its new text (`changed`, tinted like `added`), and keeps its list number. Each marked row tells a screen reader "Added" or "Removed" (`changeLabels`). `diff.added` and `diff.removed` count rows.
|
|
415
|
+
- One `NoteEditorHistoryDay` per day, with the day's name from the app's data ("Today", "Yesterday"); never compute it from `Date` during render. `viewing` marks the version on show (`aria-current`).
|
|
416
|
+
- `NoteEditorHistoryEventAction` is an inline action in a detail, like "See the changes". Each needs a name that holds its text and stands alone: "See the changes: Diego, 09:31". `NoteEditorHistoryEventQuote` boxes the text a change touched; `media={<NoteEditorAssistantMark />}` marks the assistant's events.
|
|
417
|
+
- A filter is the app's: a `SegmentedControl` named "Show" that filters what it passes in.
|
|
418
|
+
|
|
419
|
+
Check: the version shows its removed text struck and its added text tinted, and the history marks the version on show.
|
|
420
|
+
|
|
421
|
+
### Let an agent edit the note
|
|
422
|
+
|
|
423
|
+
The `NoteEditor` is one agent entry named by its `label`. Its value is the blocks and its `comments` the threads, and its actions are `setValue(blocks)`, `insertBlock(block, afterId?)` (`null` inserts at the start, no id appends; returns the new id), `updateBlock(id, patch)`, `removeBlock(id)`, `addComment(blockId, quote, text)`, `replyToComment(id, text)` and `resolveComment(id)`. The comment actions call the app's callbacks with `source: "agent"`, without opening a thread; a quote that isn't in the block's visible text fails with that text, so the agent can try again. An agent writes mentions and formatting as Markdown in `text`. The `/` and `@` menus are hidden from agents; the title (`NoteEditorTitle`) and each template are their own entries.
|
|
424
|
+
|
|
425
|
+
```ts
|
|
426
|
+
import { createAgent } from "abby/agents";
|
|
427
|
+
|
|
428
|
+
const agent = createAgent();
|
|
429
|
+
|
|
430
|
+
export async function addRisk() {
|
|
431
|
+
return agent.act({
|
|
432
|
+
steps: [
|
|
433
|
+
{
|
|
434
|
+
ref: "Note",
|
|
435
|
+
action: "insertBlock",
|
|
436
|
+
args: [{ type: "bulleted", text: "Risk: **App Store review**" }, "goal-text"],
|
|
437
|
+
},
|
|
438
|
+
],
|
|
439
|
+
});
|
|
440
|
+
}
|
|
441
|
+
```
|
|
442
|
+
|
|
443
|
+
Refuse an agent's change in `onValueChange` with `details.source === "agent"` and `details.cancel()`. `act()` reports no error for a refused step: read the value afterwards (see agent-ready-ui).
|
|
444
|
+
|
|
445
|
+
## Common Mistakes
|
|
446
|
+
|
|
447
|
+
### HIGH: Passing `value` without `onValueChange`
|
|
448
|
+
|
|
449
|
+
```tsx
|
|
450
|
+
<NoteEditor value={blocks} />
|
|
451
|
+
```
|
|
452
|
+
|
|
453
|
+
A controlled note the app doesn't update can't change: each keystroke is undone right after it lands. Pass `onValueChange` that stores the blocks, or use `defaultValue`. Source: `src/components/note-editor/note-editor.tsx` (`reconcile`).
|
|
454
|
+
|
|
455
|
+
### HIGH: Composing children without `NoteEditorMenu`
|
|
456
|
+
|
|
457
|
+
With children, `NoteEditor` renders only what you pass. Leaving out `NoteEditorMenu` makes `/` and `@` open ui-sdk's unstyled list instead of abby's. Leave out `NoteEditorToolbar` only on purpose. Source: `@ui-sdk/react/trigger-menu` renders its own content when none is placed.
|
|
458
|
+
|
|
459
|
+
### HIGH: Rewriting ids on every save
|
|
460
|
+
|
|
461
|
+
Mapping blocks to new ids (`blocks.map((b) => ({ ...b, id: crypto.randomUUID() }))`) or rebuilding blocks from HTML loses what points at them, and the editor sees every block as new. Store and pass back the ids it reports.
|
|
462
|
+
|
|
463
|
+
### MEDIUM: Expecting HTML or Tiptap JSON
|
|
464
|
+
|
|
465
|
+
The value is blocks with inline Markdown. Render a note elsewhere from the blocks (for example with `abby/typeset.css` over Markdown you join from them), not from the editor's DOM.
|
|
466
|
+
|
|
467
|
+
### HIGH: Counting cursor offsets in the Markdown
|
|
468
|
+
|
|
469
|
+
```ts
|
|
470
|
+
const offset = block.text.indexOf("always");
|
|
471
|
+
```
|
|
472
|
+
|
|
473
|
+
In `**Ship** it always`, that lands four characters late: `offset` counts what a person reads, without `**`, `<u>` or link targets. Send the offsets `onCursorChange` reports, and quote comments with the text a person selected (what `onComment` reports). Source: `src/components/note-editor/people.ts` (`positionOf`, `commentRange`).
|
|
474
|
+
|
|
475
|
+
### HIGH: Writing a suggestion into the note before Accept
|
|
476
|
+
|
|
477
|
+
```tsx
|
|
478
|
+
<NoteEditor value={[...blocks, { type: "paragraph", text: proposal.text }]} />
|
|
479
|
+
```
|
|
480
|
+
|
|
481
|
+
The assistant's text then reads as the note's own, and no one accepted it. Pass it as `suggestions`, and apply it in `onSuggestionAccept`. Source: `src/components/note-editor/parts/suggestions.tsx`.
|
|
482
|
+
|
|
483
|
+
### MEDIUM: Expecting real-time collaboration built in
|
|
484
|
+
|
|
485
|
+
abby doesn't sync notes between people. The app saves blocks and merges them, and passes the others' presence and the threads back as props; abby only draws them and reports your caret.
|
|
486
|
+
|
|
487
|
+
## Completion
|
|
488
|
+
|
|
489
|
+
- Typing calls `onValueChange` with the blocks, and a reload with the saved blocks shows the same note.
|
|
490
|
+
- `/` turns a block into a heading or a list, `@` inserts a mention, and selecting text shows the toolbar.
|
|
491
|
+
- With `presence`, each other person has a bar beside their block and a named cursor; with `comments`, commented text is underlined and opens its thread, in a read-only note too.
|
|
492
|
+
- With `suggestions`, each one shows under its block and Accept writes it in through the app; a past version in a read-only note marks what changed.
|
|
493
|
+
- In tests, `checkAgent(agent)` passes with the note on the page and an agent's `insertBlock` adds a block. If an entry has no name, give `NoteEditor` a `label`.
|