@fastsprout/reacd-shadcn 0.0.0-stage → 0.2.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/LICENSE +201 -0
- package/README.md +28 -2
- package/THIRD_PARTY_NOTICES.md +21 -0
- package/dist/accordion/accordion.adapter.d.ts +2 -0
- package/dist/accordion/accordion.adapter.js +10 -0
- package/dist/action-menu/menu-content.d.ts +5 -0
- package/dist/action-menu/menu-content.js +15 -0
- package/dist/action-menu/menu-items.d.ts +5 -0
- package/dist/action-menu/menu-items.js +46 -0
- package/dist/action-menu/menu-surface.d.ts +7 -0
- package/dist/action-menu/menu-surface.js +15 -0
- package/dist/action-menu/use-menu-frame.d.ts +8 -0
- package/dist/action-menu/use-menu-frame.js +24 -0
- package/dist/alert/alert.adapter.d.ts +2 -0
- package/dist/alert/alert.adapter.js +13 -0
- package/dist/app/app.adapter.d.ts +2 -0
- package/dist/app/app.adapter.js +7 -0
- package/dist/auth-form/auth-form.adapter.d.ts +2 -0
- package/dist/auth-form/auth-form.adapter.js +21 -0
- package/dist/avatar/avatar.adapter.d.ts +2 -0
- package/dist/avatar/avatar.adapter.js +8 -0
- package/dist/avatar-group/avatar-group.adapter.d.ts +2 -0
- package/dist/avatar-group/avatar-group.adapter.js +9 -0
- package/dist/avatar-group/overflow.adapter.d.ts +5 -0
- package/dist/avatar-group/overflow.adapter.js +5 -0
- package/dist/badge/badge.adapter.d.ts +2 -0
- package/dist/badge/badge.adapter.js +9 -0
- package/dist/banner/banner.adapter.d.ts +2 -0
- package/dist/banner/banner.adapter.js +12 -0
- package/dist/blog-post/blog-post.adapter.d.ts +3 -0
- package/dist/blog-post/blog-post.adapter.js +5 -0
- package/dist/blog-posts/blog-posts.adapter.d.ts +3 -0
- package/dist/blog-posts/blog-posts.adapter.js +7 -0
- package/dist/breadcrumb/breadcrumb.adapter.d.ts +2 -0
- package/dist/breadcrumb/breadcrumb.adapter.js +13 -0
- package/dist/button/button.adapter.d.ts +2 -0
- package/dist/button/button.adapter.js +8 -0
- package/dist/calendar/calendar-date.d.ts +7 -0
- package/dist/calendar/calendar-date.js +24 -0
- package/dist/calendar/calendar-day-button.d.ts +2 -0
- package/dist/calendar/calendar-day-button.js +9 -0
- package/dist/calendar/calendar-form-bridge.d.ts +6 -0
- package/dist/calendar/calendar-form-bridge.js +11 -0
- package/dist/calendar/calendar-localization.d.ts +15 -0
- package/dist/calendar/calendar-localization.js +28 -0
- package/dist/calendar/calendar.adapter.d.ts +2 -0
- package/dist/calendar/calendar.adapter.js +47 -0
- package/dist/card/card.adapter.d.ts +2 -0
- package/dist/card/card.adapter.js +13 -0
- package/dist/carousel/carousel-panel.d.ts +7 -0
- package/dist/carousel/carousel-panel.js +8 -0
- package/dist/carousel/carousel.adapter.d.ts +2 -0
- package/dist/carousel/carousel.adapter.js +43 -0
- package/dist/carousel/focus-boundary.d.ts +16 -0
- package/dist/carousel/focus-boundary.js +19 -0
- package/dist/changelog-version/changelog-version.adapter.d.ts +3 -0
- package/dist/changelog-version/changelog-version.adapter.js +5 -0
- package/dist/changelog-versions/changelog-versions.adapter.d.ts +3 -0
- package/dist/changelog-versions/changelog-versions.adapter.js +8 -0
- package/dist/chart/cartesian.d.ts +5 -0
- package/dist/chart/cartesian.js +15 -0
- package/dist/chart/chart-graphic.d.ts +2 -0
- package/dist/chart/chart-graphic.js +14 -0
- package/dist/chart/chart-table.d.ts +2 -0
- package/dist/chart/chart-table.js +6 -0
- package/dist/chart/chart.adapter.d.ts +2 -0
- package/dist/chart/chart.adapter.js +17 -0
- package/dist/chart/legend.d.ts +3 -0
- package/dist/chart/legend.js +14 -0
- package/dist/chart/patterns.d.ts +9 -0
- package/dist/chart/patterns.js +8 -0
- package/dist/chat-attachment/chat-attachment.adapter.d.ts +2 -0
- package/dist/chat-attachment/chat-attachment.adapter.js +12 -0
- package/dist/chat-disclosure/chat-disclosure.d.ts +9 -0
- package/dist/chat-disclosure/chat-disclosure.js +10 -0
- package/dist/chat-message/chat-message.adapter.d.ts +2 -0
- package/dist/chat-message/chat-message.adapter.js +12 -0
- package/dist/chat-messages/chat-messages.adapter.d.ts +2 -0
- package/dist/chat-messages/chat-messages.adapter.js +13 -0
- package/dist/chat-messages/use-follow-latest.d.ts +6 -0
- package/dist/chat-messages/use-follow-latest.js +33 -0
- package/dist/chat-palette/chat-palette.adapter.d.ts +2 -0
- package/dist/chat-palette/chat-palette.adapter.js +4 -0
- package/dist/chat-prompt/chat-prompt.adapter.d.ts +2 -0
- package/dist/chat-prompt/chat-prompt.adapter.js +30 -0
- package/dist/chat-prompt/use-prompt-controls.d.ts +22 -0
- package/dist/chat-prompt/use-prompt-controls.js +69 -0
- package/dist/chat-prompt/use-prompt-escape.d.ts +5 -0
- package/dist/chat-prompt/use-prompt-escape.js +39 -0
- package/dist/chat-prompt-submit/chat-prompt-submit.adapter.d.ts +2 -0
- package/dist/chat-prompt-submit/chat-prompt-submit.adapter.js +14 -0
- package/dist/chat-prompt-submit/prompt-action.d.ts +12 -0
- package/dist/chat-prompt-submit/prompt-action.js +45 -0
- package/dist/chat-reasoning/chat-reasoning.adapter.d.ts +2 -0
- package/dist/chat-reasoning/chat-reasoning.adapter.js +15 -0
- package/dist/chat-reasoning/use-reasoning-disclosure.d.ts +10 -0
- package/dist/chat-reasoning/use-reasoning-disclosure.js +23 -0
- package/dist/chat-shimmer/chat-shimmer.adapter.d.ts +2 -0
- package/dist/chat-shimmer/chat-shimmer.adapter.js +5 -0
- package/dist/chat-tool/chat-tool.adapter.d.ts +2 -0
- package/dist/chat-tool/chat-tool.adapter.js +7 -0
- package/dist/checkbox/checkbox.adapter.d.ts +2 -0
- package/dist/checkbox/checkbox.adapter.js +27 -0
- package/dist/checkbox-group/checkbox-group.adapter.d.ts +2 -0
- package/dist/checkbox-group/checkbox-group.adapter.js +18 -0
- package/dist/chip/chip.adapter.d.ts +2 -0
- package/dist/chip/chip.adapter.js +12 -0
- package/dist/code-editor/code-editor.adapter.d.ts +2 -0
- package/dist/code-editor/code-editor.adapter.js +9 -0
- package/dist/collapsible/collapsible.adapter.d.ts +2 -0
- package/dist/collapsible/collapsible.adapter.js +11 -0
- package/dist/color-mode-avatar/color-mode-avatar.adapter.d.ts +2 -0
- package/dist/color-mode-avatar/color-mode-avatar.adapter.js +6 -0
- package/dist/color-mode-button/color-mode-button.adapter.d.ts +2 -0
- package/dist/color-mode-button/color-mode-button.adapter.js +11 -0
- package/dist/color-mode-image/color-mode-image.adapter.d.ts +2 -0
- package/dist/color-mode-image/color-mode-image.adapter.js +6 -0
- package/dist/color-mode-image/mode-image.d.ts +4 -0
- package/dist/color-mode-image/mode-image.js +8 -0
- package/dist/color-mode-select/color-mode-select.adapter.d.ts +2 -0
- package/dist/color-mode-select/color-mode-select.adapter.js +16 -0
- package/dist/color-mode-switch/color-mode-switch.adapter.d.ts +2 -0
- package/dist/color-mode-switch/color-mode-switch.adapter.js +5 -0
- package/dist/color-picker/color-hex.d.ts +11 -0
- package/dist/color-picker/color-hex.js +57 -0
- package/dist/color-picker/color-picker.adapter.d.ts +2 -0
- package/dist/color-picker/color-picker.adapter.js +20 -0
- package/dist/color-picker/use-color-model.d.ts +6 -0
- package/dist/color-picker/use-color-model.js +18 -0
- package/dist/command-palette/command-palette.adapter.d.ts +2 -0
- package/dist/command-palette/command-palette.adapter.js +44 -0
- package/dist/container/container.adapter.d.ts +2 -0
- package/dist/container/container.adapter.js +4 -0
- package/dist/content-navigation/content-navigation.adapter.d.ts +2 -0
- package/dist/content-navigation/content-navigation.adapter.js +10 -0
- package/dist/content-search/content-search.adapter.d.ts +2 -0
- package/dist/content-search/content-search.adapter.js +27 -0
- package/dist/content-search-button/content-search-button.adapter.d.ts +2 -0
- package/dist/content-search-button/content-search-button.adapter.js +6 -0
- package/dist/content-surround/content-surround.adapter.d.ts +2 -0
- package/dist/content-surround/content-surround.adapter.js +14 -0
- package/dist/content-toc/content-toc.adapter.d.ts +2 -0
- package/dist/content-toc/content-toc.adapter.js +10 -0
- package/dist/context-menu/context-menu.adapter.d.ts +2 -0
- package/dist/context-menu/context-menu.adapter.js +13 -0
- package/dist/context-menu/keyboard-trigger.d.ts +2 -0
- package/dist/context-menu/keyboard-trigger.js +13 -0
- package/dist/dashboard-group/dashboard-group.adapter.d.ts +3 -0
- package/dist/dashboard-group/dashboard-group.adapter.js +54 -0
- package/dist/dashboard-navbar/dashboard-navbar.adapter.d.ts +2 -0
- package/dist/dashboard-navbar/dashboard-navbar.adapter.js +12 -0
- package/dist/dashboard-panel/dashboard-panel.adapter.d.ts +2 -0
- package/dist/dashboard-panel/dashboard-panel.adapter.js +18 -0
- package/dist/dashboard-resize-handle/dashboard-resize-handle.adapter.d.ts +2 -0
- package/dist/dashboard-resize-handle/dashboard-resize-handle.adapter.js +46 -0
- package/dist/dashboard-search/dashboard-search.adapter.d.ts +2 -0
- package/dist/dashboard-search/dashboard-search.adapter.js +24 -0
- package/dist/dashboard-search-button/dashboard-search-button.adapter.d.ts +2 -0
- package/dist/dashboard-search-button/dashboard-search-button.adapter.js +6 -0
- package/dist/dashboard-sidebar/dashboard-sidebar.adapter.d.ts +2 -0
- package/dist/dashboard-sidebar/dashboard-sidebar.adapter.js +19 -0
- package/dist/dashboard-sidebar-collapse/dashboard-sidebar-collapse.adapter.d.ts +2 -0
- package/dist/dashboard-sidebar-collapse/dashboard-sidebar-collapse.adapter.js +22 -0
- package/dist/dashboard-sidebar-toggle/dashboard-sidebar-toggle.adapter.d.ts +2 -0
- package/dist/dashboard-sidebar-toggle/dashboard-sidebar-toggle.adapter.js +22 -0
- package/dist/dashboard-toolbar/dashboard-toolbar.adapter.d.ts +2 -0
- package/dist/dashboard-toolbar/dashboard-toolbar.adapter.js +4 -0
- package/dist/data-table/data-table.adapter.d.ts +2 -0
- package/dist/data-table/data-table.adapter.js +28 -0
- package/dist/data-table/filters.adapter.d.ts +8 -0
- package/dist/data-table/filters.adapter.js +40 -0
- package/dist/data-table/pagination.adapter.d.ts +2 -0
- package/dist/data-table/pagination.adapter.js +21 -0
- package/dist/divider/divider.adapter.d.ts +1 -0
- package/dist/divider/divider.adapter.js +5 -0
- package/dist/drawer/drawer.adapter.d.ts +2 -0
- package/dist/drawer/drawer.adapter.js +14 -0
- package/dist/dropdown-menu/dropdown-menu.adapter.d.ts +2 -0
- package/dist/dropdown-menu/dropdown-menu.adapter.js +14 -0
- package/dist/editor/drag-session.d.ts +7 -0
- package/dist/editor/drag-session.js +41 -0
- package/dist/editor/editor.adapter.d.ts +2 -0
- package/dist/editor/editor.adapter.js +21 -0
- package/dist/editor/publish-edit.d.ts +3 -0
- package/dist/editor/publish-edit.js +12 -0
- package/dist/editor/use-editor-port.d.ts +5 -0
- package/dist/editor/use-editor-port.js +40 -0
- package/dist/editor/use-editor-session.d.ts +14 -0
- package/dist/editor/use-editor-session.js +198 -0
- package/dist/editor-conversion/attribute.d.ts +3 -0
- package/dist/editor-conversion/attribute.js +3 -0
- package/dist/editor-conversion/budget.d.ts +2 -0
- package/dist/editor-conversion/budget.js +61 -0
- package/dist/editor-conversion/from-sdk-block.d.ts +5 -0
- package/dist/editor-conversion/from-sdk-block.js +73 -0
- package/dist/editor-conversion/from-sdk-inline.d.ts +3 -0
- package/dist/editor-conversion/from-sdk-inline.js +57 -0
- package/dist/editor-conversion/from-sdk.d.ts +4 -0
- package/dist/editor-conversion/from-sdk.js +35 -0
- package/dist/editor-conversion/id-allocator.d.ts +2 -0
- package/dist/editor-conversion/id-allocator.js +29 -0
- package/dist/editor-conversion/projection-weight.d.ts +8 -0
- package/dist/editor-conversion/projection-weight.js +124 -0
- package/dist/editor-conversion/text-chunks.d.ts +6 -0
- package/dist/editor-conversion/text-chunks.js +18 -0
- package/dist/editor-conversion/to-sdk.d.ts +3 -0
- package/dist/editor-conversion/to-sdk.js +58 -0
- package/dist/editor-drag-handle/editor-drag-handle.adapter.d.ts +2 -0
- package/dist/editor-drag-handle/editor-drag-handle.adapter.js +54 -0
- package/dist/editor-drag-handle/use-drag-session.d.ts +9 -0
- package/dist/editor-drag-handle/use-drag-session.js +22 -0
- package/dist/editor-emoji-menu/editor-emoji-menu.adapter.d.ts +2 -0
- package/dist/editor-emoji-menu/editor-emoji-menu.adapter.js +9 -0
- package/dist/editor-mention-menu/editor-mention-menu.adapter.d.ts +2 -0
- package/dist/editor-mention-menu/editor-mention-menu.adapter.js +17 -0
- package/dist/editor-menu/lookup-controller.d.ts +24 -0
- package/dist/editor-menu/lookup-controller.js +83 -0
- package/dist/editor-menu/menu-panel.d.ts +10 -0
- package/dist/editor-menu/menu-panel.js +17 -0
- package/dist/editor-menu/menu-plugin.d.ts +3 -0
- package/dist/editor-menu/menu-plugin.js +190 -0
- package/dist/editor-menu/menu-port.d.ts +3 -0
- package/dist/editor-menu/menu-port.js +27 -0
- package/dist/editor-menu/menu-store.d.ts +20 -0
- package/dist/editor-menu/menu-store.js +92 -0
- package/dist/editor-menu/use-editor-menu.d.ts +9 -0
- package/dist/editor-menu/use-editor-menu.js +21 -0
- package/dist/editor-sdk/apply-paste.d.ts +3 -0
- package/dist/editor-sdk/apply-paste.js +12 -0
- package/dist/editor-sdk/atom-data.d.ts +7 -0
- package/dist/editor-sdk/atom-data.js +41 -0
- package/dist/editor-sdk/atoms.d.ts +3 -0
- package/dist/editor-sdk/atoms.js +25 -0
- package/dist/editor-sdk/block-types.d.ts +1 -0
- package/dist/editor-sdk/block-types.js +10 -0
- package/dist/editor-sdk/command-chain.d.ts +3 -0
- package/dist/editor-sdk/command-chain.js +25 -0
- package/dist/editor-sdk/commands.d.ts +5 -0
- package/dist/editor-sdk/commands.js +38 -0
- package/dist/editor-sdk/controlled-selection.d.ts +2 -0
- package/dist/editor-sdk/controlled-selection.js +8 -0
- package/dist/editor-sdk/extensions.d.ts +2 -0
- package/dist/editor-sdk/extensions.js +21 -0
- package/dist/editor-sdk/identity-plugin.d.ts +18 -0
- package/dist/editor-sdk/identity-plugin.js +107 -0
- package/dist/editor-sdk/identity.d.ts +3 -0
- package/dist/editor-sdk/identity.js +28 -0
- package/dist/editor-sdk/plain-paste.d.ts +3 -0
- package/dist/editor-sdk/plain-paste.js +66 -0
- package/dist/editor-sdk/resources.d.ts +5 -0
- package/dist/editor-sdk/resources.js +14 -0
- package/dist/editor-sdk/select-block.d.ts +2 -0
- package/dist/editor-sdk/select-block.js +31 -0
- package/dist/editor-sdk/selection-mapping.d.ts +9 -0
- package/dist/editor-sdk/selection-mapping.js +92 -0
- package/dist/editor-sdk/structural-selection.d.ts +4 -0
- package/dist/editor-sdk/structural-selection.js +21 -0
- package/dist/editor-suggestion-menu/editor-suggestion-menu.adapter.d.ts +2 -0
- package/dist/editor-suggestion-menu/editor-suggestion-menu.adapter.js +13 -0
- package/dist/editor-toolbar/editor-toolbar.adapter.d.ts +2 -0
- package/dist/editor-toolbar/editor-toolbar.adapter.js +38 -0
- package/dist/element/variants.d.ts +5 -0
- package/dist/element/variants.js +5 -0
- package/dist/empty/empty.adapter.d.ts +2 -0
- package/dist/empty/empty.adapter.js +10 -0
- package/dist/error/error.adapter.d.ts +2 -0
- package/dist/error/error.adapter.js +9 -0
- package/dist/field-group/field-group.adapter.d.ts +2 -0
- package/dist/field-group/field-group.adapter.js +5 -0
- package/dist/file-upload/file-upload.adapter.d.ts +2 -0
- package/dist/file-upload/file-upload.adapter.js +60 -0
- package/dist/file-upload/intake-validation.d.ts +8 -0
- package/dist/file-upload/intake-validation.js +48 -0
- package/dist/file-upload/intake.d.ts +36 -0
- package/dist/file-upload/intake.js +112 -0
- package/dist/file-upload/read-file.d.ts +5 -0
- package/dist/file-upload/read-file.js +32 -0
- package/dist/footer/footer.adapter.d.ts +2 -0
- package/dist/footer/footer.adapter.js +4 -0
- package/dist/footer-columns/footer-columns.adapter.d.ts +2 -0
- package/dist/footer-columns/footer-columns.adapter.js +8 -0
- package/dist/form-field/focus-control.d.ts +1 -0
- package/dist/form-field/focus-control.js +21 -0
- package/dist/form-field/form-field.adapter.d.ts +2 -0
- package/dist/form-field/form-field.adapter.js +22 -0
- package/dist/form-menu-shared/request.d.ts +4 -0
- package/dist/form-menu-shared/request.js +14 -0
- package/dist/grid/grid.adapter.d.ts +2 -0
- package/dist/grid/grid.adapter.js +5 -0
- package/dist/h-stack/h-stack.adapter.d.ts +2 -0
- package/dist/h-stack/h-stack.adapter.js +5 -0
- package/dist/header/header-menu.d.ts +7 -0
- package/dist/header/header-menu.js +25 -0
- package/dist/header/header.adapter.d.ts +2 -0
- package/dist/header/header.adapter.js +5 -0
- package/dist/icon/icon-map.d.ts +16 -0
- package/dist/icon/icon-map.js +17 -0
- package/dist/icon/icon.adapter.d.ts +2 -0
- package/dist/icon/icon.adapter.js +7 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/input/input.adapter.d.ts +2 -0
- package/dist/input/input.adapter.js +34 -0
- package/dist/input/validation-message.d.ts +1 -0
- package/dist/input/validation-message.js +13 -0
- package/dist/input-date/date-control.d.ts +16 -0
- package/dist/input-date/date-control.js +35 -0
- package/dist/input-date/input-date.adapter.d.ts +2 -0
- package/dist/input-date/input-date.adapter.js +36 -0
- package/dist/input-menu/input-menu-form.d.ts +7 -0
- package/dist/input-menu/input-menu-form.js +8 -0
- package/dist/input-menu/input-menu-popup.d.ts +8 -0
- package/dist/input-menu/input-menu-popup.js +13 -0
- package/dist/input-menu/input-menu.adapter.d.ts +2 -0
- package/dist/input-menu/input-menu.adapter.js +74 -0
- package/dist/input-menu/use-input-menu.d.ts +26 -0
- package/dist/input-menu/use-input-menu.js +92 -0
- package/dist/input-number/input-number.adapter.d.ts +2 -0
- package/dist/input-number/input-number.adapter.js +13 -0
- package/dist/input-rating/input-rating.adapter.d.ts +2 -0
- package/dist/input-rating/input-rating.adapter.js +33 -0
- package/dist/input-rating/rating-stars.d.ts +4 -0
- package/dist/input-rating/rating-stars.js +9 -0
- package/dist/input-tags/input-tags.adapter.d.ts +2 -0
- package/dist/input-tags/input-tags.adapter.js +47 -0
- package/dist/input-tags/use-tag-draft.d.ts +9 -0
- package/dist/input-tags/use-tag-draft.js +43 -0
- package/dist/input-time/anchored-time.d.ts +1 -0
- package/dist/input-time/anchored-time.js +5 -0
- package/dist/input-time/draft-validation.d.ts +1 -0
- package/dist/input-time/draft-validation.js +1 -0
- package/dist/input-time/focus-draft.d.ts +1 -0
- package/dist/input-time/focus-draft.js +1 -0
- package/dist/input-time/input-time.adapter.d.ts +2 -0
- package/dist/input-time/input-time.adapter.js +32 -0
- package/dist/input-time/time-control.d.ts +15 -0
- package/dist/input-time/time-control.js +37 -0
- package/dist/input-time/use-time-change.d.ts +10 -0
- package/dist/input-time/use-time-change.js +4 -0
- package/dist/kbd/kbd-key.adapter.d.ts +5 -0
- package/dist/kbd/kbd-key.adapter.js +5 -0
- package/dist/kbd/kbd.adapter.d.ts +2 -0
- package/dist/kbd/kbd.adapter.js +8 -0
- package/dist/listbox/clear-focus.d.ts +1 -0
- package/dist/listbox/clear-focus.js +8 -0
- package/dist/listbox/form-bridge.d.ts +14 -0
- package/dist/listbox/form-bridge.js +34 -0
- package/dist/listbox/listbox.adapter.d.ts +2 -0
- package/dist/listbox/listbox.adapter.js +79 -0
- package/dist/listbox/native-semantics.d.ts +9 -0
- package/dist/listbox/native-semantics.js +33 -0
- package/dist/listbox/selection.d.ts +4 -0
- package/dist/listbox/selection.js +31 -0
- package/dist/listbox/use-listbox-request.d.ts +10 -0
- package/dist/listbox/use-listbox-request.js +73 -0
- package/dist/locale-select/locale-select.adapter.d.ts +2 -0
- package/dist/locale-select/locale-select.adapter.js +15 -0
- package/dist/main/main.adapter.d.ts +2 -0
- package/dist/main/main.adapter.js +7 -0
- package/dist/marquee/marquee.adapter.d.ts +2 -0
- package/dist/marquee/marquee.adapter.js +23 -0
- package/dist/modal/modal.adapter.d.ts +2 -0
- package/dist/modal/modal.adapter.js +30 -0
- package/dist/navigation/navigation.adapter.d.ts +2 -0
- package/dist/navigation/navigation.adapter.js +5 -0
- package/dist/navigation-menu/menu-target.d.ts +4 -0
- package/dist/navigation-menu/menu-target.js +13 -0
- package/dist/navigation-menu/navigation-menu.adapter.d.ts +2 -0
- package/dist/navigation-menu/navigation-menu.adapter.js +16 -0
- package/dist/page-anchors/page-anchors.adapter.d.ts +3 -0
- package/dist/page-anchors/page-anchors.adapter.js +5 -0
- package/dist/page-aside/page-aside.adapter.d.ts +2 -0
- package/dist/page-aside/page-aside.adapter.js +6 -0
- package/dist/page-body/page-body.adapter.d.ts +2 -0
- package/dist/page-body/page-body.adapter.js +4 -0
- package/dist/page-card/page-card.adapter.d.ts +3 -0
- package/dist/page-card/page-card.adapter.js +5 -0
- package/dist/page-columns/page-columns.adapter.d.ts +2 -0
- package/dist/page-columns/page-columns.adapter.js +5 -0
- package/dist/page-cta/page-cta.adapter.d.ts +3 -0
- package/dist/page-cta/page-cta.adapter.js +5 -0
- package/dist/page-feature/page-feature.adapter.d.ts +3 -0
- package/dist/page-feature/page-feature.adapter.js +6 -0
- package/dist/page-grid/page-grid.adapter.d.ts +2 -0
- package/dist/page-grid/page-grid.adapter.js +4 -0
- package/dist/page-header/page-header.adapter.d.ts +3 -0
- package/dist/page-header/page-header.adapter.js +5 -0
- package/dist/page-hero/page-hero.adapter.d.ts +3 -0
- package/dist/page-hero/page-hero.adapter.js +5 -0
- package/dist/page-links/page-links.adapter.d.ts +3 -0
- package/dist/page-links/page-links.adapter.js +5 -0
- package/dist/page-list/page-list.adapter.d.ts +2 -0
- package/dist/page-list/page-list.adapter.js +6 -0
- package/dist/page-logos/page-logos.adapter.d.ts +2 -0
- package/dist/page-logos/page-logos.adapter.js +11 -0
- package/dist/page-section/page-section.adapter.d.ts +3 -0
- package/dist/page-section/page-section.adapter.js +5 -0
- package/dist/pagination/pagination-control.d.ts +13 -0
- package/dist/pagination/pagination-control.js +31 -0
- package/dist/pagination/pagination.adapter.d.ts +2 -0
- package/dist/pagination/pagination.adapter.js +23 -0
- package/dist/panel/use-panel-frame.d.ts +15 -0
- package/dist/panel/use-panel-frame.js +36 -0
- package/dist/pin-input/pin-input.adapter.d.ts +2 -0
- package/dist/pin-input/pin-input.adapter.js +18 -0
- package/dist/pin-input/pin-slots.d.ts +6 -0
- package/dist/pin-input/pin-slots.js +9 -0
- package/dist/popover/popover.adapter.d.ts +2 -0
- package/dist/popover/popover.adapter.js +55 -0
- package/dist/pricing-plan/pricing-plan.adapter.d.ts +3 -0
- package/dist/pricing-plan/pricing-plan.adapter.js +15 -0
- package/dist/pricing-plans/pricing-plans.adapter.d.ts +3 -0
- package/dist/pricing-plans/pricing-plans.adapter.js +8 -0
- package/dist/pricing-table/pricing-table.adapter.d.ts +3 -0
- package/dist/pricing-table/pricing-table.adapter.js +9 -0
- package/dist/progress/progress.adapter.d.ts +2 -0
- package/dist/progress/progress.adapter.js +10 -0
- package/dist/progress-group/progress-group.adapter.d.ts +2 -0
- package/dist/progress-group/progress-group.adapter.js +9 -0
- package/dist/radio-group/radio-group.adapter.d.ts +2 -0
- package/dist/radio-group/radio-group.adapter.js +14 -0
- package/dist/registry/action-menus.d.ts +4 -0
- package/dist/registry/action-menus.js +9 -0
- package/dist/registry/auth-form.d.ts +3 -0
- package/dist/registry/auth-form.js +6 -0
- package/dist/registry/calendar.d.ts +3 -0
- package/dist/registry/calendar.js +6 -0
- package/dist/registry/carousel.d.ts +3 -0
- package/dist/registry/carousel.js +6 -0
- package/dist/registry/chart.d.ts +3 -0
- package/dist/registry/chart.js +4 -0
- package/dist/registry/chat-composer.d.ts +5 -0
- package/dist/registry/chat-composer.js +12 -0
- package/dist/registry/chat-feedback.d.ts +5 -0
- package/dist/registry/chat-feedback.js +12 -0
- package/dist/registry/chat.d.ts +5 -0
- package/dist/registry/chat.js +12 -0
- package/dist/registry/color-mode.d.ts +7 -0
- package/dist/registry/color-mode.js +18 -0
- package/dist/registry/color-picker.d.ts +3 -0
- package/dist/registry/color-picker.js +6 -0
- package/dist/registry/command-palette.d.ts +3 -0
- package/dist/registry/command-palette.js +6 -0
- package/dist/registry/content-outline.d.ts +4 -0
- package/dist/registry/content-outline.js +9 -0
- package/dist/registry/content-search.d.ts +4 -0
- package/dist/registry/content-search.js +9 -0
- package/dist/registry/content.d.ts +26 -0
- package/dist/registry/content.js +75 -0
- package/dist/registry/dashboard.d.ts +12 -0
- package/dist/registry/dashboard.js +33 -0
- package/dist/registry/edge-panels.d.ts +4 -0
- package/dist/registry/edge-panels.js +9 -0
- package/dist/registry/editor-drag-handle.d.ts +3 -0
- package/dist/registry/editor-drag-handle.js +6 -0
- package/dist/registry/editor-menus.d.ts +5 -0
- package/dist/registry/editor-menus.js +12 -0
- package/dist/registry/editor.d.ts +4 -0
- package/dist/registry/editor.js +9 -0
- package/dist/registry/editorial.d.ts +6 -0
- package/dist/registry/editorial.js +15 -0
- package/dist/registry/element.d.ts +3 -0
- package/dist/registry/element.js +4 -0
- package/dist/registry/feedback.d.ts +8 -0
- package/dist/registry/feedback.js +21 -0
- package/dist/registry/fields.d.ts +24 -0
- package/dist/registry/fields.js +69 -0
- package/dist/registry/file-upload.d.ts +3 -0
- package/dist/registry/file-upload.js +6 -0
- package/dist/registry/listbox.d.ts +3 -0
- package/dist/registry/listbox.js +6 -0
- package/dist/registry/marquee.d.ts +3 -0
- package/dist/registry/marquee.js +6 -0
- package/dist/registry/navigation-composition.d.ts +5 -0
- package/dist/registry/navigation-composition.js +12 -0
- package/dist/registry/page-composition.d.ts +7 -0
- package/dist/registry/page-composition.js +18 -0
- package/dist/registry/page-logos.d.ts +3 -0
- package/dist/registry/page-logos.js +6 -0
- package/dist/registry/page-navigation.d.ts +5 -0
- package/dist/registry/page-navigation.js +12 -0
- package/dist/registry/page-presentation.d.ts +7 -0
- package/dist/registry/page-presentation.js +18 -0
- package/dist/registry/pricing.d.ts +5 -0
- package/dist/registry/pricing.js +12 -0
- package/dist/registry/shells.d.ts +10 -0
- package/dist/registry/shells.js +27 -0
- package/dist/registry/sidebar-splitter.d.ts +4 -0
- package/dist/registry/sidebar-splitter.js +9 -0
- package/dist/registry/structure.d.ts +10 -0
- package/dist/registry/structure.js +27 -0
- package/dist/registry/toast.d.ts +3 -0
- package/dist/registry/toast.js +4 -0
- package/dist/scroll-area/scroll-area.adapter.d.ts +2 -0
- package/dist/scroll-area/scroll-area.adapter.js +6 -0
- package/dist/select/display-text.d.ts +2 -0
- package/dist/select/display-text.js +18 -0
- package/dist/select/select-base-content.adapter.d.ts +6 -0
- package/dist/select/select-base-content.adapter.js +16 -0
- package/dist/select/select-content.adapter.d.ts +4 -0
- package/dist/select/select-content.adapter.js +11 -0
- package/dist/select/select-option.d.ts +5 -0
- package/dist/select/select-option.js +6 -0
- package/dist/select/select.adapter.d.ts +2 -0
- package/dist/select/select.adapter.js +47 -0
- package/dist/select/use-select-change.d.ts +2 -0
- package/dist/select/use-select-change.js +29 -0
- package/dist/select-menu/select-menu-form.d.ts +7 -0
- package/dist/select-menu/select-menu-form.js +14 -0
- package/dist/select-menu/select-menu-popup.d.ts +8 -0
- package/dist/select-menu/select-menu-popup.js +39 -0
- package/dist/select-menu/select-menu-root.d.ts +8 -0
- package/dist/select-menu/select-menu-root.js +34 -0
- package/dist/select-menu/select-menu.adapter.d.ts +2 -0
- package/dist/select-menu/select-menu.adapter.js +63 -0
- package/dist/select-menu/use-select-menu.d.ts +22 -0
- package/dist/select-menu/use-select-menu.js +111 -0
- package/dist/separator/separator.adapter.d.ts +2 -0
- package/dist/separator/separator.adapter.js +6 -0
- package/dist/shadcn.adapter.d.ts +2 -0
- package/dist/shadcn.adapter.js +102 -0
- package/dist/sidebar/sidebar.adapter.d.ts +2 -0
- package/dist/sidebar/sidebar.adapter.js +63 -0
- package/dist/skeleton/skeleton.adapter.d.ts +2 -0
- package/dist/skeleton/skeleton.adapter.js +8 -0
- package/dist/slideover/slideover.adapter.d.ts +2 -0
- package/dist/slideover/slideover.adapter.js +14 -0
- package/dist/slider/request-change.d.ts +2 -0
- package/dist/slider/request-change.js +34 -0
- package/dist/slider/slider-thumb.d.ts +7 -0
- package/dist/slider/slider-thumb.js +18 -0
- package/dist/slider/slider.adapter.d.ts +2 -0
- package/dist/slider/slider.adapter.js +36 -0
- package/dist/splitter/splitter.adapter.d.ts +3 -0
- package/dist/splitter/splitter.adapter.js +50 -0
- package/dist/stepper/stepper.adapter.d.ts +2 -0
- package/dist/stepper/stepper.adapter.js +30 -0
- package/dist/styles-contract.d.ts +1 -0
- package/dist/styles-contract.js +1 -0
- package/dist/styles.css +2 -0
- package/dist/styles.d.ts +1 -0
- package/dist/styles.js +1 -0
- package/dist/submit-button/submit-button.adapter.d.ts +2 -0
- package/dist/submit-button/submit-button.adapter.js +11 -0
- package/dist/surface/surface.adapter.d.ts +2 -0
- package/dist/surface/surface.adapter.js +8 -0
- package/dist/switch/switch.adapter.d.ts +2 -0
- package/dist/switch/switch.adapter.js +26 -0
- package/dist/table/interactive-table.d.ts +2 -0
- package/dist/table/interactive-table.js +24 -0
- package/dist/table/table.adapter.d.ts +2 -0
- package/dist/table/table.adapter.js +14 -0
- package/dist/tabs/tabs.adapter.d.ts +2 -0
- package/dist/tabs/tabs.adapter.js +17 -0
- package/dist/temporal/draft-validity.d.ts +13 -0
- package/dist/temporal/draft-validity.js +18 -0
- package/dist/temporal/focus-incomplete-segment.d.ts +1 -0
- package/dist/temporal/focus-incomplete-segment.js +7 -0
- package/dist/temporal/range-reset-focus.d.ts +1 -0
- package/dist/temporal/range-reset-focus.js +16 -0
- package/dist/temporal/temporal-recovery.d.ts +6 -0
- package/dist/temporal/temporal-recovery.js +4 -0
- package/dist/temporal/use-range-reset.d.ts +6 -0
- package/dist/temporal/use-range-reset.js +55 -0
- package/dist/temporal/use-temporal-change.d.ts +10 -0
- package/dist/temporal/use-temporal-change.js +21 -0
- package/dist/text/text.adapter.d.ts +1 -0
- package/dist/text/text.adapter.js +1 -0
- package/dist/text-area/text-area.adapter.d.ts +2 -0
- package/dist/text-area/text-area.adapter.js +9 -0
- package/dist/textarea/textarea.adapter.d.ts +2 -0
- package/dist/textarea/textarea.adapter.js +40 -0
- package/dist/textarea/use-auto-rows.d.ts +2 -0
- package/dist/textarea/use-auto-rows.js +33 -0
- package/dist/theme/theme.adapter.d.ts +2 -0
- package/dist/theme/theme.adapter.js +23 -0
- package/dist/timeline/timeline.adapter.d.ts +2 -0
- package/dist/timeline/timeline.adapter.js +13 -0
- package/dist/toast/toast-data.d.ts +17 -0
- package/dist/toast/toast-data.js +1 -0
- package/dist/toast/toast-focus.d.ts +12 -0
- package/dist/toast/toast-focus.js +38 -0
- package/dist/toast/toast-provider.d.ts +4 -0
- package/dist/toast/toast-provider.js +11 -0
- package/dist/toast/toast-queue-context.d.ts +24 -0
- package/dist/toast/toast-queue-context.js +8 -0
- package/dist/toast/toast-queue.d.ts +12 -0
- package/dist/toast/toast-queue.js +29 -0
- package/dist/toast/toast-registration.d.ts +9 -0
- package/dist/toast/toast-registration.js +149 -0
- package/dist/toast/toast-viewport.d.ts +1 -0
- package/dist/toast/toast-viewport.js +36 -0
- package/dist/toast/toast.adapter.d.ts +2 -0
- package/dist/toast/toast.adapter.js +14 -0
- package/dist/toggle/toggle.adapter.d.ts +2 -0
- package/dist/toggle/toggle.adapter.js +8 -0
- package/dist/tooltip/tooltip.adapter.d.ts +2 -0
- package/dist/tooltip/tooltip.adapter.js +29 -0
- package/dist/tooltip/use-tooltip-anchor.d.ts +5 -0
- package/dist/tooltip/use-tooltip-anchor.js +36 -0
- package/dist/tree/focus-element.d.ts +1 -0
- package/dist/tree/focus-element.js +4 -0
- package/dist/tree/tree.adapter.d.ts +2 -0
- package/dist/tree/tree.adapter.js +27 -0
- package/dist/tree/use-tree.d.ts +13 -0
- package/dist/tree/use-tree.js +73 -0
- package/dist/user/user.adapter.d.ts +2 -0
- package/dist/user/user.adapter.js +24 -0
- package/dist/v-stack/v-stack.adapter.d.ts +2 -0
- package/dist/v-stack/v-stack.adapter.js +5 -0
- package/dist/vendor/lib/utils.d.ts +2 -0
- package/dist/vendor/lib/utils.js +5 -0
- package/dist/vendor/ui/accordion.d.ts +7 -0
- package/dist/vendor/ui/accordion.js +14 -0
- package/dist/vendor/ui/alert.d.ts +8 -0
- package/dist/vendor/ui/alert.js +22 -0
- package/dist/vendor/ui/badge.d.ts +9 -0
- package/dist/vendor/ui/badge.js +21 -0
- package/dist/vendor/ui/button.d.ts +11 -0
- package/dist/vendor/ui/button.js +33 -0
- package/dist/vendor/ui/card.d.ts +8 -0
- package/dist/vendor/ui/card.js +16 -0
- package/dist/vendor/ui/checkbox.d.ts +4 -0
- package/dist/vendor/ui/checkbox.js +9 -0
- package/dist/vendor/ui/input.d.ts +3 -0
- package/dist/vendor/ui/input.js +8 -0
- package/dist/vendor/ui/label.d.ts +5 -0
- package/dist/vendor/ui/label.js +10 -0
- package/dist/vendor/ui/progress.d.ts +4 -0
- package/dist/vendor/ui/progress.js +8 -0
- package/dist/vendor/ui/select.d.ts +13 -0
- package/dist/vendor/ui/select.js +27 -0
- package/dist/vendor/ui/separator.d.ts +4 -0
- package/dist/vendor/ui/separator.js +8 -0
- package/dist/vendor/ui/slider.d.ts +4 -0
- package/dist/vendor/ui/slider.js +8 -0
- package/dist/vendor/ui/switch.d.ts +4 -0
- package/dist/vendor/ui/switch.js +8 -0
- package/dist/vendor/ui/tabs.d.ts +7 -0
- package/dist/vendor/ui/tabs.js +13 -0
- package/dist/vendor/ui/textarea.d.ts +3 -0
- package/dist/vendor/ui/textarea.js +8 -0
- package/package.json +71 -3
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { EDITOR_SDK_BLOCK_TYPES } from '../editor-sdk/block-types.js';
|
|
3
|
+
import { sdkAttribute } from './attribute.js';
|
|
4
|
+
import { inlineContentFromSdk } from './from-sdk-inline.js';
|
|
5
|
+
const blockType = z.enum(EDITOR_SDK_BLOCK_TYPES);
|
|
6
|
+
export function sdkChildren(node, project) {
|
|
7
|
+
const children = [];
|
|
8
|
+
node.forEach((child) => {
|
|
9
|
+
children.push(project(child));
|
|
10
|
+
});
|
|
11
|
+
return children;
|
|
12
|
+
}
|
|
13
|
+
const projectors = {
|
|
14
|
+
paragraph(node, identify) {
|
|
15
|
+
return {
|
|
16
|
+
type: 'paragraph',
|
|
17
|
+
id: identify(node),
|
|
18
|
+
content: inlineContentFromSdk(node),
|
|
19
|
+
};
|
|
20
|
+
},
|
|
21
|
+
heading(node, identify) {
|
|
22
|
+
return {
|
|
23
|
+
type: 'heading',
|
|
24
|
+
id: identify(node),
|
|
25
|
+
level: sdkAttribute(node, 'level'),
|
|
26
|
+
content: inlineContentFromSdk(node),
|
|
27
|
+
};
|
|
28
|
+
},
|
|
29
|
+
blockquote(node, identify) {
|
|
30
|
+
return {
|
|
31
|
+
type: 'quote',
|
|
32
|
+
id: identify(node),
|
|
33
|
+
children: sdkChildren(node, (child) => blockFromSdk(child, identify)),
|
|
34
|
+
};
|
|
35
|
+
},
|
|
36
|
+
codeBlock(node, identify) {
|
|
37
|
+
const language = sdkAttribute(node, 'language');
|
|
38
|
+
return {
|
|
39
|
+
type: 'codeBlock',
|
|
40
|
+
id: identify(node),
|
|
41
|
+
text: node.textContent,
|
|
42
|
+
...(language == null ? {} : { language }),
|
|
43
|
+
};
|
|
44
|
+
},
|
|
45
|
+
bulletList(node, identify) {
|
|
46
|
+
return {
|
|
47
|
+
type: 'bulletList',
|
|
48
|
+
id: identify(node),
|
|
49
|
+
items: sdkChildren(node, (child) => blockFromSdk(child, identify)),
|
|
50
|
+
};
|
|
51
|
+
},
|
|
52
|
+
orderedList(node, identify) {
|
|
53
|
+
return {
|
|
54
|
+
type: 'orderedList',
|
|
55
|
+
id: identify(node),
|
|
56
|
+
start: sdkAttribute(node, 'start'),
|
|
57
|
+
items: sdkChildren(node, (child) => blockFromSdk(child, identify)),
|
|
58
|
+
};
|
|
59
|
+
},
|
|
60
|
+
listItem(node, identify) {
|
|
61
|
+
return {
|
|
62
|
+
type: 'listItem',
|
|
63
|
+
id: identify(node),
|
|
64
|
+
children: sdkChildren(node, (child) => blockFromSdk(child, identify)),
|
|
65
|
+
};
|
|
66
|
+
},
|
|
67
|
+
horizontalRule(node, identify) {
|
|
68
|
+
return { type: 'separator', id: identify(node) };
|
|
69
|
+
},
|
|
70
|
+
};
|
|
71
|
+
export function blockFromSdk(node, identify) {
|
|
72
|
+
return projectors[blockType.parse(node.type.name)](node, identify);
|
|
73
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { EDITOR_MARKS } from '@fastsprout/reacd/adapter-runtime/core/editor-policy.js';
|
|
3
|
+
import { sdkAttribute } from './attribute.js';
|
|
4
|
+
import { editorTextChunks } from './text-chunks.js';
|
|
5
|
+
const inlineType = z.enum(['text', 'hardBreak', 'reacdMention', 'reacdEmoji']);
|
|
6
|
+
const markType = z.enum([...EDITOR_MARKS, 'link']);
|
|
7
|
+
const projectors = {
|
|
8
|
+
text(node) {
|
|
9
|
+
const marks = [];
|
|
10
|
+
let link;
|
|
11
|
+
for (const mark of node.marks) {
|
|
12
|
+
const type = markType.parse(mark.type.name);
|
|
13
|
+
if (type === 'link')
|
|
14
|
+
link = sdkAttribute(mark, 'href');
|
|
15
|
+
else
|
|
16
|
+
marks.push(type);
|
|
17
|
+
}
|
|
18
|
+
const text = z.string().parse(node.text);
|
|
19
|
+
return [...editorTextChunks(text)].map(({ from, to }) => ({
|
|
20
|
+
type: 'text',
|
|
21
|
+
text: text.slice(from, to),
|
|
22
|
+
...(marks.length === 0 ? {} : { marks: [...marks] }),
|
|
23
|
+
...(link === undefined ? {} : { link }),
|
|
24
|
+
}));
|
|
25
|
+
},
|
|
26
|
+
hardBreak() {
|
|
27
|
+
return [{ type: 'hardBreak' }];
|
|
28
|
+
},
|
|
29
|
+
reacdMention(node) {
|
|
30
|
+
return [
|
|
31
|
+
{
|
|
32
|
+
type: 'mention',
|
|
33
|
+
id: sdkAttribute(node, 'id'),
|
|
34
|
+
label: sdkAttribute(node, 'label'),
|
|
35
|
+
},
|
|
36
|
+
];
|
|
37
|
+
},
|
|
38
|
+
reacdEmoji(node) {
|
|
39
|
+
return [
|
|
40
|
+
{
|
|
41
|
+
type: 'emoji',
|
|
42
|
+
name: sdkAttribute(node, 'name'),
|
|
43
|
+
value: sdkAttribute(node, 'value'),
|
|
44
|
+
},
|
|
45
|
+
];
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
export function inlineFromSdk(node) {
|
|
49
|
+
return projectors[inlineType.parse(node.type.name)](node);
|
|
50
|
+
}
|
|
51
|
+
export function inlineContentFromSdk(node) {
|
|
52
|
+
const content = [];
|
|
53
|
+
node.forEach((child) => {
|
|
54
|
+
content.push(...inlineFromSdk(child));
|
|
55
|
+
});
|
|
56
|
+
return content;
|
|
57
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { Node } from '@tiptap/pm/model';
|
|
2
|
+
import type { EditorDocument } from '@fastsprout/reacd/adapter-runtime/core/editor-document.js';
|
|
3
|
+
import type { Result } from '@fastsprout/reacd/adapter-runtime/core/result.js';
|
|
4
|
+
export declare function editorDocumentFromSdk(document: Node): Result<EditorDocument>;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { EDITOR_ERRORS, EDITOR_POLICY, } from '@fastsprout/reacd/adapter-runtime/core/editor-policy.js';
|
|
2
|
+
import { editorDocumentSchema } from '@fastsprout/reacd/adapter-runtime/schema/editor/document/index.js';
|
|
3
|
+
import { boundedSdkDocument } from './budget.js';
|
|
4
|
+
import { blockFromSdk, sdkChildren } from './from-sdk-block.js';
|
|
5
|
+
import { createSdkIdAllocator } from './id-allocator.js';
|
|
6
|
+
function failure() {
|
|
7
|
+
return {
|
|
8
|
+
success: false,
|
|
9
|
+
issues: [{ path: 'Editor.value', message: EDITOR_ERRORS.projection }],
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
export function editorDocumentFromSdk(document) {
|
|
13
|
+
if (!boundedSdkDocument(document))
|
|
14
|
+
return failure();
|
|
15
|
+
try {
|
|
16
|
+
document.check();
|
|
17
|
+
const identify = createSdkIdAllocator(document);
|
|
18
|
+
const parsed = editorDocumentSchema.safeParse({
|
|
19
|
+
version: EDITOR_POLICY.version,
|
|
20
|
+
blocks: sdkChildren(document, (node) => blockFromSdk(node, identify)),
|
|
21
|
+
});
|
|
22
|
+
return parsed.success
|
|
23
|
+
? { success: true, data: parsed.data }
|
|
24
|
+
: {
|
|
25
|
+
success: false,
|
|
26
|
+
issues: parsed.error.issues.map((issue) => ({
|
|
27
|
+
path: ['Editor', 'value', ...issue.path].map(String).join('.'),
|
|
28
|
+
message: issue.message,
|
|
29
|
+
})),
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
catch {
|
|
33
|
+
return failure();
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { EDITOR_POLICY } from '@fastsprout/reacd/adapter-runtime/core/editor-policy.js';
|
|
2
|
+
import { stateKeySchema } from '@fastsprout/reacd/adapter-runtime/schema/state/shared/definition.js';
|
|
3
|
+
import { EDITOR_SDK_BLOCK_TYPES } from '../editor-sdk/block-types.js';
|
|
4
|
+
import { sdkAttribute } from './attribute.js';
|
|
5
|
+
const BLOCKS = new Set(EDITOR_SDK_BLOCK_TYPES);
|
|
6
|
+
const identitySchema = stateKeySchema.nullish();
|
|
7
|
+
export function createSdkIdAllocator(document) {
|
|
8
|
+
const used = new Set();
|
|
9
|
+
document.descendants((node) => {
|
|
10
|
+
if (!BLOCKS.has(node.type.name))
|
|
11
|
+
return;
|
|
12
|
+
const id = identitySchema.parse(sdkAttribute(node, 'reacdId'));
|
|
13
|
+
if (id != null)
|
|
14
|
+
used.add(id);
|
|
15
|
+
});
|
|
16
|
+
let ordinal = 0;
|
|
17
|
+
return (node) => {
|
|
18
|
+
const current = identitySchema.parse(sdkAttribute(node, 'reacdId'));
|
|
19
|
+
if (current != null)
|
|
20
|
+
return current;
|
|
21
|
+
let id;
|
|
22
|
+
do {
|
|
23
|
+
ordinal += 1;
|
|
24
|
+
id = `${EDITOR_POLICY.blockIdPrefix}-${ordinal}`;
|
|
25
|
+
} while (used.has(id));
|
|
26
|
+
used.add(id);
|
|
27
|
+
return id;
|
|
28
|
+
};
|
|
29
|
+
}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { EDITOR_MARKS, EDITOR_POLICY, } from '@fastsprout/reacd/adapter-runtime/core/editor-policy.js';
|
|
3
|
+
import { CONTENT_POLICY } from '@fastsprout/reacd/adapter-runtime/core/policy.js';
|
|
4
|
+
import { linkSchema } from '@fastsprout/reacd/adapter-runtime/schema/link/link.schema.js';
|
|
5
|
+
import { stateKeySchema } from '@fastsprout/reacd/adapter-runtime/schema/state/shared/definition.js';
|
|
6
|
+
import { editorTextChunks } from './text-chunks.js';
|
|
7
|
+
const markSchema = z.enum(EDITOR_MARKS);
|
|
8
|
+
const optionalId = stateKeySchema.nullish();
|
|
9
|
+
function attribute(node, key) {
|
|
10
|
+
return node.attrs[key];
|
|
11
|
+
}
|
|
12
|
+
function textAttribute(node, key) {
|
|
13
|
+
return z.string().parse(attribute(node, key));
|
|
14
|
+
}
|
|
15
|
+
function identity(node) {
|
|
16
|
+
const parsed = optionalId.parse(attribute(node, 'reacdId'));
|
|
17
|
+
return parsed ?? `${EDITOR_POLICY.blockIdPrefix}-${EDITOR_POLICY.maxBlocks}`;
|
|
18
|
+
}
|
|
19
|
+
function fieldsWeight(fields) {
|
|
20
|
+
const entries = Object.entries(fields);
|
|
21
|
+
return {
|
|
22
|
+
values: entries.length + 1,
|
|
23
|
+
characters: entries.reduce((size, [key, value]) => size + key.length + (typeof value === 'string' ? value.length : 0), 0),
|
|
24
|
+
extraDepth: 1,
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
export function sdkProjectionWeight(node, inCode) {
|
|
28
|
+
const type = node.type.name;
|
|
29
|
+
if (inCode) {
|
|
30
|
+
if (type !== 'text')
|
|
31
|
+
throw new Error('Invalid code child.');
|
|
32
|
+
const text = z.string().max(EDITOR_POLICY.maxTextLength).parse(node.text);
|
|
33
|
+
return { values: 0, characters: text.length, extraDepth: 0 };
|
|
34
|
+
}
|
|
35
|
+
switch (type) {
|
|
36
|
+
case 'doc':
|
|
37
|
+
return fieldsWeight({ version: EDITOR_POLICY.version, blocks: null });
|
|
38
|
+
case 'paragraph':
|
|
39
|
+
return fieldsWeight({ type, id: identity(node), content: null });
|
|
40
|
+
case 'heading':
|
|
41
|
+
return fieldsWeight({
|
|
42
|
+
type,
|
|
43
|
+
id: identity(node),
|
|
44
|
+
content: null,
|
|
45
|
+
level: z.number().parse(attribute(node, 'level')),
|
|
46
|
+
});
|
|
47
|
+
case 'blockquote':
|
|
48
|
+
return fieldsWeight({ type: 'quote', id: identity(node), children: null });
|
|
49
|
+
case 'bulletList':
|
|
50
|
+
return fieldsWeight({ type, id: identity(node), items: null });
|
|
51
|
+
case 'orderedList':
|
|
52
|
+
return fieldsWeight({
|
|
53
|
+
type,
|
|
54
|
+
id: identity(node),
|
|
55
|
+
items: null,
|
|
56
|
+
start: z.number().parse(attribute(node, 'start')),
|
|
57
|
+
});
|
|
58
|
+
case 'listItem':
|
|
59
|
+
return fieldsWeight({ type, id: identity(node), children: null });
|
|
60
|
+
case 'horizontalRule':
|
|
61
|
+
return fieldsWeight({ type: 'separator', id: identity(node) });
|
|
62
|
+
case 'codeBlock': {
|
|
63
|
+
const language = z.string().nullish().parse(attribute(node, 'language'));
|
|
64
|
+
return fieldsWeight({
|
|
65
|
+
type,
|
|
66
|
+
id: identity(node),
|
|
67
|
+
text: '',
|
|
68
|
+
...(language == null ? {} : { language }),
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
case 'hardBreak':
|
|
72
|
+
return fieldsWeight({ type });
|
|
73
|
+
case 'reacdMention':
|
|
74
|
+
return fieldsWeight({
|
|
75
|
+
type: 'mention',
|
|
76
|
+
id: textAttribute(node, 'id'),
|
|
77
|
+
label: textAttribute(node, 'label'),
|
|
78
|
+
});
|
|
79
|
+
case 'reacdEmoji':
|
|
80
|
+
return fieldsWeight({
|
|
81
|
+
type: 'emoji',
|
|
82
|
+
name: textAttribute(node, 'name'),
|
|
83
|
+
value: textAttribute(node, 'value'),
|
|
84
|
+
});
|
|
85
|
+
case 'text': {
|
|
86
|
+
const text = z.string().min(1).max(EDITOR_POLICY.maxCharacters).parse(node.text);
|
|
87
|
+
const result = fieldsWeight({ type, text: '' });
|
|
88
|
+
let marks = 0;
|
|
89
|
+
for (const mark of node.marks) {
|
|
90
|
+
if (mark.type.name === 'link') {
|
|
91
|
+
const target = mark.attrs['href'];
|
|
92
|
+
if (typeof target !== 'string' ||
|
|
93
|
+
target.length > CONTENT_POLICY.maxLinkLength)
|
|
94
|
+
throw new Error('Invalid editor link.');
|
|
95
|
+
const href = linkSchema.shape.href.parse(target);
|
|
96
|
+
result.values += 1;
|
|
97
|
+
result.characters += 'link'.length + href.length;
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
const name = markSchema.parse(mark.type.name);
|
|
101
|
+
marks += 1;
|
|
102
|
+
result.values += 1;
|
|
103
|
+
result.characters += name.length;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
if (marks > 0) {
|
|
107
|
+
result.values += 1;
|
|
108
|
+
result.characters += 'marks'.length;
|
|
109
|
+
result.extraDepth = 2;
|
|
110
|
+
}
|
|
111
|
+
let chunks = 0;
|
|
112
|
+
let characters = 0;
|
|
113
|
+
for (const chunk of editorTextChunks(text)) {
|
|
114
|
+
chunks += 1;
|
|
115
|
+
characters += chunk.to - chunk.from;
|
|
116
|
+
}
|
|
117
|
+
result.values *= chunks;
|
|
118
|
+
result.characters = result.characters * chunks + characters;
|
|
119
|
+
return result;
|
|
120
|
+
}
|
|
121
|
+
default:
|
|
122
|
+
throw new Error('Unsupported editor node.');
|
|
123
|
+
}
|
|
124
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { EDITOR_POLICY, EDITOR_UNICODE, } from '@fastsprout/reacd/adapter-runtime/core/editor-policy.js';
|
|
2
|
+
export function* editorTextChunks(text) {
|
|
3
|
+
let from = 0;
|
|
4
|
+
while (from < text.length) {
|
|
5
|
+
let to = Math.min(from + EDITOR_POLICY.maxTextLength, text.length);
|
|
6
|
+
if (to < text.length) {
|
|
7
|
+
const previous = text.charCodeAt(to - 1);
|
|
8
|
+
const next = text.charCodeAt(to);
|
|
9
|
+
if (previous >= EDITOR_UNICODE.highSurrogateMin &&
|
|
10
|
+
previous <= EDITOR_UNICODE.highSurrogateMax &&
|
|
11
|
+
next >= EDITOR_UNICODE.lowSurrogateMin &&
|
|
12
|
+
next <= EDITOR_UNICODE.lowSurrogateMax)
|
|
13
|
+
to -= 1;
|
|
14
|
+
}
|
|
15
|
+
yield { from, to };
|
|
16
|
+
from = to;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
function inlineToSdk(inline) {
|
|
2
|
+
if (inline.type === 'hardBreak')
|
|
3
|
+
return { type: 'hardBreak' };
|
|
4
|
+
if (inline.type === 'mention')
|
|
5
|
+
return { type: 'reacdMention', attrs: { id: inline.id, label: inline.label } };
|
|
6
|
+
if (inline.type === 'emoji')
|
|
7
|
+
return { type: 'reacdEmoji', attrs: { name: inline.name, value: inline.value } };
|
|
8
|
+
const marks = (inline.marks ?? []).map((mark) => ({
|
|
9
|
+
type: mark,
|
|
10
|
+
}));
|
|
11
|
+
if (inline.link !== undefined)
|
|
12
|
+
marks.push({ type: 'link', attrs: { href: inline.link } });
|
|
13
|
+
return { type: 'text', text: inline.text, ...(marks.length === 0 ? {} : { marks }) };
|
|
14
|
+
}
|
|
15
|
+
function itemToSdk(item) {
|
|
16
|
+
return {
|
|
17
|
+
type: 'listItem',
|
|
18
|
+
attrs: { reacdId: item.id },
|
|
19
|
+
content: item.children.map(blockToSdk),
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
function blockToSdk(block) {
|
|
23
|
+
const attrs = { reacdId: block.id };
|
|
24
|
+
switch (block.type) {
|
|
25
|
+
case 'paragraph':
|
|
26
|
+
return { type: 'paragraph', attrs, content: block.content.map(inlineToSdk) };
|
|
27
|
+
case 'heading':
|
|
28
|
+
return {
|
|
29
|
+
type: 'heading',
|
|
30
|
+
attrs: { ...attrs, level: block.level },
|
|
31
|
+
content: block.content.map(inlineToSdk),
|
|
32
|
+
};
|
|
33
|
+
case 'quote':
|
|
34
|
+
return { type: 'blockquote', attrs, content: block.children.map(blockToSdk) };
|
|
35
|
+
case 'codeBlock':
|
|
36
|
+
return {
|
|
37
|
+
type: 'codeBlock',
|
|
38
|
+
attrs: {
|
|
39
|
+
...attrs,
|
|
40
|
+
...(block.language === undefined ? {} : { language: block.language }),
|
|
41
|
+
},
|
|
42
|
+
content: block.text.length === 0 ? [] : [{ type: 'text', text: block.text }],
|
|
43
|
+
};
|
|
44
|
+
case 'bulletList':
|
|
45
|
+
return { type: 'bulletList', attrs, content: block.items.map(itemToSdk) };
|
|
46
|
+
case 'orderedList':
|
|
47
|
+
return {
|
|
48
|
+
type: 'orderedList',
|
|
49
|
+
attrs: { ...attrs, start: block.start },
|
|
50
|
+
content: block.items.map(itemToSdk),
|
|
51
|
+
};
|
|
52
|
+
case 'separator':
|
|
53
|
+
return { type: 'horizontalRule', attrs };
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
export function editorDocumentToSdk(document) {
|
|
57
|
+
return { type: 'doc', content: document.blocks.map(blockToSdk) };
|
|
58
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useContext, useId } from 'react';
|
|
3
|
+
import { editorBlockIds } from '@fastsprout/reacd/adapter-runtime/core/editor-blocks.js';
|
|
4
|
+
import { EDITOR_DRAG_POLICY as P } from '@fastsprout/reacd/adapter-runtime/core/editor-drag-handle-policy.js';
|
|
5
|
+
import { EditorScopeContext } from '@fastsprout/reacd/adapter-runtime/renderer/editor/editor-context.js';
|
|
6
|
+
import { Issues } from '@fastsprout/reacd/adapter-runtime/renderer/issues/issues.renderer.js';
|
|
7
|
+
import { Button } from '../vendor/ui/button.js';
|
|
8
|
+
import { useDragSession } from './use-drag-session.js';
|
|
9
|
+
function issue(message) {
|
|
10
|
+
return _jsx(Issues, { issues: [{ path: 'EditorDragHandle', message }] });
|
|
11
|
+
}
|
|
12
|
+
export function ShadcnEditorDragHandle({ label, blockId, disabled, }) {
|
|
13
|
+
const id = useId();
|
|
14
|
+
const port = useContext(EditorScopeContext);
|
|
15
|
+
const target = blockId ?? port?.selectedBlockId;
|
|
16
|
+
const known = port !== null &&
|
|
17
|
+
target !== undefined &&
|
|
18
|
+
editorBlockIds(port.document).includes(target);
|
|
19
|
+
const blocked = disabled === true || port === null || port.disabled || !known;
|
|
20
|
+
const session = useDragSession(target, blocked);
|
|
21
|
+
if (port === null)
|
|
22
|
+
return issue(P.scopeError);
|
|
23
|
+
if (target === undefined)
|
|
24
|
+
return issue(P.selectionError);
|
|
25
|
+
if (!known)
|
|
26
|
+
return issue(P.unknownError);
|
|
27
|
+
const moves = port.blockMoves(target);
|
|
28
|
+
const canDrag = !blocked && (moves.up || moves.down);
|
|
29
|
+
const selectLabel = canDrag ? P.selectAndDrag : P.select;
|
|
30
|
+
return (_jsxs("div", { className: "reacd-node reacd-editor-drag-handle", role: "group", "aria-labelledby": `${id}-label`, "aria-describedby": `${id}-help`, "aria-disabled": blocked || undefined, children: [_jsx("p", { id: `${id}-label`, children: label }), _jsx("p", { id: `${id}-help`, children: blocked
|
|
31
|
+
? P.protectedInstructions
|
|
32
|
+
: canDrag
|
|
33
|
+
? P.instructions
|
|
34
|
+
: P.fixedInstructions }), _jsxs("div", { className: "reacd-editor-drag-controls", children: [_jsx(Button, { type: "button", className: "reacd-button", variant: "outline", disabled: blocked, draggable: canDrag, "aria-label": `${label}: ${selectLabel}`, onClick: () => port.selectBlock(target), onDragStart: (event) => {
|
|
35
|
+
session.finish();
|
|
36
|
+
if (!canDrag || !port.beginBlockDrag(target)) {
|
|
37
|
+
event.preventDefault();
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
session.start({ id: target, cancel: () => port.cancelBlockDrag() });
|
|
41
|
+
try {
|
|
42
|
+
event.dataTransfer.effectAllowed = P.moveEffect;
|
|
43
|
+
event.dataTransfer.setData(P.mimeType, target);
|
|
44
|
+
}
|
|
45
|
+
catch {
|
|
46
|
+
session.finish();
|
|
47
|
+
event.preventDefault();
|
|
48
|
+
}
|
|
49
|
+
}, onDragEnd: () => session.finish(), onKeyDown: (event) => {
|
|
50
|
+
if (event.key === 'Escape' && session.finish()) {
|
|
51
|
+
event.preventDefault();
|
|
52
|
+
}
|
|
53
|
+
}, children: selectLabel }), _jsx(Button, { type: "button", className: "reacd-button", variant: "outline", disabled: blocked || !moves.up, "aria-label": `${label}: ${P.up}`, onClick: () => port.moveBlock(target, 'up'), children: P.up }), _jsx(Button, { type: "button", className: "reacd-button", variant: "outline", disabled: blocked || !moves.down, "aria-label": `${label}: ${P.down}`, onClick: () => port.moveBlock(target, 'down'), children: P.down })] })] }));
|
|
54
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { useCallback, useEffect, useLayoutEffect, useRef } from 'react';
|
|
2
|
+
export function useDragSession(id, blocked) {
|
|
3
|
+
const owner = useRef(null);
|
|
4
|
+
const finish = useCallback(() => {
|
|
5
|
+
const previous = owner.current;
|
|
6
|
+
owner.current = null;
|
|
7
|
+
previous?.cancel();
|
|
8
|
+
return previous !== null;
|
|
9
|
+
}, []);
|
|
10
|
+
useEffect(() => () => {
|
|
11
|
+
finish();
|
|
12
|
+
}, [finish]);
|
|
13
|
+
useLayoutEffect(() => {
|
|
14
|
+
if (owner.current && (owner.current.id !== id || blocked))
|
|
15
|
+
finish();
|
|
16
|
+
}, [id, blocked, finish]);
|
|
17
|
+
function start(session) {
|
|
18
|
+
finish();
|
|
19
|
+
owner.current = session;
|
|
20
|
+
}
|
|
21
|
+
return { start, finish };
|
|
22
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo } from 'react';
|
|
3
|
+
import { useEditorMenu } from '../editor-menu/use-editor-menu.js';
|
|
4
|
+
import { EditorMenuPanel } from '../editor-menu/menu-panel.js';
|
|
5
|
+
export function ShadcnEditorEmojiMenu(properties) {
|
|
6
|
+
const items = useMemo(() => properties.items.map((item) => ({ ...item, kind: 'emoji' })), [properties.items]);
|
|
7
|
+
const menu = useEditorMenu('emoji', items, properties.disabled);
|
|
8
|
+
return _jsx(EditorMenuPanel, { label: properties.label, ...menu });
|
|
9
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo } from 'react';
|
|
3
|
+
import { useEditorMenu } from '../editor-menu/use-editor-menu.js';
|
|
4
|
+
import { EditorMenuPanel } from '../editor-menu/menu-panel.js';
|
|
5
|
+
const EMPTY = Object.freeze([]);
|
|
6
|
+
export function ShadcnEditorMentionMenu(properties) {
|
|
7
|
+
const catalog = properties.items ?? EMPTY;
|
|
8
|
+
const items = useMemo(() => catalog.map((item) => ({ ...item, kind: 'mention' })), [catalog]);
|
|
9
|
+
const lookup = useMemo(() => properties.onQueryChange === undefined
|
|
10
|
+
? undefined
|
|
11
|
+
: {
|
|
12
|
+
results: properties.results,
|
|
13
|
+
onQueryChange: properties.onQueryChange,
|
|
14
|
+
}, [properties.results, properties.onQueryChange]);
|
|
15
|
+
const menu = useEditorMenu('mention', items, properties.disabled, lookup);
|
|
16
|
+
return _jsx(EditorMenuPanel, { label: properties.label, ...menu });
|
|
17
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { EditorMentionLookupRequest, EditorMentionLookupResult } from '@fastsprout/reacd/adapter-runtime/schema/editor-mention-menu/lookup.schema.js';
|
|
2
|
+
import type * as mention from '@fastsprout/reacd/adapter-runtime/schema/editor-mention-menu/item.schema.js';
|
|
3
|
+
export interface EditorMentionLookupView {
|
|
4
|
+
readonly request: EditorMentionLookupRequest | undefined;
|
|
5
|
+
readonly status: 'loading' | 'ready' | 'error';
|
|
6
|
+
readonly items: readonly mention.EditorMentionItem[];
|
|
7
|
+
readonly error: string | undefined;
|
|
8
|
+
}
|
|
9
|
+
export interface EditorMentionLookupState {
|
|
10
|
+
readonly scope: string;
|
|
11
|
+
readonly ordinal: bigint;
|
|
12
|
+
readonly current: EditorMentionLookupRequest | undefined;
|
|
13
|
+
readonly accepted: EditorMentionLookupResult | undefined;
|
|
14
|
+
}
|
|
15
|
+
interface LookupTransition {
|
|
16
|
+
readonly state: EditorMentionLookupState;
|
|
17
|
+
readonly view: EditorMentionLookupView;
|
|
18
|
+
}
|
|
19
|
+
export declare function advanceMentionLookup(state: EditorMentionLookupState, query: string, result: EditorMentionLookupResult | null): LookupTransition;
|
|
20
|
+
export declare function createMentionLookupController(scope: string): {
|
|
21
|
+
close(): void;
|
|
22
|
+
update(query: string, result: EditorMentionLookupResult | null): EditorMentionLookupView;
|
|
23
|
+
};
|
|
24
|
+
export {};
|