@tulip-systems/core 0.5.1 → 0.5.3
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/dist/components/common/icons.d.mts +52 -52
- package/dist/components/common/icons.d.mts.map +1 -1
- package/dist/components/common/status.d.mts +3 -3
- package/dist/components/common/status.d.mts.map +1 -1
- package/dist/components/editor/components/content.client.d.mts +2 -2
- package/dist/components/editor/components/editor.client.d.mts +4 -4
- package/dist/components/editor/components/editor.client.mjs +2 -2
- package/dist/components/editor/components/editor.client.mjs.map +1 -1
- package/dist/components/editor/components/menu.client.d.mts +3 -3
- package/dist/components/editor/components/menu.client.mjs +3 -0
- package/dist/components/editor/components/menu.client.mjs.map +1 -1
- package/dist/components/editor/extensions/file-handler/extension.d.mts +21 -0
- package/dist/components/editor/extensions/file-handler/extension.d.mts.map +1 -0
- package/dist/components/editor/extensions/file-handler/extension.mjs +40 -0
- package/dist/components/editor/extensions/file-handler/extension.mjs.map +1 -0
- package/dist/components/editor/extensions/file-handler/strategy.d.mts +29 -0
- package/dist/components/editor/extensions/file-handler/strategy.d.mts.map +1 -0
- package/dist/components/editor/extensions/file-handler/strategy.mjs +111 -0
- package/dist/components/editor/extensions/file-handler/strategy.mjs.map +1 -0
- package/dist/components/editor/extensions/file-handler/utils.mjs +50 -0
- package/dist/components/editor/extensions/file-handler/utils.mjs.map +1 -0
- package/dist/components/editor/extensions/image/extension.d.mts +8 -0
- package/dist/components/editor/extensions/image/extension.d.mts.map +1 -0
- package/dist/components/editor/extensions/image/extension.mjs +52 -0
- package/dist/components/editor/extensions/image/extension.mjs.map +1 -0
- package/dist/components/editor/extensions/skeleton/extension.mjs +41 -0
- package/dist/components/editor/extensions/skeleton/extension.mjs.map +1 -0
- package/dist/components/editor/extensions/skeleton/renderer.mjs +25 -0
- package/dist/components/editor/extensions/skeleton/renderer.mjs.map +1 -0
- package/dist/components/editor/lib/constants.d.mts +29 -26
- package/dist/components/editor/lib/constants.d.mts.map +1 -1
- package/dist/components/editor/lib/constants.mjs +14 -2
- package/dist/components/editor/lib/constants.mjs.map +1 -1
- package/dist/components/editor/lib/extensions.d.mts +5 -1
- package/dist/components/editor/lib/extensions.d.mts.map +1 -1
- package/dist/components/editor/lib/extensions.mjs.map +1 -1
- package/dist/components/editor/lib/variants.mjs +10 -2
- package/dist/components/editor/lib/variants.mjs.map +1 -1
- package/dist/components/header/back-button.client.d.mts +2 -2
- package/dist/components/header/bottom-bar.client.d.mts +3 -3
- package/dist/components/header/breadcrumbs.client.d.mts +7 -7
- package/dist/components/header/header.client.d.mts +2 -2
- package/dist/components/header/mobile-nav-switcher.client.d.mts +2 -2
- package/dist/components/header/top-bar.client.d.mts +4 -4
- package/dist/components/layouts/admin-content.client.d.mts +2 -2
- package/dist/components/layouts/admin-layout.d.mts +2 -2
- package/dist/components/layouts/admin-loading.d.mts +2 -2
- package/dist/components/layouts/admin-loading.d.mts.map +1 -1
- package/dist/components/layouts/empty-page.d.mts +4 -4
- package/dist/components/layouts/empty-page.d.mts.map +1 -1
- package/dist/components/layouts/list-layout.d.mts +2 -2
- package/dist/components/layouts/list-layout.d.mts.map +1 -1
- package/dist/components/layouts/not-found-page.d.mts +3 -3
- package/dist/components/layouts/not-found-page.d.mts.map +1 -1
- package/dist/components/layouts/providers.client.d.mts +2 -2
- package/dist/components/layouts/root-layout.server.d.mts +2 -2
- package/dist/components/layouts/root-layout.server.d.mts.map +1 -1
- package/dist/components/layouts/root-loading.d.mts +2 -2
- package/dist/components/layouts/root-loading.d.mts.map +1 -1
- package/dist/components/layouts/tab-layout.d.mts +2 -2
- package/dist/components/layouts/tab-layout.d.mts.map +1 -1
- package/dist/components/lists/data-list.d.mts +5 -5
- package/dist/components/lists/data-list.d.mts.map +1 -1
- package/dist/components/lists/data-stack.d.mts +8 -8
- package/dist/components/navigation/admin-sidebar-paths.client.d.mts +10 -10
- package/dist/components/ui/accordion.d.mts +5 -5
- package/dist/components/ui/alert-dialog.d.mts +12 -12
- package/dist/components/ui/alert.d.mts +6 -6
- package/dist/components/ui/aspect-ratio.d.mts +2 -2
- package/dist/components/ui/avatar.client.d.mts +4 -4
- package/dist/components/ui/badge.d.mts +4 -4
- package/dist/components/ui/breadcrumb.d.mts +8 -8
- package/dist/components/ui/breadcrumb.d.mts.map +1 -1
- package/dist/components/ui/button.d.mts +5 -5
- package/dist/components/ui/button.d.mts.map +1 -1
- package/dist/components/ui/calendar.d.mts +3 -3
- package/dist/components/ui/calendar.d.mts.map +1 -1
- package/dist/components/ui/card.d.mts +7 -7
- package/dist/components/ui/card.d.mts.map +1 -1
- package/dist/components/ui/carousel.d.mts +6 -6
- package/dist/components/ui/carousel.d.mts.map +1 -1
- package/dist/components/ui/chart.client.d.mts +5 -5
- package/dist/components/ui/checkbox.d.mts +2 -2
- package/dist/components/ui/checkbox.d.mts.map +1 -1
- package/dist/components/ui/collapsible.client.d.mts +4 -4
- package/dist/components/ui/color-picker.client.d.mts +2 -2
- package/dist/components/ui/combobox-dropdown.client.d.mts +2 -2
- package/dist/components/ui/combobox.client.d.mts +2 -2
- package/dist/components/ui/command.d.mts +10 -10
- package/dist/components/ui/command.d.mts.map +1 -1
- package/dist/components/ui/context-menu.d.mts +16 -16
- package/dist/components/ui/date-picker.client.d.mts +2 -2
- package/dist/components/ui/dialog.client.d.mts +11 -11
- package/dist/components/ui/drawer.client.d.mts +11 -11
- package/dist/components/ui/dropdown-menu.d.mts +16 -16
- package/dist/components/ui/form.client.d.mts +7 -7
- package/dist/components/ui/hover-card.client.d.mts +4 -4
- package/dist/components/ui/input-recipient.d.mts +2 -2
- package/dist/components/ui/input.d.mts +2 -2
- package/dist/components/ui/label.d.mts +2 -2
- package/dist/components/ui/navigation-menu.d.mts +11 -11
- package/dist/components/ui/pagination.d.mts +8 -8
- package/dist/components/ui/popover.d.mts +5 -5
- package/dist/components/ui/popover.d.mts.map +1 -1
- package/dist/components/ui/progress.client.d.mts +2 -2
- package/dist/components/ui/radio-group.d.mts +3 -3
- package/dist/components/ui/resizable.client.d.mts +4 -4
- package/dist/components/ui/scroll-area.d.mts +3 -3
- package/dist/components/ui/select.client.d.mts +11 -11
- package/dist/components/ui/separator.d.mts +2 -2
- package/dist/components/ui/sheet.client.d.mts +9 -9
- package/dist/components/ui/sidebar.client.d.mts +24 -24
- package/dist/components/ui/skeleton.d.mts +2 -2
- package/dist/components/ui/slider.d.mts +2 -2
- package/dist/components/ui/sonner.client.d.mts +2 -2
- package/dist/components/ui/switch.d.mts +2 -2
- package/dist/components/ui/tabs.d.mts +5 -5
- package/dist/components/ui/textarea.d.mts +2 -2
- package/dist/components/ui/time-input.client.d.mts +2 -2
- package/dist/components/ui/toggle-group.client.d.mts +3 -3
- package/dist/components/ui/toggle.d.mts +2 -2
- package/dist/components/ui/tooltip.client.d.mts +5 -5
- package/dist/components.d.mts +2 -1
- package/dist/components.mjs +3 -2
- package/dist/data-tables.d.mts +2 -2
- package/dist/data-tables.mjs +2 -2
- package/dist/inline-edit/client.d.mts +2 -3
- package/dist/inline-edit/client.mjs +1 -2
- package/dist/lib/client.d.mts +2 -2
- package/dist/lib/client.mjs +2 -2
- package/dist/lib/hooks/use-action.d.mts +2 -2
- package/dist/lib/hooks/use-indicator.d.mts +11 -3
- package/dist/lib/hooks/use-indicator.d.mts.map +1 -1
- package/dist/lib/hooks/use-indicator.mjs +19 -8
- package/dist/lib/hooks/use-indicator.mjs.map +1 -1
- package/dist/modules/auth/components/allowed.client.d.mts +2 -2
- package/dist/modules/auth/components/allowed.client.d.mts.map +1 -1
- package/dist/modules/auth/components/auth-layout.server.d.mts +2 -2
- package/dist/modules/auth/components/auth-layout.server.d.mts.map +1 -1
- package/dist/modules/auth/components/auth-loading.d.mts +2 -2
- package/dist/modules/auth/components/create-first-user-page.client.d.mts +2 -2
- package/dist/modules/auth/components/create-first-user-page.client.d.mts.map +1 -1
- package/dist/modules/auth/components/forget-password-page.client.d.mts +2 -2
- package/dist/modules/auth/components/forget-password-page.client.d.mts.map +1 -1
- package/dist/modules/auth/components/guard-first-user.server.d.mts +2 -2
- package/dist/modules/auth/components/guard-first-user.server.d.mts.map +1 -1
- package/dist/modules/auth/components/guard.server.d.mts +2 -2
- package/dist/modules/auth/components/guard.server.d.mts.map +1 -1
- package/dist/modules/auth/components/login-page.client.d.mts +2 -2
- package/dist/modules/auth/components/login-page.client.d.mts.map +1 -1
- package/dist/modules/auth/components/reset-password-page.client.d.mts +2 -2
- package/dist/modules/auth/components/reset-password-page.client.d.mts.map +1 -1
- package/dist/modules/auth/components/update-password-command.d.mts +2 -2
- package/dist/modules/auth/components/update-password-command.d.mts.map +1 -1
- package/dist/modules/auth/db/schema.d.mts +73 -73
- package/dist/modules/auth/db/schema.d.mts.map +1 -1
- package/dist/modules/auth/handler/client.client.d.mts +8 -8
- package/dist/modules/auth/hooks/use-permission.d.mts +2 -2
- package/dist/modules/auth/hooks/use-session.d.mts +4 -4
- package/dist/modules/auth/lib/validators.d.mts +2 -2
- package/dist/modules/auth/lib/validators.d.mts.map +1 -1
- package/dist/modules/commands/components/alert-dialog-command.client.d.mts +10 -10
- package/dist/modules/commands/components/alert-dialog-command.client.d.mts.map +1 -1
- package/dist/modules/commands/components/click-command.client.d.mts +2 -2
- package/dist/modules/commands/components/click-command.client.d.mts.map +1 -1
- package/dist/modules/commands/components/command-trigger.client.d.mts +6 -6
- package/dist/modules/commands/components/command-trigger.client.d.mts.map +1 -1
- package/dist/modules/commands/components/dialog-command.client.d.mts +8 -8
- package/dist/modules/commands/components/dialog-command.client.d.mts.map +1 -1
- package/dist/modules/commands/components/dropdown-command.client.d.mts +5 -5
- package/dist/modules/commands/components/dropdown-command.client.d.mts.map +1 -1
- package/dist/modules/commands/components/empty-command.client.d.mts +2 -2
- package/dist/modules/commands/components/empty-command.client.d.mts.map +1 -1
- package/dist/modules/commands/components/form-dialog-command.client.d.mts +11 -11
- package/dist/modules/commands/components/form-dialog-command.client.d.mts.map +1 -1
- package/dist/modules/commands/hooks/use-command-mutation.client.d.mts +2 -2
- package/dist/modules/commands/menus/context-menu.client.d.mts +2 -2
- package/dist/modules/commands/menus/context-menu.client.d.mts.map +1 -1
- package/dist/modules/commands/menus/dropdown-menu.client.d.mts +3 -3
- package/dist/modules/commands/menus/dropdown-menu.client.d.mts.map +1 -1
- package/dist/modules/commands/menus/inline-menu.client.d.mts +3 -3
- package/dist/modules/commands/menus/inline-menu.client.d.mts.map +1 -1
- package/dist/modules/commands/menus/responsive-menu.client.d.mts +3 -3
- package/dist/modules/commands/menus/responsive-menu.client.d.mts.map +1 -1
- package/dist/modules/commands/utils/archive-command.client.d.mts +3 -3
- package/dist/modules/commands/utils/archive-command.client.d.mts.map +1 -1
- package/dist/modules/commands/utils/delete-command.client.d.mts +3 -3
- package/dist/modules/commands/utils/delete-command.client.d.mts.map +1 -1
- package/dist/modules/config/db/helpers.d.mts +5 -5
- package/dist/modules/config/db/helpers.d.mts.map +1 -1
- package/dist/modules/data-tables/components/cell/common.client.d.mts +5 -5
- package/dist/modules/data-tables/components/cell/common.client.d.mts.map +1 -1
- package/dist/modules/data-tables/components/column-header.d.mts +2 -2
- package/dist/modules/data-tables/components/filters/combobox.client.d.mts +2 -2
- package/dist/modules/data-tables/components/filters/combobox.client.d.mts.map +1 -1
- package/dist/modules/data-tables/components/filters/slider.client.d.mts +2 -2
- package/dist/modules/data-tables/components/filters/slider.client.d.mts.map +1 -1
- package/dist/modules/data-tables/components/header.d.mts +4 -4
- package/dist/modules/data-tables/components/layout.d.mts +2 -2
- package/dist/modules/data-tables/components/search-input.client.d.mts +2 -2
- package/dist/modules/data-tables/components/search-input.client.d.mts.map +1 -1
- package/dist/modules/data-tables/components/skeleton.d.mts +2 -2
- package/dist/modules/data-tables/components/table.d.mts +7 -7
- package/dist/modules/data-tables/components/toolbar.d.mts +3 -3
- package/dist/modules/data-tables/hooks/use-context.client.d.mts +2 -2
- package/dist/modules/data-tables/hooks/use-context.client.d.mts.map +1 -1
- package/dist/modules/data-tables/lib/filters/parsers.d.mts +6 -1
- package/dist/modules/data-tables/lib/filters/parsers.d.mts.map +1 -1
- package/dist/modules/data-tables/lib/filters/parsers.mjs +6 -1
- package/dist/modules/data-tables/lib/filters/parsers.mjs.map +1 -1
- package/dist/modules/data-tables/tables/data-table/components/table.d.mts +2 -2
- package/dist/modules/data-tables/tables/data-table/components/table.d.mts.map +1 -1
- package/dist/modules/data-tables/tables/inline-table/components/cells/common.d.mts +2 -2
- package/dist/modules/data-tables/tables/inline-table/components/cells/common.d.mts.map +1 -1
- package/dist/modules/data-tables/tables/inline-table/components/cells/drag-handle.client.d.mts +2 -2
- package/dist/modules/data-tables/tables/inline-table/components/cells/drag-handle.client.d.mts.map +1 -1
- package/dist/modules/data-tables/tables/inline-table/components/inputs/advanced-select.client.d.mts +2 -2
- package/dist/modules/data-tables/tables/inline-table/components/inputs/advanced-select.client.d.mts.map +1 -1
- package/dist/modules/data-tables/tables/inline-table/components/inputs/combobox.client.d.mts +2 -2
- package/dist/modules/data-tables/tables/inline-table/components/inputs/combobox.client.d.mts.map +1 -1
- package/dist/modules/data-tables/tables/inline-table/components/inputs/input.client.d.mts +3 -3
- package/dist/modules/data-tables/tables/inline-table/components/inputs/input.client.d.mts.map +1 -1
- package/dist/modules/data-tables/tables/inline-table/components/inputs/read-only.d.mts +2 -2
- package/dist/modules/data-tables/tables/inline-table/components/inputs/read-only.d.mts.map +1 -1
- package/dist/modules/data-tables/tables/inline-table/components/inputs/select.client.d.mts +2 -2
- package/dist/modules/data-tables/tables/inline-table/components/inputs/select.client.d.mts.map +1 -1
- package/dist/modules/data-tables/tables/inline-table/components/table.d.mts +2 -2
- package/dist/modules/data-tables/tables/inline-table/components/table.d.mts.map +1 -1
- package/dist/modules/data-tables/tables/inline-table/hooks/context.client.d.mts +2 -2
- package/dist/modules/data-tables/tables/inline-table/hooks/context.client.d.mts.map +1 -1
- package/dist/modules/inline-edit/components/combobox-dropdown.client.d.mts +6 -4
- package/dist/modules/inline-edit/components/combobox-dropdown.client.d.mts.map +1 -1
- package/dist/modules/inline-edit/components/combobox-dropdown.client.mjs +11 -6
- package/dist/modules/inline-edit/components/combobox-dropdown.client.mjs.map +1 -1
- package/dist/modules/inline-edit/components/combobox.client.d.mts +6 -4
- package/dist/modules/inline-edit/components/combobox.client.d.mts.map +1 -1
- package/dist/modules/inline-edit/components/combobox.client.mjs +7 -5
- package/dist/modules/inline-edit/components/combobox.client.mjs.map +1 -1
- package/dist/modules/inline-edit/components/date-input.client.d.mts +5 -3
- package/dist/modules/inline-edit/components/date-input.client.d.mts.map +1 -1
- package/dist/modules/inline-edit/components/date-input.client.mjs +26 -13
- package/dist/modules/inline-edit/components/date-input.client.mjs.map +1 -1
- package/dist/modules/inline-edit/components/date-picker.client.d.mts +6 -4
- package/dist/modules/inline-edit/components/date-picker.client.d.mts.map +1 -1
- package/dist/modules/inline-edit/components/date-picker.client.mjs +12 -7
- package/dist/modules/inline-edit/components/date-picker.client.mjs.map +1 -1
- package/dist/modules/inline-edit/components/editor.client.d.mts +6 -4
- package/dist/modules/inline-edit/components/editor.client.d.mts.map +1 -1
- package/dist/modules/inline-edit/components/editor.client.mjs +11 -6
- package/dist/modules/inline-edit/components/editor.client.mjs.map +1 -1
- package/dist/modules/inline-edit/components/input-recipient.client.d.mts +6 -4
- package/dist/modules/inline-edit/components/input-recipient.client.d.mts.map +1 -1
- package/dist/modules/inline-edit/components/input-recipient.client.mjs +11 -6
- package/dist/modules/inline-edit/components/input-recipient.client.mjs.map +1 -1
- package/dist/modules/inline-edit/components/input-toggle.client.d.mts +6 -4
- package/dist/modules/inline-edit/components/input-toggle.client.d.mts.map +1 -1
- package/dist/modules/inline-edit/components/input-toggle.client.mjs +9 -7
- package/dist/modules/inline-edit/components/input-toggle.client.mjs.map +1 -1
- package/dist/modules/inline-edit/components/input.client.d.mts +13 -10
- package/dist/modules/inline-edit/components/input.client.d.mts.map +1 -1
- package/dist/modules/inline-edit/components/input.client.mjs +35 -19
- package/dist/modules/inline-edit/components/input.client.mjs.map +1 -1
- package/dist/modules/inline-edit/components/select.client.d.mts +10 -9
- package/dist/modules/inline-edit/components/select.client.d.mts.map +1 -1
- package/dist/modules/inline-edit/components/select.client.mjs +14 -7
- package/dist/modules/inline-edit/components/select.client.mjs.map +1 -1
- package/dist/modules/inline-edit/components/switch.client.d.mts +5 -3
- package/dist/modules/inline-edit/components/switch.client.d.mts.map +1 -1
- package/dist/modules/inline-edit/components/switch.client.mjs +8 -6
- package/dist/modules/inline-edit/components/switch.client.mjs.map +1 -1
- package/dist/modules/inline-edit/components/toggle.client.d.mts +6 -4
- package/dist/modules/inline-edit/components/toggle.client.d.mts.map +1 -1
- package/dist/modules/inline-edit/components/toggle.client.mjs +9 -7
- package/dist/modules/inline-edit/components/toggle.client.mjs.map +1 -1
- package/dist/modules/inline-edit/hooks/use-inline.client.d.mts +35 -3
- package/dist/modules/inline-edit/hooks/use-inline.client.d.mts.map +1 -1
- package/dist/modules/inline-edit/hooks/use-inline.client.mjs +71 -9
- package/dist/modules/inline-edit/hooks/use-inline.client.mjs.map +1 -1
- package/dist/modules/inline-edit/lib/variants.d.mts +1 -0
- package/dist/modules/inline-edit/lib/variants.d.mts.map +1 -1
- package/dist/modules/inline-edit/lib/variants.mjs +12 -4
- package/dist/modules/inline-edit/lib/variants.mjs.map +1 -1
- package/dist/modules/router/handler/init.server.d.mts +6 -6
- package/dist/modules/router/handler/init.server.d.mts.map +1 -1
- package/dist/modules/router/lib/query-client.server.d.mts +2 -2
- package/dist/modules/storage/components/dropzone-context.client.d.mts +2 -2
- package/dist/modules/storage/components/dropzone-context.client.d.mts.map +1 -1
- package/dist/modules/storage/components/dropzone.client.d.mts +5 -5
- package/dist/modules/storage/components/dropzone.client.d.mts.map +1 -1
- package/dist/modules/storage/components/dropzone.client.mjs +1 -1
- package/dist/modules/storage/components/image-grid.client.d.mts +3 -3
- package/dist/modules/storage/components/image-grid.client.d.mts.map +1 -1
- package/dist/modules/storage/components/image-grid.client.mjs +3 -3
- package/dist/modules/storage/components/image-grid.client.mjs.map +1 -1
- package/dist/modules/storage/components/upload-zone-context.client.d.mts +3 -11
- package/dist/modules/storage/components/upload-zone-context.client.d.mts.map +1 -1
- package/dist/modules/storage/components/upload-zone-context.client.mjs.map +1 -1
- package/dist/modules/storage/components/upload-zone.client.d.mts +10 -31
- package/dist/modules/storage/components/upload-zone.client.d.mts.map +1 -1
- package/dist/modules/storage/components/upload-zone.client.mjs +19 -91
- package/dist/modules/storage/components/upload-zone.client.mjs.map +1 -1
- package/dist/modules/storage/config/filters.d.mts +2 -0
- package/dist/modules/storage/config/filters.d.mts.map +1 -1
- package/dist/modules/storage/config/filters.mjs +3 -1
- package/dist/modules/storage/config/filters.mjs.map +1 -1
- package/dist/modules/storage/lib/create-upload.client.d.mts +56 -0
- package/dist/modules/storage/lib/create-upload.client.d.mts.map +1 -0
- package/dist/modules/storage/lib/create-upload.client.mjs +98 -0
- package/dist/modules/storage/lib/create-upload.client.mjs.map +1 -0
- package/dist/modules/storage/lib/helpers.d.mts +2 -2
- package/dist/modules/storage/lib/helpers.d.mts.map +1 -1
- package/dist/modules/storage/lib/helpers.mjs +1 -0
- package/dist/modules/storage/lib/helpers.mjs.map +1 -1
- package/dist/modules/storage/lib/router.server.d.mts +4181 -2283
- package/dist/modules/storage/lib/router.server.d.mts.map +1 -1
- package/dist/modules/storage/lib/router.server.mjs +5 -2
- package/dist/modules/storage/lib/router.server.mjs.map +1 -1
- package/dist/modules/storage/lib/schema.d.mts +156 -88
- package/dist/modules/storage/lib/schema.d.mts.map +1 -1
- package/dist/modules/storage/lib/schema.mjs +3 -1
- package/dist/modules/storage/lib/schema.mjs.map +1 -1
- package/dist/modules/storage/lib/service.server.d.mts +54 -38
- package/dist/modules/storage/lib/service.server.d.mts.map +1 -1
- package/dist/modules/storage/lib/service.server.mjs +11 -5
- package/dist/modules/storage/lib/service.server.mjs.map +1 -1
- package/dist/modules/storage/lib/validators.d.mts +232 -71
- package/dist/modules/storage/lib/validators.d.mts.map +1 -1
- package/dist/modules/storage/lib/validators.mjs +16 -25
- package/dist/modules/storage/lib/validators.mjs.map +1 -1
- package/dist/storage/client.d.mts +2 -1
- package/dist/storage/client.mjs +2 -8
- package/dist/storage.d.mts +3 -3
- package/dist/storage.mjs +3 -3
- package/package.json +2 -1
- package/src/components/editor/components/editor.client.tsx +7 -2
- package/src/components/editor/components/menu.client.tsx +26 -0
- package/src/components/editor/extensions/file-handler/extension.ts +69 -0
- package/src/components/editor/extensions/file-handler/strategy.ts +167 -0
- package/src/components/editor/extensions/file-handler/utils.ts +51 -0
- package/src/components/editor/extensions/image/extension.ts +57 -0
- package/src/components/editor/extensions/skeleton/extension.ts +35 -0
- package/src/components/editor/extensions/skeleton/renderer.tsx +14 -0
- package/src/components/editor/lib/constants.ts +16 -2
- package/src/components/editor/lib/extensions.ts +4 -1
- package/src/components/editor/lib/utils.ts +32 -0
- package/src/components/editor/lib/variants.ts +72 -1
- package/src/components/entry.ts +2 -1
- package/src/lib/hooks/use-indicator.tsx +27 -18
- package/src/modules/data-tables/lib/filters/parsers.ts +14 -0
- package/src/modules/inline-edit/components/combobox-dropdown.client.tsx +21 -12
- package/src/modules/inline-edit/components/combobox.client.tsx +13 -6
- package/src/modules/inline-edit/components/date-input.client.tsx +29 -13
- package/src/modules/inline-edit/components/date-picker.client.tsx +13 -9
- package/src/modules/inline-edit/components/editor.client.tsx +14 -14
- package/src/modules/inline-edit/components/input-recipient.client.tsx +15 -8
- package/src/modules/inline-edit/components/input-toggle.client.tsx +16 -9
- package/src/modules/inline-edit/components/input.client.tsx +38 -24
- package/src/modules/inline-edit/components/select.client.tsx +16 -9
- package/src/modules/inline-edit/components/switch.client.tsx +10 -6
- package/src/modules/inline-edit/components/toggle.client.tsx +13 -9
- package/src/modules/inline-edit/entry.client.ts +0 -1
- package/src/modules/inline-edit/hooks/use-inline.client copy.tsx +97 -0
- package/src/modules/inline-edit/hooks/use-inline.client.tsx +139 -20
- package/src/modules/inline-edit/lib/variants.ts +7 -0
- package/src/modules/storage/components/image-grid.client.tsx +2 -2
- package/src/modules/storage/components/upload-zone-context.client.tsx +3 -4
- package/src/modules/storage/components/upload-zone.client.tsx +17 -113
- package/src/modules/storage/config/filters.ts +2 -0
- package/src/modules/storage/entry.client.ts +2 -1
- package/src/modules/storage/lib/create-upload.client.ts +134 -0
- package/src/modules/storage/lib/helpers.ts +3 -2
- package/src/modules/storage/lib/router.server.ts +1 -0
- package/src/modules/storage/lib/schema.ts +2 -0
- package/src/modules/storage/lib/service.server.ts +18 -4
- package/src/modules/storage/lib/validators.ts +21 -31
- package/dist/modules/inline-edit/components/deprecated-editor.client.d.mts +0 -21
- package/dist/modules/inline-edit/components/deprecated-editor.client.d.mts.map +0 -1
- package/dist/modules/inline-edit/components/deprecated-editor.client.mjs +0 -37
- package/dist/modules/inline-edit/components/deprecated-editor.client.mjs.map +0 -1
- package/dist/storage/client.mjs.map +0 -1
- package/src/modules/inline-edit/components/deprecated-editor.client.tsx +0 -48
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
flattenEditorExtensionsConfig,
|
|
12
12
|
} from "../lib/extensions";
|
|
13
13
|
import { EditorJSONContent } from "../lib/types";
|
|
14
|
-
import { editorProseVariants } from "../lib/variants";
|
|
14
|
+
import { editorImageVariants, editorProseVariants } from "../lib/variants";
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
* Editor context
|
|
@@ -75,7 +75,12 @@ export function Editor({
|
|
|
75
75
|
editorProps: {
|
|
76
76
|
transformPastedHTML: (html) => html.replace(/<img.*?>/g, ""),
|
|
77
77
|
attributes: {
|
|
78
|
-
class: cn(
|
|
78
|
+
class: cn(
|
|
79
|
+
"editor-content text-sm max-w-full focus:outline-none",
|
|
80
|
+
editorProseVariants(),
|
|
81
|
+
editorImageVariants(),
|
|
82
|
+
className,
|
|
83
|
+
),
|
|
79
84
|
},
|
|
80
85
|
},
|
|
81
86
|
});
|
|
@@ -212,3 +212,29 @@ function EditorMenuColor() {
|
|
|
212
212
|
</div>
|
|
213
213
|
);
|
|
214
214
|
}
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* Editor menu image
|
|
218
|
+
*/
|
|
219
|
+
// function EditorMenuImage() {
|
|
220
|
+
// const { editor, extensions } = useContext(EditorContext);
|
|
221
|
+
|
|
222
|
+
// if (!extensions.image) return null;
|
|
223
|
+
|
|
224
|
+
// return (
|
|
225
|
+
// <div className="flex items-center gap-1">
|
|
226
|
+
// {extensions.image && (
|
|
227
|
+
// <Button
|
|
228
|
+
// type="button"
|
|
229
|
+
// size="icon"
|
|
230
|
+
// variant="outline"
|
|
231
|
+
// onClick={() => editor.chain().focus().downloadImage().run()}
|
|
232
|
+
// disabled={!editor?.can().downloadImage()}
|
|
233
|
+
// className="border"
|
|
234
|
+
// >
|
|
235
|
+
// <DownloadIcon className="size-3.5" />
|
|
236
|
+
// </Button>
|
|
237
|
+
// )}
|
|
238
|
+
// </div>
|
|
239
|
+
// );
|
|
240
|
+
// }
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
FileHandler as TiptapFileHandler,
|
|
5
|
+
FileHandlerOptions as TiptapFileHandlerOptions,
|
|
6
|
+
} from "@tiptap/extension-file-handler";
|
|
7
|
+
import { Plugin, PluginKey } from "@tiptap/pm/state";
|
|
8
|
+
import { collectImageIds, diffIds } from "./utils";
|
|
9
|
+
|
|
10
|
+
export interface FileHandlerOptions extends TiptapFileHandlerOptions {
|
|
11
|
+
/**
|
|
12
|
+
* Callback function invoked when a image reference is removed from the editor. Receives the node ID of the removed node.
|
|
13
|
+
* @type {(nodeId: string) => void}
|
|
14
|
+
* @default undefined
|
|
15
|
+
**/
|
|
16
|
+
onReferenceRemoved?: (nodeId: string) => void;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Callback function invoked when a image reference is added to the editor. Receives the node ID of the added node.
|
|
20
|
+
* @type {(nodeId: string) => void}
|
|
21
|
+
* @default undefined
|
|
22
|
+
**/
|
|
23
|
+
onReferenceAdded?: (nodeId: string) => void;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* File Handler extension for Tiptap Editor
|
|
28
|
+
*/
|
|
29
|
+
export const FileHandler = TiptapFileHandler.extend<FileHandlerOptions>({
|
|
30
|
+
addOptions() {
|
|
31
|
+
return {
|
|
32
|
+
...this.parent?.(),
|
|
33
|
+
onReferenceRemoved: undefined,
|
|
34
|
+
onReferenceAdded: undefined,
|
|
35
|
+
};
|
|
36
|
+
},
|
|
37
|
+
addProseMirrorPlugins() {
|
|
38
|
+
const parent = this.parent?.() ?? [];
|
|
39
|
+
const key = new PluginKey("fileHandlerItemTracker");
|
|
40
|
+
|
|
41
|
+
return [
|
|
42
|
+
...parent,
|
|
43
|
+
new Plugin({
|
|
44
|
+
key,
|
|
45
|
+
appendTransaction: (trs, oldState, newState) => {
|
|
46
|
+
if (!trs.some((tr) => tr.docChanged)) return null;
|
|
47
|
+
|
|
48
|
+
const onReferenceRemoved = this.options.onReferenceRemoved;
|
|
49
|
+
const onReferenceAdded = this.options.onReferenceAdded;
|
|
50
|
+
if (!onReferenceRemoved && !onReferenceAdded) return null;
|
|
51
|
+
|
|
52
|
+
const before = collectImageIds(oldState.doc);
|
|
53
|
+
const after = collectImageIds(newState.doc);
|
|
54
|
+
const { removed, added } = diffIds(before, after);
|
|
55
|
+
|
|
56
|
+
for (const id of removed) {
|
|
57
|
+
onReferenceRemoved?.(id);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
for (const id of added) {
|
|
61
|
+
onReferenceAdded?.(id);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return null;
|
|
65
|
+
},
|
|
66
|
+
}),
|
|
67
|
+
];
|
|
68
|
+
},
|
|
69
|
+
});
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import { SelectNodeSchema, UploadFileSchema } from "@/modules/storage/entry";
|
|
2
|
+
import { UploadClient, UploadHooks } from "@/modules/storage/entry.client";
|
|
3
|
+
import { Editor } from "@tiptap/core";
|
|
4
|
+
import { TextSelection } from "@tiptap/pm/state";
|
|
5
|
+
import { FileHandlerOptions } from "./extension";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Handle File Handler props
|
|
9
|
+
*/
|
|
10
|
+
type CreateFileHandlerUploadStrategyProps = {
|
|
11
|
+
variables: Pick<UploadFileSchema, "namespace" | "parentId" | "mode" | "hidden" | "readonly">;
|
|
12
|
+
uploadClient: UploadClient;
|
|
13
|
+
uploadHooks?: UploadHooks;
|
|
14
|
+
allowedMimeTypes?: string[];
|
|
15
|
+
onUploadCompleted?: (node: SelectNodeSchema) => Promise<void> | void;
|
|
16
|
+
onUploadFailed?: (error: unknown) => Promise<void> | void;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export function createFileHandlerUploadStrategy({
|
|
20
|
+
variables,
|
|
21
|
+
uploadClient,
|
|
22
|
+
uploadHooks,
|
|
23
|
+
onUploadCompleted,
|
|
24
|
+
onUploadFailed,
|
|
25
|
+
allowedMimeTypes,
|
|
26
|
+
}: CreateFileHandlerUploadStrategyProps): FileHandlerOptions {
|
|
27
|
+
const handleUpload = async (editor: Editor, files: File[], startPos: number) => {
|
|
28
|
+
const insertPos = startPos;
|
|
29
|
+
|
|
30
|
+
for (const file of files) {
|
|
31
|
+
/**
|
|
32
|
+
* Prepare upload
|
|
33
|
+
*/
|
|
34
|
+
const input = uploadClient.prepareUpload({ file, ...variables });
|
|
35
|
+
|
|
36
|
+
const imageType = editor.schema.nodes.image;
|
|
37
|
+
if (!imageType) {
|
|
38
|
+
console.error("Image type not found");
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
try {
|
|
43
|
+
/**
|
|
44
|
+
* Create skeleton node
|
|
45
|
+
*/
|
|
46
|
+
const skeletonNode = editor.schema.nodes.skeleton?.create({
|
|
47
|
+
imageNodeId: input.id,
|
|
48
|
+
width: 500,
|
|
49
|
+
height: 500,
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Insert skeleton node into the document
|
|
54
|
+
*/
|
|
55
|
+
if (skeletonNode) {
|
|
56
|
+
// editor.chain().insertContentAt(insertPos, skeletonNode).focus().run();
|
|
57
|
+
const tr = editor.state.tr.insert(insertPos, skeletonNode);
|
|
58
|
+
tr.setSelection(TextSelection.create(tr.doc, insertPos + skeletonNode.nodeSize));
|
|
59
|
+
tr.setMeta("addToHistory", false);
|
|
60
|
+
editor.view.dispatch(tr);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Upload the file
|
|
65
|
+
*/
|
|
66
|
+
const fileNode = await uploadClient.upload(input, uploadHooks);
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Replace skeleton with image node
|
|
70
|
+
*/
|
|
71
|
+
const replacedTr = editor.state.tr;
|
|
72
|
+
let replaced = false;
|
|
73
|
+
|
|
74
|
+
replacedTr.doc.descendants((node, pos) => {
|
|
75
|
+
if (node.type.name === "skeleton" && node.attrs?.imageNodeId === input.id) {
|
|
76
|
+
const imageNode = imageType.create({
|
|
77
|
+
nodeId: fileNode.id,
|
|
78
|
+
alt: file.name,
|
|
79
|
+
fileName: file.name,
|
|
80
|
+
width: node.attrs.width ?? 500,
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
replacedTr.replaceWith(pos, pos + node.nodeSize, imageNode);
|
|
84
|
+
replaced = true;
|
|
85
|
+
return false;
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
if (replaced) {
|
|
90
|
+
editor.view.dispatch(replacedTr);
|
|
91
|
+
} else {
|
|
92
|
+
// In case skeleton is not found, insert the image node at the original position
|
|
93
|
+
const tr = editor.state.tr;
|
|
94
|
+
const imageNode = imageType.create({
|
|
95
|
+
nodeId: fileNode.id,
|
|
96
|
+
alt: file.name,
|
|
97
|
+
fileName: file.name,
|
|
98
|
+
width: 500,
|
|
99
|
+
});
|
|
100
|
+
tr.insert(insertPos, imageNode);
|
|
101
|
+
editor.view.dispatch(tr);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// /**
|
|
105
|
+
// * Remove skeleton node from the document
|
|
106
|
+
// */
|
|
107
|
+
// const tr = editor.state.tr;
|
|
108
|
+
// tr.doc.descendants((node, pos) => {
|
|
109
|
+
// if (node.type.name === "skeleton" && node.attrs?.imageNodeId === input.id) {
|
|
110
|
+
// tr.delete(pos, pos + node.nodeSize);
|
|
111
|
+
// return false;
|
|
112
|
+
// }
|
|
113
|
+
// });
|
|
114
|
+
// editor.view.dispatch(tr);
|
|
115
|
+
|
|
116
|
+
// /**
|
|
117
|
+
// * Add image node to the document
|
|
118
|
+
// */
|
|
119
|
+
// const imageNode = imageType.create({
|
|
120
|
+
// nodeId: fileNode.id,
|
|
121
|
+
// alt: file.name,
|
|
122
|
+
// fileName: file.name,
|
|
123
|
+
// width: 500,
|
|
124
|
+
// });
|
|
125
|
+
// editor.commands.insertContentAt(insertPos, imageNode);
|
|
126
|
+
// // insertPos += imageNode.nodeSize - skeletonNode.nodeSize;
|
|
127
|
+
|
|
128
|
+
await onUploadCompleted?.(fileNode);
|
|
129
|
+
} catch (err) {
|
|
130
|
+
console.error("Upload error:", err);
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Remove the pending image node from the document
|
|
134
|
+
*/
|
|
135
|
+
const tr = editor.state.tr;
|
|
136
|
+
tr.doc.descendants((node, pos) => {
|
|
137
|
+
if (node.type.name === "image" && node.attrs?.nodeId === input.id) {
|
|
138
|
+
tr.delete(pos, pos + node.nodeSize);
|
|
139
|
+
return false;
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
editor.view.dispatch(tr);
|
|
143
|
+
|
|
144
|
+
await onUploadFailed?.(err);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
return {
|
|
150
|
+
allowedMimeTypes,
|
|
151
|
+
onDrop: async (editor, files, pos) => {
|
|
152
|
+
await handleUpload(editor, files, pos);
|
|
153
|
+
},
|
|
154
|
+
onPaste: async (editor, files, htmlContent) => {
|
|
155
|
+
if (htmlContent?.length) return;
|
|
156
|
+
|
|
157
|
+
const startPos = editor.state.selection.anchor;
|
|
158
|
+
await handleUpload(editor, files, startPos);
|
|
159
|
+
},
|
|
160
|
+
onReferenceRemoved: async (nodeId) => {
|
|
161
|
+
await uploadClient.updateNode(nodeId, { orphanedAt: new Date() });
|
|
162
|
+
},
|
|
163
|
+
onReferenceAdded: async (nodeId) => {
|
|
164
|
+
await uploadClient.updateNode(nodeId, { orphanedAt: null });
|
|
165
|
+
},
|
|
166
|
+
};
|
|
167
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Collects and counts all image node IDs from a document.
|
|
3
|
+
*
|
|
4
|
+
* @param doc - The document node to traverse and analyze
|
|
5
|
+
* @returns A Map where keys are image node IDs and values are their occurrence counts
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* const imageCounts = collectImageIds(editorDoc);
|
|
9
|
+
* imageCounts.forEach((count, imageId) => {
|
|
10
|
+
* console.log(`Image ${imageId} appears ${count} times`);
|
|
11
|
+
* });
|
|
12
|
+
*/
|
|
13
|
+
export function collectImageIds(doc: any): Map<string, number> {
|
|
14
|
+
const counts = new Map<string, number>();
|
|
15
|
+
|
|
16
|
+
doc.descendants((node: any) => {
|
|
17
|
+
if (node.type.name !== "image") return;
|
|
18
|
+
|
|
19
|
+
const id = node.attrs?.nodeId;
|
|
20
|
+
if (!id) return;
|
|
21
|
+
|
|
22
|
+
counts.set(id, (counts.get(id) ?? 0) + 1);
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
return counts;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Compares two maps of string keys to numeric values and identifies which keys have been removed or restored.
|
|
30
|
+
* @param before - A Map containing the previous state of string keys with their associated numeric values
|
|
31
|
+
* @param after - A Map containing the current state of string keys with their associated numeric values
|
|
32
|
+
* @returns An object containing two arrays:
|
|
33
|
+
* - `removed`: Array of keys where the numeric value decreased (or was deleted)
|
|
34
|
+
* - `restored`: Array of keys where the numeric value increased
|
|
35
|
+
*/
|
|
36
|
+
export function diffIds(before: Map<string, number>, after: Map<string, number>) {
|
|
37
|
+
const removed: string[] = [];
|
|
38
|
+
const added: string[] = [];
|
|
39
|
+
|
|
40
|
+
const keys = new Set([...before.keys(), ...after.keys()]);
|
|
41
|
+
|
|
42
|
+
for (const key of keys) {
|
|
43
|
+
const b = before.get(key) ?? 0;
|
|
44
|
+
const a = after.get(key) ?? 0;
|
|
45
|
+
|
|
46
|
+
if (a < b) removed.push(key);
|
|
47
|
+
if (a > b) added.push(key);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return { removed, added };
|
|
51
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { getFileUrl } from "@/modules/storage/lib/helpers";
|
|
4
|
+
import { Image as TiptapImage, ImageOptions as TiptapImageOptions } from "@tiptap/extension-image";
|
|
5
|
+
|
|
6
|
+
export interface ImageOptions extends TiptapImageOptions {}
|
|
7
|
+
|
|
8
|
+
export const Image = TiptapImage.extend<ImageOptions>({
|
|
9
|
+
atom: true,
|
|
10
|
+
addAttributes() {
|
|
11
|
+
return {
|
|
12
|
+
...this.parent?.(),
|
|
13
|
+
// node id
|
|
14
|
+
nodeId: {
|
|
15
|
+
default: null,
|
|
16
|
+
parseHTML: (el) => el.getAttribute("data-node-id"),
|
|
17
|
+
renderHTML: (attrs) => {
|
|
18
|
+
if (!attrs.nodeId) return {};
|
|
19
|
+
return {
|
|
20
|
+
"data-node-id": attrs.nodeId,
|
|
21
|
+
...(attrs.nodeId && !attrs.isPending ? { src: getFileUrl(attrs.nodeId) } : {}),
|
|
22
|
+
};
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
|
|
26
|
+
// semantics
|
|
27
|
+
alt: { default: null },
|
|
28
|
+
title: { default: null },
|
|
29
|
+
|
|
30
|
+
// layout stability
|
|
31
|
+
width: { default: null },
|
|
32
|
+
height: { default: null },
|
|
33
|
+
|
|
34
|
+
// upload UX
|
|
35
|
+
isPending: {
|
|
36
|
+
default: false,
|
|
37
|
+
renderHTML: (attrs) => (attrs.isPending ? { "data-pending": "true" } : {}),
|
|
38
|
+
},
|
|
39
|
+
fileName: { default: null },
|
|
40
|
+
};
|
|
41
|
+
},
|
|
42
|
+
parseHTML() {
|
|
43
|
+
return [{ tag: "img[data-node-id]" }];
|
|
44
|
+
},
|
|
45
|
+
renderHTML({ HTMLAttributes }) {
|
|
46
|
+
const { src: _, ...attrs } = HTMLAttributes;
|
|
47
|
+
|
|
48
|
+
console.log("attrs", attrs);
|
|
49
|
+
|
|
50
|
+
const nodeId = attrs.nodeId as string | null;
|
|
51
|
+
const isPending = Boolean(attrs.isPending);
|
|
52
|
+
|
|
53
|
+
const src = nodeId && !isPending ? getFileUrl(nodeId) : null;
|
|
54
|
+
|
|
55
|
+
return ["img", { ...attrs, ...(src ? { src } : {}) }];
|
|
56
|
+
},
|
|
57
|
+
});
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { Node } from "@tiptap/core";
|
|
4
|
+
import { ReactNodeViewRenderer } from "@tiptap/react";
|
|
5
|
+
import { SkeletonNodeRenderer } from "./renderer";
|
|
6
|
+
|
|
7
|
+
export const Skeleton = Node.create({
|
|
8
|
+
name: "skeleton",
|
|
9
|
+
atom: true,
|
|
10
|
+
inline: true,
|
|
11
|
+
group: "inline",
|
|
12
|
+
selectable: false,
|
|
13
|
+
draggable: false,
|
|
14
|
+
addAttributes() {
|
|
15
|
+
return {
|
|
16
|
+
imageNodeId: { default: null },
|
|
17
|
+
width: { default: null },
|
|
18
|
+
height: { default: null },
|
|
19
|
+
};
|
|
20
|
+
},
|
|
21
|
+
addOptions() {
|
|
22
|
+
return {
|
|
23
|
+
addToHistory: false,
|
|
24
|
+
};
|
|
25
|
+
},
|
|
26
|
+
parseHTML() {
|
|
27
|
+
return [{ tag: "span[data-skeleton]" }];
|
|
28
|
+
},
|
|
29
|
+
renderHTML({ HTMLAttributes }) {
|
|
30
|
+
return ["span", { ...HTMLAttributes, "data-skeleton": "true" }];
|
|
31
|
+
},
|
|
32
|
+
addNodeView() {
|
|
33
|
+
return ReactNodeViewRenderer(SkeletonNodeRenderer);
|
|
34
|
+
},
|
|
35
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { Skeleton } from "@/components/ui/skeleton";
|
|
4
|
+
import { NodeViewWrapper } from "@tiptap/react";
|
|
5
|
+
|
|
6
|
+
export function SkeletonNodeRenderer(props: { node: any }) {
|
|
7
|
+
const { width, height } = props.node.attrs;
|
|
8
|
+
|
|
9
|
+
return (
|
|
10
|
+
<NodeViewWrapper as="span" data-skeleton="true">
|
|
11
|
+
<Skeleton className="min-h-[500px] w-full" style={{ width, height }} />
|
|
12
|
+
</NodeViewWrapper>
|
|
13
|
+
);
|
|
14
|
+
}
|
|
@@ -5,7 +5,6 @@ import HardBreak from "@tiptap/extension-hard-break";
|
|
|
5
5
|
import Heading from "@tiptap/extension-heading";
|
|
6
6
|
import Highlight from "@tiptap/extension-highlight";
|
|
7
7
|
import HorizontalRule from "@tiptap/extension-horizontal-rule";
|
|
8
|
-
import Image from "@tiptap/extension-image";
|
|
9
8
|
import Italic from "@tiptap/extension-italic";
|
|
10
9
|
import Link from "@tiptap/extension-link";
|
|
11
10
|
import { BulletList, ListItem, ListKeymap, OrderedList } from "@tiptap/extension-list";
|
|
@@ -15,6 +14,9 @@ import Text from "@tiptap/extension-text";
|
|
|
15
14
|
import { Color, TextStyle } from "@tiptap/extension-text-style";
|
|
16
15
|
import Underline from "@tiptap/extension-underline";
|
|
17
16
|
import { Dropcursor, Gapcursor, TrailingNode, UndoRedo } from "@tiptap/extensions";
|
|
17
|
+
import { FileHandler } from "../extensions/file-handler/extension";
|
|
18
|
+
import { Image } from "../extensions/image/extension";
|
|
19
|
+
import { Skeleton } from "../extensions/skeleton/extension";
|
|
18
20
|
import { createExtensionConfig } from "./extensions";
|
|
19
21
|
|
|
20
22
|
/**
|
|
@@ -35,6 +37,8 @@ export const EDITOR_EXTENSIONS = {
|
|
|
35
37
|
paragraph: Paragraph,
|
|
36
38
|
text: Text,
|
|
37
39
|
image: Image,
|
|
40
|
+
fileHandler: FileHandler,
|
|
41
|
+
skeleton: Skeleton,
|
|
38
42
|
/**
|
|
39
43
|
* Marks
|
|
40
44
|
*/
|
|
@@ -86,7 +90,17 @@ export const EDITOR_EXTENSIONS_CONFIG = [
|
|
|
86
90
|
createExtensionConfig("bulletList"),
|
|
87
91
|
createExtensionConfig("paragraph"),
|
|
88
92
|
createExtensionConfig("text"),
|
|
89
|
-
createExtensionConfig("image", {
|
|
93
|
+
createExtensionConfig("image", {
|
|
94
|
+
resize: {
|
|
95
|
+
enabled: true,
|
|
96
|
+
directions: ["left", "right"],
|
|
97
|
+
minHeight: 50,
|
|
98
|
+
minWidth: 50,
|
|
99
|
+
alwaysPreserveAspectRatio: true,
|
|
100
|
+
},
|
|
101
|
+
}),
|
|
102
|
+
createExtensionConfig("fileHandler"),
|
|
103
|
+
createExtensionConfig("skeleton"),
|
|
90
104
|
/**
|
|
91
105
|
* Marks
|
|
92
106
|
*/
|
|
@@ -4,7 +4,6 @@ import { HardBreakOptions } from "@tiptap/extension-hard-break";
|
|
|
4
4
|
import { HeadingOptions } from "@tiptap/extension-heading";
|
|
5
5
|
import { HighlightOptions } from "@tiptap/extension-highlight";
|
|
6
6
|
import { HorizontalRuleOptions } from "@tiptap/extension-horizontal-rule";
|
|
7
|
-
import { ImageOptions } from "@tiptap/extension-image";
|
|
8
7
|
import { ItalicOptions } from "@tiptap/extension-italic";
|
|
9
8
|
import { LinkOptions } from "@tiptap/extension-link";
|
|
10
9
|
import {
|
|
@@ -20,6 +19,8 @@ import { UnderlineOptions } from "@tiptap/extension-underline";
|
|
|
20
19
|
import { DropcursorOptions, TrailingNodeOptions, UndoRedoOptions } from "@tiptap/extensions";
|
|
21
20
|
import { Extension } from "@tiptap/react";
|
|
22
21
|
import deepmerge from "deepmerge";
|
|
22
|
+
import { FileHandlerOptions } from "../extensions/file-handler/extension";
|
|
23
|
+
import { ImageOptions } from "../extensions/image/extension";
|
|
23
24
|
import {
|
|
24
25
|
EDITOR_EXTENSIONS,
|
|
25
26
|
EDITOR_EXTENSIONS_CONFIG,
|
|
@@ -48,6 +49,8 @@ export type EditorExtensionsConfig = {
|
|
|
48
49
|
paragraph: Partial<ParagraphOptions> | boolean;
|
|
49
50
|
text: Partial<TextStyleOptions> | boolean;
|
|
50
51
|
image: Partial<ImageOptions> | boolean;
|
|
52
|
+
fileHandler: Partial<FileHandlerOptions> | boolean;
|
|
53
|
+
skeleton: boolean;
|
|
51
54
|
/**
|
|
52
55
|
* Marks
|
|
53
56
|
*/
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { Node as PMNode } from "@tiptap/pm/model";
|
|
2
|
+
|
|
1
3
|
type ShortcutKeyResult = {
|
|
2
4
|
symbol: string;
|
|
3
5
|
readable: string;
|
|
@@ -199,3 +201,33 @@ export const filterFiles = <T extends FileInput>(
|
|
|
199
201
|
|
|
200
202
|
return [validFiles, errors];
|
|
201
203
|
};
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* Helper for iterating through the nodes in a document that changed compared
|
|
207
|
+
* to the given previous document. Useful for avoiding duplicate work on each transaction.
|
|
208
|
+
* Source: https://github.com/ProseMirror/prosemirror-tables/blob/master/src/fixtables.js
|
|
209
|
+
*/
|
|
210
|
+
export function changedDescendants(
|
|
211
|
+
old: PMNode,
|
|
212
|
+
cur: PMNode,
|
|
213
|
+
offset: number,
|
|
214
|
+
f: (node: PMNode, pos: number) => void,
|
|
215
|
+
) {
|
|
216
|
+
const oldSize = old.childCount,
|
|
217
|
+
curSize = cur.childCount;
|
|
218
|
+
outer: for (let i = 0, j = 0; i < curSize; i++) {
|
|
219
|
+
const child = cur.child(i);
|
|
220
|
+
for (let scan = j, e = Math.min(oldSize, i + 3); scan < e; scan++) {
|
|
221
|
+
if (old.child(scan) == child) {
|
|
222
|
+
j = scan + 1;
|
|
223
|
+
offset += child.nodeSize;
|
|
224
|
+
continue outer;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
f(child, offset);
|
|
228
|
+
if (j < oldSize && old.child(j).sameMarkup(child))
|
|
229
|
+
changedDescendants(old.child(j), child, offset + 1, f);
|
|
230
|
+
else child.nodesBetween(0, child.content.size, f, offset + 1);
|
|
231
|
+
offset += child.nodeSize;
|
|
232
|
+
}
|
|
233
|
+
}
|
|
@@ -1,5 +1,76 @@
|
|
|
1
|
+
import { cn } from "@/lib/utils/cn";
|
|
1
2
|
import { cva } from "class-variance-authority";
|
|
2
3
|
|
|
4
|
+
/**
|
|
5
|
+
* Prose variants
|
|
6
|
+
*/
|
|
3
7
|
export const editorProseVariants = cva(
|
|
4
|
-
|
|
8
|
+
cn(
|
|
9
|
+
"prose dark:prose-invert",
|
|
10
|
+
"prose-a:text-primary",
|
|
11
|
+
"prose-headings:scroll-mt-20",
|
|
12
|
+
"prose-h1:mt-6 prose-h1:mb-3",
|
|
13
|
+
"prose-h2:mt-6 prose-h2:mb-3",
|
|
14
|
+
"prose-h3:mt-5 prose-h3:mb-2",
|
|
15
|
+
"prose-h4:mt-4 prose-h4:mb-2",
|
|
16
|
+
"prose-ul:my-3 prose-ol:my-3",
|
|
17
|
+
"prose-ul:pl-6 prose-ol:pl-6",
|
|
18
|
+
"prose-li:my-1",
|
|
19
|
+
"prose-li:marker:text-primary",
|
|
20
|
+
"prose-li:p-0",
|
|
21
|
+
"prose-img:my-0 prose-img:rounded-lg",
|
|
22
|
+
"prose-blockquote:my-4 prose-blockquote:py-1",
|
|
23
|
+
"prose-hr:my-6",
|
|
24
|
+
"prose-pre:my-4",
|
|
25
|
+
),
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Image variants
|
|
30
|
+
*/
|
|
31
|
+
export const editorImageVariants = cva(
|
|
32
|
+
cn(
|
|
33
|
+
// wrapper (TipTap sets display:block inline → override with !)
|
|
34
|
+
"[&_[data-resize-wrapper]]:!inline-block",
|
|
35
|
+
"[&_[data-resize-wrapper]]:!relative",
|
|
36
|
+
"[&_[data-resize-wrapper]]:max-w-full",
|
|
37
|
+
"[&_[data-resize-wrapper]]:overflow-hidden",
|
|
38
|
+
|
|
39
|
+
// handle base
|
|
40
|
+
"[&_[data-resize-handle]]:absolute",
|
|
41
|
+
"[&_[data-resize-handle]]:z-10",
|
|
42
|
+
"[&_[data-resize-handle]]:rounded-full",
|
|
43
|
+
"[&_[data-resize-handle]]:bg-muted/40",
|
|
44
|
+
"[&_[data-resize-handle]]:w-1.5",
|
|
45
|
+
"[&_[data-resize-handle]]:cursor-ew-resize",
|
|
46
|
+
"[&_[data-resize-handle]]:opacity-0",
|
|
47
|
+
"[&_[data-resize-handle]]:transition-opacity",
|
|
48
|
+
|
|
49
|
+
// show on hover / active
|
|
50
|
+
"[&:hover_[data-resize-handle]]:opacity-100",
|
|
51
|
+
"[&_[data-resize-state='true']_[data-resize-handle]]:opacity-100",
|
|
52
|
+
|
|
53
|
+
// ✅ override TipTap inline: top:0; bottom:0;
|
|
54
|
+
"[&_[data-resize-handle]]:!top-1/2",
|
|
55
|
+
"[&_[data-resize-handle]]:!bottom-auto",
|
|
56
|
+
"[&_[data-resize-handle]]:!-translate-y-1/2",
|
|
57
|
+
|
|
58
|
+
// ✅ half height (also must beat inline)
|
|
59
|
+
"[&_[data-resize-handle]]:!h-1/2",
|
|
60
|
+
|
|
61
|
+
// ✅ spacing from edge (beat inline left:0 / right:0)
|
|
62
|
+
"[&_[data-resize-handle='left']]:!left-2",
|
|
63
|
+
"[&_[data-resize-handle='right']]:!right-2",
|
|
64
|
+
|
|
65
|
+
// ✅ override inline visibility:hidden on the resize container while pending
|
|
66
|
+
"[&_[data-resize-container]:has(img[data-pending='true'])]:[visibility:visible!important]",
|
|
67
|
+
"[&_[data-resize-container]:has(img[data-pending='true'])]:[pointer-events:auto!important]",
|
|
68
|
+
|
|
69
|
+
// Pending img should behave like a skeleton block (even before wrapper exists)
|
|
70
|
+
"[&_img[data-pending='true']]:bg-primary/10",
|
|
71
|
+
"[&_img[data-pending='true']]:animate-pulse",
|
|
72
|
+
"[&_img[data-pending='true']]:rounded-md",
|
|
73
|
+
"[&_img[data-pending='true']]:opacity-0",
|
|
74
|
+
"[&_img[data-pending='true']]:min-h-[500px]",
|
|
75
|
+
),
|
|
5
76
|
);
|
package/src/components/entry.ts
CHANGED
|
@@ -3,8 +3,9 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export * from "./common/icons";
|
|
5
5
|
export * from "./common/status";
|
|
6
|
-
export * from "./editor/
|
|
6
|
+
export * from "./editor/extensions/file-handler/strategy";
|
|
7
7
|
export * from "./editor/lib/helpers";
|
|
8
|
+
export * from "./editor/lib/types";
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
11
|
* Components Layouts
|