@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,954 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { createChange, definePrimitive } from "../../core/ui-sdk.js";
|
|
3
|
+
import { usePrimitiveState } from "../../core/use-primitive-state.js";
|
|
4
|
+
import { core_exports } from "../../core/index.js";
|
|
5
|
+
import { cn, cnState } from "../../utilities/cn/index.js";
|
|
6
|
+
import { Icon } from "../icon/icon.js";
|
|
7
|
+
import { TriggerMenu, TriggerMenuContent, TriggerMenuItem, TriggerMenuItemIcon, TriggerMenuItems, TriggerMenuList, TriggerMenuStatus } from "../trigger-menu/trigger-menu.js";
|
|
8
|
+
import { blocksToDoc, docToBlocks, isNoteBlockType, newBlockId, normalizeBlocks, noteBlockTypes, sameBlocks } from "./blocks.js";
|
|
9
|
+
import { diffNotes } from "./diff.js";
|
|
10
|
+
import { NoteEditorContext, REMOTE, noteAdapter, setBlockType } from "./editor.js";
|
|
11
|
+
import { blockIdAt, blockText, commentRange, cursorAt, peoplePlugin, setPeople } from "./people.js";
|
|
12
|
+
import { NoteEditorHistory, NoteEditorHistoryDay, NoteEditorHistoryEvent, NoteEditorHistoryEventAction, NoteEditorHistoryEventDetail, NoteEditorHistoryEventQuote, NoteEditorHistoryEventTitle } from "./parts/history.js";
|
|
13
|
+
import { NoteEditorAssistantMark, NoteEditorSuggestion, NoteEditorSuggestions } from "./parts/suggestions.js";
|
|
14
|
+
import { NoteEditorComments } from "./parts/comments.js";
|
|
15
|
+
import { NoteEditorHeader, NoteEditorMeta, NoteEditorMetaMark, NoteEditorTemplate, NoteEditorTemplates, NoteEditorTitle } from "./parts/header.js";
|
|
16
|
+
import { NoteEditorBanner, NoteEditorPresence } from "./parts/presence.js";
|
|
17
|
+
import { NoteEditorToolbar } from "./parts/toolbar.js";
|
|
18
|
+
import { c } from "react/compiler-runtime";
|
|
19
|
+
import { createContext, use, useEffect, useState } from "react";
|
|
20
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
21
|
+
import { CheckListIcon, Heading01Icon, Heading02Icon, Heading03Icon, LeftToRightListBulletIcon, LeftToRightListNumberIcon, MinusSignIcon, QuoteDownIcon, SourceCodeIcon, TextIcon } from "@hugeicons/core-free-icons";
|
|
22
|
+
import { Editor, Extension } from "@tiptap/core";
|
|
23
|
+
import UniqueID from "@tiptap/extension-unique-id";
|
|
24
|
+
import { Plugin } from "@tiptap/pm/state";
|
|
25
|
+
import { TaskItem, TaskList } from "@tiptap/extension-list";
|
|
26
|
+
import { Placeholder } from "@tiptap/extensions";
|
|
27
|
+
import { Markdown } from "@tiptap/markdown";
|
|
28
|
+
import StarterKit from "@tiptap/starter-kit";
|
|
29
|
+
// src/components/note-editor/note-editor.tsx
|
|
30
|
+
const DEFAULT_PLACEHOLDER = "Start writing";
|
|
31
|
+
const noPeople = [];
|
|
32
|
+
const noComments = [];
|
|
33
|
+
const noSuggestions = [];
|
|
34
|
+
const noChanges = {};
|
|
35
|
+
const isEmpty = (blocks) => blocks.length === 0 || blocks.length === 1 && blocks[0].type === "paragraph" && !blocks[0].text;
|
|
36
|
+
function indexOf(blocks, id) {
|
|
37
|
+
const index = blocks.findIndex((block) => block.id === id);
|
|
38
|
+
if (index === -1) throw new Error(`No block "${String(id)}". Its blocks: ${blocks.map((block) => block.id).join(", ") || "none"}.`);
|
|
39
|
+
return index;
|
|
40
|
+
}
|
|
41
|
+
const normalized = /* @__PURE__ */ new Map();
|
|
42
|
+
const knownComments = /* @__PURE__ */ new Map();
|
|
43
|
+
function stableComments(comments) {
|
|
44
|
+
if (comments.length === 0) return noComments;
|
|
45
|
+
const key = JSON.stringify(comments);
|
|
46
|
+
const known = knownComments.get(key);
|
|
47
|
+
if (known) return known;
|
|
48
|
+
knownComments.set(key, comments);
|
|
49
|
+
if (knownComments.size > 32) knownComments.delete(knownComments.keys().next().value);
|
|
50
|
+
return comments;
|
|
51
|
+
}
|
|
52
|
+
function normalizeValue(value) {
|
|
53
|
+
const key = JSON.stringify(value);
|
|
54
|
+
const known = normalized.get(key);
|
|
55
|
+
if (known) return known;
|
|
56
|
+
const blocks = normalizeBlocks(value);
|
|
57
|
+
normalized.set(key, blocks);
|
|
58
|
+
if (normalized.size > 32) normalized.delete(normalized.keys().next().value);
|
|
59
|
+
return blocks;
|
|
60
|
+
}
|
|
61
|
+
const noteEditor = definePrimitive({
|
|
62
|
+
name: "note-editor",
|
|
63
|
+
options: {
|
|
64
|
+
value: "list",
|
|
65
|
+
defaultValue: "list",
|
|
66
|
+
onValueChange: "callback",
|
|
67
|
+
placeholder: "string",
|
|
68
|
+
readOnly: "boolean",
|
|
69
|
+
comments: "list",
|
|
70
|
+
onComment: "callback",
|
|
71
|
+
onCommentReply: "callback",
|
|
72
|
+
onCommentResolve: "callback"
|
|
73
|
+
},
|
|
74
|
+
controlled: ["value", "comments"],
|
|
75
|
+
state: (options) => ({
|
|
76
|
+
value: normalizeValue(options.value ?? options.defaultValue ?? []),
|
|
77
|
+
placeholder: options.placeholder ?? DEFAULT_PLACEHOLDER,
|
|
78
|
+
readOnly: Boolean(options.readOnly),
|
|
79
|
+
focused: false,
|
|
80
|
+
comments: stableComments(options.comments ?? noComments)
|
|
81
|
+
}),
|
|
82
|
+
sync: (options) => ({
|
|
83
|
+
...options.value === void 0 ? {} : { value: normalizeValue(options.value) },
|
|
84
|
+
placeholder: options.placeholder ?? DEFAULT_PLACEHOLDER,
|
|
85
|
+
readOnly: Boolean(options.readOnly),
|
|
86
|
+
comments: stableComments(options.comments ?? noComments)
|
|
87
|
+
}),
|
|
88
|
+
api: (context) => {
|
|
89
|
+
const change = createChange(context);
|
|
90
|
+
const blocks = () => context.store.get().value;
|
|
91
|
+
let editor = null;
|
|
92
|
+
const agent = { source: "agent" };
|
|
93
|
+
const thread = (id) => {
|
|
94
|
+
const { comments } = context.store.get();
|
|
95
|
+
const found = comments.find((comment) => comment.id === id && !comment.resolved);
|
|
96
|
+
if (found) return found;
|
|
97
|
+
const open = comments.filter((comment) => !comment.resolved);
|
|
98
|
+
throw new Error(`No open thread "${String(id)}". Its threads: ${open.map((comment) => `${comment.id} ("${comment.quote}")`).join(", ") || "none"}.`);
|
|
99
|
+
};
|
|
100
|
+
const message = (text) => {
|
|
101
|
+
const trimmed = typeof text === "string" ? text.trim() : "";
|
|
102
|
+
if (!trimmed) throw new Error("A comment needs some text.");
|
|
103
|
+
return trimmed;
|
|
104
|
+
};
|
|
105
|
+
const write = (next, reason, event) => {
|
|
106
|
+
if (reason !== "input-change" && context.store.get().readOnly) throw new Error("This note is read-only.");
|
|
107
|
+
return change("value", next, {
|
|
108
|
+
reason,
|
|
109
|
+
event
|
|
110
|
+
});
|
|
111
|
+
};
|
|
112
|
+
return {
|
|
113
|
+
/** Replaces every block. */
|
|
114
|
+
setValue: (value, event) => write(normalizeBlocks(value), "imperative", event),
|
|
115
|
+
/**
|
|
116
|
+
* Adds a block after the block with the id `after`, at the start with
|
|
117
|
+
* `null`, or at the end when it's left out. Returns the new block's id.
|
|
118
|
+
*/
|
|
119
|
+
insertBlock: (block, after) => {
|
|
120
|
+
const current = blocks();
|
|
121
|
+
const at = after === void 0 ? current.length : after === null ? 0 : indexOf(current, after) + 1;
|
|
122
|
+
const id = typeof block?.id === "string" && block.id ? block.id : newBlockId();
|
|
123
|
+
write(normalizeBlocks([
|
|
124
|
+
...current.slice(0, at),
|
|
125
|
+
{
|
|
126
|
+
...block,
|
|
127
|
+
id
|
|
128
|
+
},
|
|
129
|
+
...current.slice(at)
|
|
130
|
+
]), "block-insert");
|
|
131
|
+
return id;
|
|
132
|
+
},
|
|
133
|
+
/** Changes some fields of one block: its type, text, tick or indent. */
|
|
134
|
+
updateBlock: (id, patch) => {
|
|
135
|
+
const current = blocks();
|
|
136
|
+
const index = indexOf(current, id);
|
|
137
|
+
if (patch?.type !== void 0 && !isNoteBlockType(patch.type)) throw new Error(`"${String(patch.type)}" isn't a block type. Use one of: ${noteBlockTypes.join(", ")}.`);
|
|
138
|
+
const next = current.slice();
|
|
139
|
+
next[index] = {
|
|
140
|
+
...current[index],
|
|
141
|
+
...patch,
|
|
142
|
+
id
|
|
143
|
+
};
|
|
144
|
+
return write(normalizeBlocks(next), "block-update");
|
|
145
|
+
},
|
|
146
|
+
/** Removes one block. */
|
|
147
|
+
removeBlock: (id) => {
|
|
148
|
+
const current = blocks();
|
|
149
|
+
const index = indexOf(current, id);
|
|
150
|
+
return write(normalizeBlocks(current.filter((_, i) => i !== index)), "block-remove");
|
|
151
|
+
},
|
|
152
|
+
/**
|
|
153
|
+
* Starts a thread on `quote`, text as a person sees it in the block
|
|
154
|
+
* `blockId`, with `text` as its first message.
|
|
155
|
+
*/
|
|
156
|
+
addComment: (blockId, quote, text) => {
|
|
157
|
+
const { onComment } = context.options();
|
|
158
|
+
const { readOnly } = context.store.get();
|
|
159
|
+
if (!onComment || readOnly) throw new Error("This note takes no new comments.");
|
|
160
|
+
indexOf(blocks(), blockId);
|
|
161
|
+
if (!editor || editor.isDestroyed) throw new Error("The note isn't on the page yet.");
|
|
162
|
+
if (typeof quote !== "string" || !commentRange(editor.state.doc, {
|
|
163
|
+
blockId,
|
|
164
|
+
quote
|
|
165
|
+
})) throw new Error(`No text "${String(quote)}" in block ${blockId}. Its text: "${blockText(editor.state.doc, blockId)}".`);
|
|
166
|
+
onComment({
|
|
167
|
+
blockId,
|
|
168
|
+
quote,
|
|
169
|
+
text: message(text)
|
|
170
|
+
}, agent);
|
|
171
|
+
return true;
|
|
172
|
+
},
|
|
173
|
+
/** Answers the open thread `commentId`. */
|
|
174
|
+
replyToComment: (commentId, text) => {
|
|
175
|
+
const { onCommentReply } = context.options();
|
|
176
|
+
if (!onCommentReply) throw new Error("This note takes no replies.");
|
|
177
|
+
onCommentReply(thread(commentId).id, message(text), agent);
|
|
178
|
+
return true;
|
|
179
|
+
},
|
|
180
|
+
/** Resolves the open thread `commentId`; its mark leaves the text. */
|
|
181
|
+
resolveComment: (commentId) => {
|
|
182
|
+
const { onCommentResolve } = context.options();
|
|
183
|
+
if (!onCommentResolve) throw new Error("This note's threads can't be resolved.");
|
|
184
|
+
onCommentResolve(thread(commentId).id, agent);
|
|
185
|
+
return true;
|
|
186
|
+
},
|
|
187
|
+
input: (value) => write(value, "input-change"),
|
|
188
|
+
setFocused: (focused) => context.store.set({ focused }),
|
|
189
|
+
attach: (next) => {
|
|
190
|
+
editor = next;
|
|
191
|
+
}
|
|
192
|
+
};
|
|
193
|
+
},
|
|
194
|
+
slots: (slot) => ({
|
|
195
|
+
root: slot({ attrs: (state) => ({
|
|
196
|
+
"data-readonly": state.readOnly ? "" : void 0,
|
|
197
|
+
"data-empty": isEmpty(state.value) ? "" : void 0,
|
|
198
|
+
"data-focused": state.focused ? "" : void 0
|
|
199
|
+
}) }),
|
|
200
|
+
content: slot({
|
|
201
|
+
props: {
|
|
202
|
+
label: "string",
|
|
203
|
+
todoLabel: "callback",
|
|
204
|
+
onEditor: "callback",
|
|
205
|
+
onCursor: "callback"
|
|
206
|
+
},
|
|
207
|
+
bind: (el, part) => mountEditor(el, part)
|
|
208
|
+
})
|
|
209
|
+
}),
|
|
210
|
+
agent: { actions: [
|
|
211
|
+
"setValue",
|
|
212
|
+
"insertBlock",
|
|
213
|
+
"updateBlock",
|
|
214
|
+
"removeBlock",
|
|
215
|
+
"addComment",
|
|
216
|
+
"replyToComment",
|
|
217
|
+
"resolveComment"
|
|
218
|
+
] }
|
|
219
|
+
});
|
|
220
|
+
const QuoteExit = Extension.create({
|
|
221
|
+
name: "noteQuoteExit",
|
|
222
|
+
addKeyboardShortcuts() {
|
|
223
|
+
return { Enter: ({ editor }) => editor.isActive("blockquote") && editor.chain().splitBlock().lift("blockquote").run() };
|
|
224
|
+
}
|
|
225
|
+
});
|
|
226
|
+
const EscapePasses = Extension.create({
|
|
227
|
+
name: "noteEscapePasses",
|
|
228
|
+
addProseMirrorPlugins() {
|
|
229
|
+
return [new Plugin({ props: { handleDOMEvents: { keydown: (_view, event) => event.key === "Escape" } } })];
|
|
230
|
+
}
|
|
231
|
+
});
|
|
232
|
+
const People = Extension.create({
|
|
233
|
+
name: "notePeople",
|
|
234
|
+
addProseMirrorPlugins: () => [peoplePlugin()]
|
|
235
|
+
});
|
|
236
|
+
function inlineMarkdown(editor) {
|
|
237
|
+
const manager = editor.storage.markdown.manager;
|
|
238
|
+
const parseLine = (line) => {
|
|
239
|
+
if (!line) return [];
|
|
240
|
+
const [first, ...rest] = manager.parse(line).content ?? [];
|
|
241
|
+
return first?.type === "paragraph" && rest.length === 0 ? first.content ?? [] : [{
|
|
242
|
+
type: "text",
|
|
243
|
+
text: line
|
|
244
|
+
}];
|
|
245
|
+
};
|
|
246
|
+
return {
|
|
247
|
+
serialize: (content) => {
|
|
248
|
+
const lines = [[]];
|
|
249
|
+
for (const node of content ?? []) if (node.type === "hardBreak") lines.push([]);
|
|
250
|
+
else lines.at(-1).push(node);
|
|
251
|
+
return lines.map((line) => line.length ? manager.serialize({
|
|
252
|
+
type: "doc",
|
|
253
|
+
content: [{
|
|
254
|
+
type: "paragraph",
|
|
255
|
+
content: line
|
|
256
|
+
}]
|
|
257
|
+
}).trim() : "").join("\n");
|
|
258
|
+
},
|
|
259
|
+
parse: (text) => text.split("\n").flatMap((line, index) => [...index > 0 ? [{ type: "hardBreak" }] : [], ...parseLine(line)])
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* Gives the nodes a block doesn't name, like the paragraph inside a list item,
|
|
264
|
+
* the ids they already have on the page, so a diff sees only what changed.
|
|
265
|
+
*/
|
|
266
|
+
function adoptIds(next, live) {
|
|
267
|
+
const byId = /* @__PURE__ */ new Map();
|
|
268
|
+
const index = (node) => {
|
|
269
|
+
if (typeof node.attrs?.id === "string") byId.set(node.attrs.id, node);
|
|
270
|
+
node.content?.forEach(index);
|
|
271
|
+
};
|
|
272
|
+
index(live);
|
|
273
|
+
const walk = (node, twin) => {
|
|
274
|
+
const id = twin && twin.type === node.type ? twin.attrs?.id : void 0;
|
|
275
|
+
if (id != null && node.attrs?.id == null) node.attrs = {
|
|
276
|
+
...node.attrs,
|
|
277
|
+
id
|
|
278
|
+
};
|
|
279
|
+
node.content?.forEach((child, i) => {
|
|
280
|
+
const own = typeof child.attrs?.id === "string" ? byId.get(child.attrs.id) : void 0;
|
|
281
|
+
walk(child, own ?? twin?.content?.[i]);
|
|
282
|
+
});
|
|
283
|
+
};
|
|
284
|
+
walk(next, live);
|
|
285
|
+
return next;
|
|
286
|
+
}
|
|
287
|
+
function mountEditor(el, part) {
|
|
288
|
+
const { store, api } = part;
|
|
289
|
+
const props = () => part.props;
|
|
290
|
+
const todoLabel = (text, checked) => props().todoLabel?.(text, checked) ?? (text ? `Done: ${text}` : "Empty to-do");
|
|
291
|
+
const editor = new Editor({
|
|
292
|
+
element: el,
|
|
293
|
+
editable: !store.get().readOnly,
|
|
294
|
+
extensions: [
|
|
295
|
+
StarterKit.configure({
|
|
296
|
+
heading: { levels: [
|
|
297
|
+
1,
|
|
298
|
+
2,
|
|
299
|
+
3
|
|
300
|
+
] },
|
|
301
|
+
link: {
|
|
302
|
+
openOnClick: false,
|
|
303
|
+
autolink: true,
|
|
304
|
+
isAllowedUri: (url, context) => url.startsWith("mention:") || context.defaultValidate(url)
|
|
305
|
+
},
|
|
306
|
+
trailingNode: false
|
|
307
|
+
}),
|
|
308
|
+
TaskList,
|
|
309
|
+
TaskItem.configure({
|
|
310
|
+
nested: true,
|
|
311
|
+
a11y: { checkboxLabel: (node, checked) => todoLabel(node.textContent, checked) }
|
|
312
|
+
}),
|
|
313
|
+
QuoteExit,
|
|
314
|
+
EscapePasses,
|
|
315
|
+
People,
|
|
316
|
+
Placeholder.configure({ placeholder: () => store.get().placeholder }),
|
|
317
|
+
Markdown,
|
|
318
|
+
UniqueID.configure({ types: [
|
|
319
|
+
"paragraph",
|
|
320
|
+
"heading",
|
|
321
|
+
"blockquote",
|
|
322
|
+
"codeBlock",
|
|
323
|
+
"horizontalRule",
|
|
324
|
+
"listItem",
|
|
325
|
+
"taskItem"
|
|
326
|
+
] })
|
|
327
|
+
],
|
|
328
|
+
editorProps: { attributes: () => {
|
|
329
|
+
const { readOnly } = store.get();
|
|
330
|
+
return {
|
|
331
|
+
role: "textbox",
|
|
332
|
+
"aria-multiline": "true",
|
|
333
|
+
"aria-label": props().label ?? "",
|
|
334
|
+
...readOnly ? { "aria-readonly": "true" } : {}
|
|
335
|
+
};
|
|
336
|
+
} }
|
|
337
|
+
});
|
|
338
|
+
const inline = inlineMarkdown(editor);
|
|
339
|
+
const current = () => docToBlocks(editor.getJSON(), inline);
|
|
340
|
+
const reconcile = () => {
|
|
341
|
+
const { value } = store.get();
|
|
342
|
+
if (editor.view.composing || sameBlocks(value, current())) return;
|
|
343
|
+
const { state } = editor.view;
|
|
344
|
+
const next = editor.schema.nodeFromJSON(adoptIds(blocksToDoc(value, inline), editor.getJSON()));
|
|
345
|
+
const start = state.doc.content.findDiffStart(next.content);
|
|
346
|
+
const end = state.doc.content.findDiffEnd(next.content);
|
|
347
|
+
if (start == null || !end) return;
|
|
348
|
+
let { a: endA, b: endB } = end;
|
|
349
|
+
const overlap = start - Math.min(endA, endB);
|
|
350
|
+
if (overlap > 0) {
|
|
351
|
+
endA += overlap;
|
|
352
|
+
endB += overlap;
|
|
353
|
+
}
|
|
354
|
+
editor.view.dispatch(state.tr.replace(start, endA, next.slice(start, endB)).setMeta(REMOTE, true));
|
|
355
|
+
};
|
|
356
|
+
editor.commands.setContent(blocksToDoc(store.get().value, inline), { emitUpdate: false });
|
|
357
|
+
const initial = current();
|
|
358
|
+
if (!sameBlocks(initial, store.get().value)) api.input(initial);
|
|
359
|
+
let pending;
|
|
360
|
+
editor.on("update", () => {
|
|
361
|
+
const next = current();
|
|
362
|
+
if (sameBlocks(next, store.get().value)) return;
|
|
363
|
+
api.input(next);
|
|
364
|
+
clearTimeout(pending);
|
|
365
|
+
pending = setTimeout(reconcile, 0);
|
|
366
|
+
});
|
|
367
|
+
editor.on("focus", () => api.setFocused(true));
|
|
368
|
+
editor.on("blur", () => api.setFocused(false));
|
|
369
|
+
let cursorKey = "null";
|
|
370
|
+
const reportCursor = () => {
|
|
371
|
+
const cursor = editor.isFocused ? cursorAt(editor.state) : null;
|
|
372
|
+
const key = JSON.stringify(cursor);
|
|
373
|
+
if (key === cursorKey) return;
|
|
374
|
+
cursorKey = key;
|
|
375
|
+
props().onCursor?.(cursor);
|
|
376
|
+
};
|
|
377
|
+
editor.on("transaction", ({ transaction }) => {
|
|
378
|
+
if (transaction.docChanged || transaction.selectionSet) reportCursor();
|
|
379
|
+
});
|
|
380
|
+
editor.on("focus", reportCursor);
|
|
381
|
+
editor.on("blur", reportCursor);
|
|
382
|
+
props().onEditor?.(editor);
|
|
383
|
+
api.attach(editor);
|
|
384
|
+
let readOnly = store.get().readOnly;
|
|
385
|
+
const unsubscribe = store.subscribe(() => {
|
|
386
|
+
const state = store.get();
|
|
387
|
+
if (state.readOnly !== readOnly) {
|
|
388
|
+
readOnly = state.readOnly;
|
|
389
|
+
editor.setEditable(!readOnly, false);
|
|
390
|
+
}
|
|
391
|
+
reconcile();
|
|
392
|
+
});
|
|
393
|
+
return () => {
|
|
394
|
+
clearTimeout(pending);
|
|
395
|
+
unsubscribe();
|
|
396
|
+
api.attach(null);
|
|
397
|
+
props().onEditor?.(null);
|
|
398
|
+
editor.destroy();
|
|
399
|
+
};
|
|
400
|
+
}
|
|
401
|
+
/** The `/` menu's block types, in English. Map over them to translate or add your own. */
|
|
402
|
+
const noteEditorCommands = [
|
|
403
|
+
{
|
|
404
|
+
value: "paragraph",
|
|
405
|
+
label: "Text",
|
|
406
|
+
keywords: ["paragraph", "plain"],
|
|
407
|
+
icon: TextIcon
|
|
408
|
+
},
|
|
409
|
+
{
|
|
410
|
+
value: "heading-1",
|
|
411
|
+
label: "Heading 1",
|
|
412
|
+
keywords: ["title", "h1"],
|
|
413
|
+
icon: Heading01Icon
|
|
414
|
+
},
|
|
415
|
+
{
|
|
416
|
+
value: "heading-2",
|
|
417
|
+
label: "Heading 2",
|
|
418
|
+
keywords: ["subtitle", "h2"],
|
|
419
|
+
icon: Heading02Icon
|
|
420
|
+
},
|
|
421
|
+
{
|
|
422
|
+
value: "heading-3",
|
|
423
|
+
label: "Heading 3",
|
|
424
|
+
keywords: ["h3"],
|
|
425
|
+
icon: Heading03Icon
|
|
426
|
+
},
|
|
427
|
+
{
|
|
428
|
+
value: "bulleted",
|
|
429
|
+
label: "Bulleted list",
|
|
430
|
+
keywords: ["bullet", "unordered"],
|
|
431
|
+
icon: LeftToRightListBulletIcon
|
|
432
|
+
},
|
|
433
|
+
{
|
|
434
|
+
value: "numbered",
|
|
435
|
+
label: "Numbered list",
|
|
436
|
+
keywords: ["ordered"],
|
|
437
|
+
icon: LeftToRightListNumberIcon
|
|
438
|
+
},
|
|
439
|
+
{
|
|
440
|
+
value: "todo",
|
|
441
|
+
label: "To-do list",
|
|
442
|
+
keywords: ["task", "checkbox"],
|
|
443
|
+
icon: CheckListIcon
|
|
444
|
+
},
|
|
445
|
+
{
|
|
446
|
+
value: "quote",
|
|
447
|
+
label: "Quote",
|
|
448
|
+
keywords: ["blockquote"],
|
|
449
|
+
icon: QuoteDownIcon
|
|
450
|
+
},
|
|
451
|
+
{
|
|
452
|
+
value: "code",
|
|
453
|
+
label: "Code",
|
|
454
|
+
keywords: ["snippet"],
|
|
455
|
+
icon: SourceCodeIcon
|
|
456
|
+
},
|
|
457
|
+
{
|
|
458
|
+
value: "divider",
|
|
459
|
+
label: "Divider",
|
|
460
|
+
keywords: ["rule", "separator"],
|
|
461
|
+
icon: MinusSignIcon
|
|
462
|
+
}
|
|
463
|
+
];
|
|
464
|
+
const NoteEditorMenuContext = createContext({ icons: /* @__PURE__ */ new Map() });
|
|
465
|
+
function NoteEditor(t0) {
|
|
466
|
+
const $ = c(104);
|
|
467
|
+
let changeLabels;
|
|
468
|
+
let children;
|
|
469
|
+
let className;
|
|
470
|
+
let defaultValue;
|
|
471
|
+
let mentions;
|
|
472
|
+
let onCommand;
|
|
473
|
+
let onComment;
|
|
474
|
+
let onCommentReply;
|
|
475
|
+
let onCommentResolve;
|
|
476
|
+
let onCursorChange;
|
|
477
|
+
let onSuggestionAccept;
|
|
478
|
+
let onSuggestionDiscard;
|
|
479
|
+
let onSuggestionRedo;
|
|
480
|
+
let onValueChange;
|
|
481
|
+
let placeholder;
|
|
482
|
+
let props;
|
|
483
|
+
let readOnly;
|
|
484
|
+
let t1;
|
|
485
|
+
let t2;
|
|
486
|
+
let t3;
|
|
487
|
+
let t4;
|
|
488
|
+
let t5;
|
|
489
|
+
let t6;
|
|
490
|
+
let value;
|
|
491
|
+
if ($[0] !== t0) {
|
|
492
|
+
({value, defaultValue, onValueChange, placeholder, readOnly, label: t1, commands: t2, onCommand, mentions, presence: t3, onCursorChange, comments: t4, onComment, onCommentReply, onCommentResolve, suggestions: t5, onSuggestionAccept, onSuggestionDiscard, onSuggestionRedo, changes: t6, changeLabels, className, children, ...props} = t0);
|
|
493
|
+
$[0] = t0;
|
|
494
|
+
$[1] = changeLabels;
|
|
495
|
+
$[2] = children;
|
|
496
|
+
$[3] = className;
|
|
497
|
+
$[4] = defaultValue;
|
|
498
|
+
$[5] = mentions;
|
|
499
|
+
$[6] = onCommand;
|
|
500
|
+
$[7] = onComment;
|
|
501
|
+
$[8] = onCommentReply;
|
|
502
|
+
$[9] = onCommentResolve;
|
|
503
|
+
$[10] = onCursorChange;
|
|
504
|
+
$[11] = onSuggestionAccept;
|
|
505
|
+
$[12] = onSuggestionDiscard;
|
|
506
|
+
$[13] = onSuggestionRedo;
|
|
507
|
+
$[14] = onValueChange;
|
|
508
|
+
$[15] = placeholder;
|
|
509
|
+
$[16] = props;
|
|
510
|
+
$[17] = readOnly;
|
|
511
|
+
$[18] = t1;
|
|
512
|
+
$[19] = t2;
|
|
513
|
+
$[20] = t3;
|
|
514
|
+
$[21] = t4;
|
|
515
|
+
$[22] = t5;
|
|
516
|
+
$[23] = t6;
|
|
517
|
+
$[24] = value;
|
|
518
|
+
} else {
|
|
519
|
+
changeLabels = $[1];
|
|
520
|
+
children = $[2];
|
|
521
|
+
className = $[3];
|
|
522
|
+
defaultValue = $[4];
|
|
523
|
+
mentions = $[5];
|
|
524
|
+
onCommand = $[6];
|
|
525
|
+
onComment = $[7];
|
|
526
|
+
onCommentReply = $[8];
|
|
527
|
+
onCommentResolve = $[9];
|
|
528
|
+
onCursorChange = $[10];
|
|
529
|
+
onSuggestionAccept = $[11];
|
|
530
|
+
onSuggestionDiscard = $[12];
|
|
531
|
+
onSuggestionRedo = $[13];
|
|
532
|
+
onValueChange = $[14];
|
|
533
|
+
placeholder = $[15];
|
|
534
|
+
props = $[16];
|
|
535
|
+
readOnly = $[17];
|
|
536
|
+
t1 = $[18];
|
|
537
|
+
t2 = $[19];
|
|
538
|
+
t3 = $[20];
|
|
539
|
+
t4 = $[21];
|
|
540
|
+
t5 = $[22];
|
|
541
|
+
t6 = $[23];
|
|
542
|
+
value = $[24];
|
|
543
|
+
}
|
|
544
|
+
const label = t1 === void 0 ? "Note" : t1;
|
|
545
|
+
const commands = t2 === void 0 ? noteEditorCommands : t2;
|
|
546
|
+
const presence = t3 === void 0 ? noPeople : t3;
|
|
547
|
+
const comments = t4 === void 0 ? noComments : t4;
|
|
548
|
+
const suggestions = t5 === void 0 ? noSuggestions : t5;
|
|
549
|
+
const changes = t6 === void 0 ? noChanges : t6;
|
|
550
|
+
let t7;
|
|
551
|
+
if ($[25] !== comments || $[26] !== defaultValue || $[27] !== onComment || $[28] !== onCommentReply || $[29] !== onCommentResolve || $[30] !== onValueChange || $[31] !== placeholder || $[32] !== readOnly || $[33] !== value) {
|
|
552
|
+
t7 = {
|
|
553
|
+
value,
|
|
554
|
+
defaultValue,
|
|
555
|
+
onValueChange,
|
|
556
|
+
placeholder,
|
|
557
|
+
readOnly,
|
|
558
|
+
comments,
|
|
559
|
+
onComment,
|
|
560
|
+
onCommentReply,
|
|
561
|
+
onCommentResolve
|
|
562
|
+
};
|
|
563
|
+
$[25] = comments;
|
|
564
|
+
$[26] = defaultValue;
|
|
565
|
+
$[27] = onComment;
|
|
566
|
+
$[28] = onCommentReply;
|
|
567
|
+
$[29] = onCommentResolve;
|
|
568
|
+
$[30] = onValueChange;
|
|
569
|
+
$[31] = placeholder;
|
|
570
|
+
$[32] = readOnly;
|
|
571
|
+
$[33] = value;
|
|
572
|
+
$[34] = t7;
|
|
573
|
+
} else t7 = $[34];
|
|
574
|
+
const handle = (0, core_exports.usePrimitive)(noteEditor, t7);
|
|
575
|
+
const [editor, setEditor] = useState(null);
|
|
576
|
+
const state = usePrimitiveState(handle);
|
|
577
|
+
let t8;
|
|
578
|
+
if ($[35] !== state.value) {
|
|
579
|
+
t8 = isEmpty(state.value);
|
|
580
|
+
$[35] = state.value;
|
|
581
|
+
$[36] = t8;
|
|
582
|
+
} else t8 = $[36];
|
|
583
|
+
let t9;
|
|
584
|
+
if ($[37] !== handle) {
|
|
585
|
+
t9 = (blocks) => handle.api.setValue(blocks);
|
|
586
|
+
$[37] = handle;
|
|
587
|
+
$[38] = t9;
|
|
588
|
+
} else t9 = $[38];
|
|
589
|
+
const t10 = readOnly ? void 0 : onComment;
|
|
590
|
+
let t11;
|
|
591
|
+
if ($[39] !== comments || $[40] !== editor || $[41] !== onCommentReply || $[42] !== onCommentResolve || $[43] !== onCursorChange || $[44] !== onSuggestionAccept || $[45] !== onSuggestionDiscard || $[46] !== onSuggestionRedo || $[47] !== presence || $[48] !== state.readOnly || $[49] !== suggestions || $[50] !== t10 || $[51] !== t8 || $[52] !== t9) {
|
|
592
|
+
t11 = {
|
|
593
|
+
editor,
|
|
594
|
+
setEditor,
|
|
595
|
+
empty: t8,
|
|
596
|
+
readOnly: state.readOnly,
|
|
597
|
+
applyTemplate: t9,
|
|
598
|
+
presence,
|
|
599
|
+
comments,
|
|
600
|
+
onComment: t10,
|
|
601
|
+
onCommentReply,
|
|
602
|
+
onCommentResolve,
|
|
603
|
+
onCursorChange,
|
|
604
|
+
suggestions,
|
|
605
|
+
onSuggestionAccept,
|
|
606
|
+
onSuggestionDiscard,
|
|
607
|
+
onSuggestionRedo
|
|
608
|
+
};
|
|
609
|
+
$[39] = comments;
|
|
610
|
+
$[40] = editor;
|
|
611
|
+
$[41] = onCommentReply;
|
|
612
|
+
$[42] = onCommentResolve;
|
|
613
|
+
$[43] = onCursorChange;
|
|
614
|
+
$[44] = onSuggestionAccept;
|
|
615
|
+
$[45] = onSuggestionDiscard;
|
|
616
|
+
$[46] = onSuggestionRedo;
|
|
617
|
+
$[47] = presence;
|
|
618
|
+
$[48] = state.readOnly;
|
|
619
|
+
$[49] = suggestions;
|
|
620
|
+
$[50] = t10;
|
|
621
|
+
$[51] = t8;
|
|
622
|
+
$[52] = t9;
|
|
623
|
+
$[53] = t11;
|
|
624
|
+
} else t11 = $[53];
|
|
625
|
+
const context = t11;
|
|
626
|
+
const shownReadOnly = state.readOnly;
|
|
627
|
+
let t12;
|
|
628
|
+
let t13;
|
|
629
|
+
if ($[54] !== changeLabels || $[55] !== changes || $[56] !== comments || $[57] !== editor || $[58] !== presence || $[59] !== shownReadOnly || $[60] !== suggestions) {
|
|
630
|
+
t12 = () => {
|
|
631
|
+
if (editor) setPeople(editor, {
|
|
632
|
+
presence,
|
|
633
|
+
comments,
|
|
634
|
+
suggestions,
|
|
635
|
+
changes,
|
|
636
|
+
changeLabels,
|
|
637
|
+
readOnly: shownReadOnly
|
|
638
|
+
});
|
|
639
|
+
};
|
|
640
|
+
t13 = [
|
|
641
|
+
editor,
|
|
642
|
+
presence,
|
|
643
|
+
comments,
|
|
644
|
+
suggestions,
|
|
645
|
+
changes,
|
|
646
|
+
changeLabels,
|
|
647
|
+
shownReadOnly
|
|
648
|
+
];
|
|
649
|
+
$[54] = changeLabels;
|
|
650
|
+
$[55] = changes;
|
|
651
|
+
$[56] = comments;
|
|
652
|
+
$[57] = editor;
|
|
653
|
+
$[58] = presence;
|
|
654
|
+
$[59] = shownReadOnly;
|
|
655
|
+
$[60] = suggestions;
|
|
656
|
+
$[61] = t12;
|
|
657
|
+
$[62] = t13;
|
|
658
|
+
} else {
|
|
659
|
+
t12 = $[61];
|
|
660
|
+
t13 = $[62];
|
|
661
|
+
}
|
|
662
|
+
useEffect(t12, t13);
|
|
663
|
+
let t14;
|
|
664
|
+
if ($[63] !== commands) {
|
|
665
|
+
t14 = new Map(commands.map(_temp));
|
|
666
|
+
$[63] = commands;
|
|
667
|
+
$[64] = t14;
|
|
668
|
+
} else t14 = $[64];
|
|
669
|
+
const icons = t14;
|
|
670
|
+
let t15;
|
|
671
|
+
if ($[65] !== commands) {
|
|
672
|
+
t15 = commands.map(_temp2);
|
|
673
|
+
$[65] = commands;
|
|
674
|
+
$[66] = t15;
|
|
675
|
+
} else t15 = $[66];
|
|
676
|
+
let t16;
|
|
677
|
+
if ($[67] !== t15) {
|
|
678
|
+
t16 = {
|
|
679
|
+
char: "/",
|
|
680
|
+
items: t15
|
|
681
|
+
};
|
|
682
|
+
$[67] = t15;
|
|
683
|
+
$[68] = t16;
|
|
684
|
+
} else t16 = $[68];
|
|
685
|
+
let t17;
|
|
686
|
+
if ($[69] !== mentions) {
|
|
687
|
+
t17 = mentions ? [{
|
|
688
|
+
char: "@",
|
|
689
|
+
type: "mention",
|
|
690
|
+
spaces: 1,
|
|
691
|
+
items: mentions,
|
|
692
|
+
insert: _temp3
|
|
693
|
+
}] : [];
|
|
694
|
+
$[69] = mentions;
|
|
695
|
+
$[70] = t17;
|
|
696
|
+
} else t17 = $[70];
|
|
697
|
+
let t18;
|
|
698
|
+
if ($[71] !== t16 || $[72] !== t17) {
|
|
699
|
+
t18 = [t16, ...t17];
|
|
700
|
+
$[71] = t16;
|
|
701
|
+
$[72] = t17;
|
|
702
|
+
$[73] = t18;
|
|
703
|
+
} else t18 = $[73];
|
|
704
|
+
const triggers = t18;
|
|
705
|
+
let t19;
|
|
706
|
+
if ($[74] !== editor || $[75] !== onCommand) {
|
|
707
|
+
t19 = (choice, details) => {
|
|
708
|
+
if (details.trigger !== "/" || !editor) return;
|
|
709
|
+
details.preventDefault();
|
|
710
|
+
const range = {
|
|
711
|
+
from: details.match.start,
|
|
712
|
+
to: details.match.end
|
|
713
|
+
};
|
|
714
|
+
if (isNoteBlockType(choice)) {
|
|
715
|
+
setBlockType(editor, choice, range);
|
|
716
|
+
return;
|
|
717
|
+
}
|
|
718
|
+
editor.chain().focus().deleteRange(range).run();
|
|
719
|
+
onCommand?.(choice, { blockId: blockIdAt(editor.state) });
|
|
720
|
+
};
|
|
721
|
+
$[74] = editor;
|
|
722
|
+
$[75] = onCommand;
|
|
723
|
+
$[76] = t19;
|
|
724
|
+
} else t19 = $[76];
|
|
725
|
+
const onSelect = t19;
|
|
726
|
+
let t20;
|
|
727
|
+
if ($[77] !== icons) {
|
|
728
|
+
t20 = { icons };
|
|
729
|
+
$[77] = icons;
|
|
730
|
+
$[78] = t20;
|
|
731
|
+
} else t20 = $[78];
|
|
732
|
+
let t21;
|
|
733
|
+
if ($[79] !== editor || $[80] !== readOnly) {
|
|
734
|
+
t21 = editor && !readOnly ? noteAdapter(editor) : void 0;
|
|
735
|
+
$[79] = editor;
|
|
736
|
+
$[80] = readOnly;
|
|
737
|
+
$[81] = t21;
|
|
738
|
+
} else t21 = $[81];
|
|
739
|
+
let t22;
|
|
740
|
+
if ($[82] === Symbol.for("react.memo_cache_sentinel")) {
|
|
741
|
+
t22 = {};
|
|
742
|
+
$[82] = t22;
|
|
743
|
+
} else t22 = $[82];
|
|
744
|
+
let t23;
|
|
745
|
+
if ($[83] !== className) {
|
|
746
|
+
t23 = cnState("relative flex flex-col", className);
|
|
747
|
+
$[83] = className;
|
|
748
|
+
$[84] = t23;
|
|
749
|
+
} else t23 = $[84];
|
|
750
|
+
let t24;
|
|
751
|
+
if ($[85] !== children || $[86] !== label) {
|
|
752
|
+
t24 = children ?? /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
753
|
+
/* @__PURE__ */ jsx(NoteEditorContent, { label }),
|
|
754
|
+
/* @__PURE__ */ jsx(NoteEditorMenu, {}),
|
|
755
|
+
/* @__PURE__ */ jsx(NoteEditorToolbar, {}),
|
|
756
|
+
/* @__PURE__ */ jsx(NoteEditorComments, {}),
|
|
757
|
+
/* @__PURE__ */ jsx(NoteEditorSuggestions, {})
|
|
758
|
+
] });
|
|
759
|
+
$[85] = children;
|
|
760
|
+
$[86] = label;
|
|
761
|
+
$[87] = t24;
|
|
762
|
+
} else t24 = $[87];
|
|
763
|
+
let t25;
|
|
764
|
+
if ($[88] !== label || $[89] !== props || $[90] !== t23 || $[91] !== t24) {
|
|
765
|
+
t25 = {
|
|
766
|
+
role: "group",
|
|
767
|
+
"aria-label": label,
|
|
768
|
+
className: t23,
|
|
769
|
+
children: t24,
|
|
770
|
+
...props
|
|
771
|
+
};
|
|
772
|
+
$[88] = label;
|
|
773
|
+
$[89] = props;
|
|
774
|
+
$[90] = t23;
|
|
775
|
+
$[91] = t24;
|
|
776
|
+
$[92] = t25;
|
|
777
|
+
} else t25 = $[92];
|
|
778
|
+
const t26 = (0, core_exports.usePart)(handle, "root", t22, t25, "div");
|
|
779
|
+
let t27;
|
|
780
|
+
if ($[93] !== onSelect || $[94] !== t21 || $[95] !== t26 || $[96] !== triggers) {
|
|
781
|
+
t27 = /* @__PURE__ */ jsx(TriggerMenu, {
|
|
782
|
+
editor: t21,
|
|
783
|
+
triggers,
|
|
784
|
+
onSelect,
|
|
785
|
+
children: t26
|
|
786
|
+
});
|
|
787
|
+
$[93] = onSelect;
|
|
788
|
+
$[94] = t21;
|
|
789
|
+
$[95] = t26;
|
|
790
|
+
$[96] = triggers;
|
|
791
|
+
$[97] = t27;
|
|
792
|
+
} else t27 = $[97];
|
|
793
|
+
let t28;
|
|
794
|
+
if ($[98] !== t20 || $[99] !== t27) {
|
|
795
|
+
t28 = /* @__PURE__ */ jsx(NoteEditorMenuContext, {
|
|
796
|
+
value: t20,
|
|
797
|
+
children: t27
|
|
798
|
+
});
|
|
799
|
+
$[98] = t20;
|
|
800
|
+
$[99] = t27;
|
|
801
|
+
$[100] = t28;
|
|
802
|
+
} else t28 = $[100];
|
|
803
|
+
let t29;
|
|
804
|
+
if ($[101] !== context || $[102] !== t28) {
|
|
805
|
+
t29 = /* @__PURE__ */ jsx(NoteEditorContext, {
|
|
806
|
+
value: context,
|
|
807
|
+
children: t28
|
|
808
|
+
});
|
|
809
|
+
$[101] = context;
|
|
810
|
+
$[102] = t28;
|
|
811
|
+
$[103] = t29;
|
|
812
|
+
} else t29 = $[103];
|
|
813
|
+
return t29;
|
|
814
|
+
}
|
|
815
|
+
function _temp3(item) {
|
|
816
|
+
return {
|
|
817
|
+
type: "mention",
|
|
818
|
+
value: String(item.value),
|
|
819
|
+
label: `@${item.label}`
|
|
820
|
+
};
|
|
821
|
+
}
|
|
822
|
+
function _temp2(t0) {
|
|
823
|
+
const { value: value_0, label: label_0, keywords } = t0;
|
|
824
|
+
return {
|
|
825
|
+
value: value_0,
|
|
826
|
+
label: label_0,
|
|
827
|
+
keywords
|
|
828
|
+
};
|
|
829
|
+
}
|
|
830
|
+
function _temp(command) {
|
|
831
|
+
return [command.value, command.icon];
|
|
832
|
+
}
|
|
833
|
+
const documentClasses = cn("text-chat text-foreground", "[&_.ProseMirror]:relative [&_.ProseMirror]:outline-none [&_.ProseMirror]:whitespace-pre-wrap [&_.ProseMirror]:wrap-break-word", "[&_.ProseMirror>*+*]:mt-2 [&_.ProseMirror>:is(h1,h2,h3):not(:first-child)]:mt-7 [&_.ProseMirror>:is(h1,h2,h3)+*]:mt-1.5", "[&_h1]:text-heading-1 [&_h2]:text-heading-2 [&_h3]:text-heading-3", "[&_ul]:list-disc [&_ol]:list-decimal [&_:is(ul,ol)]:ps-6 [&_li]:ps-1 [&_li+li]:mt-1 [&_li>:is(ul,ol)]:mt-1 [&_li::marker]:text-subtle", "[&_ul[data-type=taskList]]:list-none [&_ul[data-type=taskList]]:ps-0.5", "[&_ul[data-type=taskList]>li]:flex [&_ul[data-type=taskList]>li]:items-start [&_ul[data-type=taskList]>li]:gap-2 [&_ul[data-type=taskList]>li]:ps-0", "[&_ul[data-type=taskList]>li>label]:mt-1 [&_ul[data-type=taskList]>li>label]:flex [&_ul[data-type=taskList]>li>div]:flex-1", "[&_li>label>input]:m-0 [&_li>label>input]:grid [&_li>label>input]:size-4 [&_li>label>input]:cursor-pointer [&_li>label>input]:appearance-none [&_li>label>input]:place-content-center [&_li>label>input]:rounded-xs [&_li>label>input]:border [&_li>label>input]:border-muted-foreground/40 [&_li>label>input]:transition-colors [&_li>label>input]:focus-ring [&_li>label>input]:checked:border-brand [&_li>label>input]:checked:bg-brand dark:[&_li>label>input]:bg-input/30 dark:[&_li>label>input]:checked:bg-brand", "[&_li>label>input]:before:hidden [&_li>label>input]:before:-mt-0.5 [&_li>label>input]:before:h-2 [&_li>label>input]:before:w-1 [&_li>label>input]:before:rotate-45 [&_li>label>input]:before:border-e-2 [&_li>label>input]:before:border-b-2 [&_li>label>input]:before:border-brand-foreground [&_li>label>input]:before:content-[''] [&_li>label>input]:checked:before:block", "[&_li[data-checked=true]>div]:text-muted-foreground [&_li[data-checked=true]>div]:line-through", "[&_blockquote]:border-s-2 [&_blockquote]:border-border [&_blockquote]:ps-4 [&_blockquote]:text-muted-foreground", "[&_pre]:rounded-lg [&_pre]:bg-muted [&_pre]:px-4 [&_pre]:py-3 [&_pre]:font-mono [&_pre]:text-code", "[&_:not(pre)>code]:rounded-xs [&_:not(pre)>code]:bg-muted [&_:not(pre)>code]:px-1 [&_:not(pre)>code]:font-mono [&_:not(pre)>code]:text-code", "[&_a]:underline [&_a]:decoration-muted-foreground/40 [&_a]:underline-offset-2", "[&_a[href^='mention:']]:font-medium [&_a[href^='mention:']]:no-underline", "[&_hr]:my-4 [&_hr]:border-border", "[&_[data-diff]]:relative [&_[data-diff]]:isolate", "[&_[data-diff]]:before:pointer-events-none [&_[data-diff]]:before:absolute [&_[data-diff]]:before:-inset-y-0.5 [&_[data-diff]]:before:start-(--diff-start) [&_[data-diff]]:before:end-0 [&_[data-diff]]:before:-z-1 [&_[data-diff]]:before:rounded-sm [&_[data-diff]]:before:flex [&_[data-diff]]:before:items-center [&_[data-diff]]:before:ps-2 [&_[data-diff]]:before:font-mono [&_[data-diff]]:before:text-xs", "[&_:is([data-diff=added],[data-diff=changed])]:before:bg-success/8 [&_:is([data-diff=added],[data-diff=changed])]:before:text-success [&_:is([data-diff=added],[data-diff=changed])]:before:content-['+'_/_'']", "[&_[data-diff=removed]]:text-subtle [&_[data-diff=removed]]:line-through [&_[data-diff=removed]]:before:content-['−'_/_'']", "[&_li[data-diff=changed]]:[counter-increment:list-item_0]", "[&_.is-empty]:before:pointer-events-none [&_.is-empty]:before:float-start [&_.is-empty]:before:h-0 [&_.is-empty]:before:text-placeholder [&_.is-empty]:before:content-[attr(data-placeholder)]");
|
|
834
|
+
/** Where the note is written. `NoteEditor` renders one when it has no children. */
|
|
835
|
+
function NoteEditorContent(t0) {
|
|
836
|
+
const $ = c(15);
|
|
837
|
+
let className;
|
|
838
|
+
let label;
|
|
839
|
+
let props;
|
|
840
|
+
let todoLabel;
|
|
841
|
+
if ($[0] !== t0) {
|
|
842
|
+
({label, todoLabel, className, ...props} = t0);
|
|
843
|
+
$[0] = t0;
|
|
844
|
+
$[1] = className;
|
|
845
|
+
$[2] = label;
|
|
846
|
+
$[3] = props;
|
|
847
|
+
$[4] = todoLabel;
|
|
848
|
+
} else {
|
|
849
|
+
className = $[1];
|
|
850
|
+
label = $[2];
|
|
851
|
+
props = $[3];
|
|
852
|
+
todoLabel = $[4];
|
|
853
|
+
}
|
|
854
|
+
const context = use(NoteEditorContext);
|
|
855
|
+
const t1 = context?.setEditor;
|
|
856
|
+
const t2 = context?.onCursorChange;
|
|
857
|
+
let t3;
|
|
858
|
+
if ($[5] !== label || $[6] !== t1 || $[7] !== t2 || $[8] !== todoLabel) {
|
|
859
|
+
t3 = {
|
|
860
|
+
label,
|
|
861
|
+
todoLabel,
|
|
862
|
+
onEditor: t1,
|
|
863
|
+
onCursor: t2
|
|
864
|
+
};
|
|
865
|
+
$[5] = label;
|
|
866
|
+
$[6] = t1;
|
|
867
|
+
$[7] = t2;
|
|
868
|
+
$[8] = todoLabel;
|
|
869
|
+
$[9] = t3;
|
|
870
|
+
} else t3 = $[9];
|
|
871
|
+
let t4;
|
|
872
|
+
if ($[10] !== className) {
|
|
873
|
+
t4 = cnState(documentClasses, className);
|
|
874
|
+
$[10] = className;
|
|
875
|
+
$[11] = t4;
|
|
876
|
+
} else t4 = $[11];
|
|
877
|
+
let t5;
|
|
878
|
+
if ($[12] !== props || $[13] !== t4) {
|
|
879
|
+
t5 = {
|
|
880
|
+
className: t4,
|
|
881
|
+
...props
|
|
882
|
+
};
|
|
883
|
+
$[12] = props;
|
|
884
|
+
$[13] = t4;
|
|
885
|
+
$[14] = t5;
|
|
886
|
+
} else t5 = $[14];
|
|
887
|
+
return (0, core_exports.usePart)(noteEditor, "content", t3, t5, "div");
|
|
888
|
+
}
|
|
889
|
+
/**
|
|
890
|
+
* The `/` and `@` suggestions, at the caret. `NoteEditor` renders one when it
|
|
891
|
+
* has no children; render it yourself next to `NoteEditorContent` otherwise.
|
|
892
|
+
*/
|
|
893
|
+
function NoteEditorMenu(t0) {
|
|
894
|
+
const $ = c(14);
|
|
895
|
+
let children;
|
|
896
|
+
let className;
|
|
897
|
+
let props;
|
|
898
|
+
if ($[0] !== t0) {
|
|
899
|
+
({className, children, ...props} = t0);
|
|
900
|
+
$[0] = t0;
|
|
901
|
+
$[1] = children;
|
|
902
|
+
$[2] = className;
|
|
903
|
+
$[3] = props;
|
|
904
|
+
} else {
|
|
905
|
+
children = $[1];
|
|
906
|
+
className = $[2];
|
|
907
|
+
props = $[3];
|
|
908
|
+
}
|
|
909
|
+
const { icons } = use(NoteEditorMenuContext);
|
|
910
|
+
let t1;
|
|
911
|
+
if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
|
|
912
|
+
t1 = /* @__PURE__ */ jsx(TriggerMenuStatus, {
|
|
913
|
+
"data-agent-hidden": "",
|
|
914
|
+
className: "sr-only"
|
|
915
|
+
});
|
|
916
|
+
$[4] = t1;
|
|
917
|
+
} else t1 = $[4];
|
|
918
|
+
let t2;
|
|
919
|
+
if ($[5] !== className) {
|
|
920
|
+
t2 = cnState("w-60 data-[trigger=@]:w-56", className);
|
|
921
|
+
$[5] = className;
|
|
922
|
+
$[6] = t2;
|
|
923
|
+
} else t2 = $[6];
|
|
924
|
+
let t3;
|
|
925
|
+
if ($[7] !== children || $[8] !== icons) {
|
|
926
|
+
t3 = children ?? /* @__PURE__ */ jsx(TriggerMenuList, { children: (state) => state.trigger === "/" ? state.items.map((item) => {
|
|
927
|
+
const icon = icons.get(item.value);
|
|
928
|
+
return /* @__PURE__ */ jsxs(TriggerMenuItem, {
|
|
929
|
+
value: item.value,
|
|
930
|
+
label: item.label,
|
|
931
|
+
children: [icon && /* @__PURE__ */ jsx(TriggerMenuItemIcon, { children: /* @__PURE__ */ jsx(Icon, { icon }) }), item.label]
|
|
932
|
+
}, item.value);
|
|
933
|
+
}) : /* @__PURE__ */ jsx(TriggerMenuItems, { items: state.items }) });
|
|
934
|
+
$[7] = children;
|
|
935
|
+
$[8] = icons;
|
|
936
|
+
$[9] = t3;
|
|
937
|
+
} else t3 = $[9];
|
|
938
|
+
let t4;
|
|
939
|
+
if ($[10] !== props || $[11] !== t2 || $[12] !== t3) {
|
|
940
|
+
t4 = /* @__PURE__ */ jsxs(Fragment$1, { children: [t1, /* @__PURE__ */ jsx(TriggerMenuContent, {
|
|
941
|
+
"data-agent-hidden": "",
|
|
942
|
+
align: "start",
|
|
943
|
+
className: t2,
|
|
944
|
+
...props,
|
|
945
|
+
children: t3
|
|
946
|
+
})] });
|
|
947
|
+
$[10] = props;
|
|
948
|
+
$[11] = t2;
|
|
949
|
+
$[12] = t3;
|
|
950
|
+
$[13] = t4;
|
|
951
|
+
} else t4 = $[13];
|
|
952
|
+
return t4;
|
|
953
|
+
}
|
|
954
|
+
export { NoteEditor, NoteEditorAssistantMark, NoteEditorBanner, NoteEditorComments, NoteEditorContent, NoteEditorHeader, NoteEditorHistory, NoteEditorHistoryDay, NoteEditorHistoryEvent, NoteEditorHistoryEventAction, NoteEditorHistoryEventDetail, NoteEditorHistoryEventQuote, NoteEditorHistoryEventTitle, NoteEditorMenu, NoteEditorMeta, NoteEditorMetaMark, NoteEditorPresence, NoteEditorSuggestion, NoteEditorSuggestions, NoteEditorTemplate, NoteEditorTemplates, NoteEditorTitle, NoteEditorToolbar, diffNotes, noteBlockTypes, noteEditorCommands };
|