@tulip-systems/core 0.7.0 → 0.8.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/dist/auth/server.d.mts +3 -3
- package/dist/auth/server.mjs +3 -3
- package/dist/components/editor/components/editor.client.d.mts +4 -3
- package/dist/components/editor/components/editor.client.d.mts.map +1 -1
- package/dist/components/editor/components/editor.client.mjs +5 -2
- package/dist/components/editor/components/editor.client.mjs.map +1 -1
- package/dist/components/editor/extensions/file-handler/extension.d.mts +4 -4
- package/dist/components/editor/extensions/file-handler/extension.d.mts.map +1 -1
- package/dist/components/editor/extensions/file-handler/extension.mjs.map +1 -1
- package/dist/components/editor/extensions/file-handler/strategy.d.mts +4 -6
- package/dist/components/editor/extensions/file-handler/strategy.d.mts.map +1 -1
- package/dist/components/editor/extensions/file-handler/strategy.mjs +11 -11
- package/dist/components/editor/extensions/file-handler/strategy.mjs.map +1 -1
- package/dist/components/editor/extensions/file-handler/utils.mjs +1 -1
- package/dist/components/editor/extensions/file-handler/utils.mjs.map +1 -1
- package/dist/components/editor/extensions/image/extension.mjs +9 -9
- package/dist/components/editor/extensions/image/extension.mjs.map +1 -1
- package/dist/components/editor/lib/constants.d.mts +1 -1
- package/dist/components/editor/lib/constants.mjs +1 -1
- package/dist/components/editor/lib/extensions.d.mts +1 -1
- package/dist/components/editor/lib/helpers.d.mts +11 -3
- package/dist/components/editor/lib/helpers.d.mts.map +1 -1
- package/dist/components/editor/lib/helpers.mjs +27 -13
- package/dist/components/editor/lib/helpers.mjs.map +1 -1
- package/dist/components/ui/badge.d.mts +1 -1
- package/dist/components/ui/button-group.d.mts +1 -1
- package/dist/components/ui/button.d.mts +2 -2
- package/dist/components/ui/combobox-dropdown.client.mjs +1 -0
- package/dist/components/ui/combobox-dropdown.client.mjs.map +1 -1
- package/dist/components/ui/combobox.client.mjs +1 -1
- package/dist/components/ui/combobox.client.mjs.map +1 -1
- package/dist/components/ui/field.client.d.mts +1 -1
- package/dist/components/ui/item.d.mts +1 -1
- package/dist/components.d.mts +2 -2
- package/dist/components.mjs +2 -2
- package/dist/config/server.d.mts +1 -3
- package/dist/config/server.mjs +1 -4
- package/dist/config.d.mts +2 -2
- package/dist/config.mjs +1 -1
- package/dist/data-tables/client.d.mts +2 -1
- package/dist/data-tables/client.mjs +2 -1
- package/dist/data-tables.d.mts +1 -1
- package/dist/database/client.d.mts +1 -0
- package/dist/database/client.mjs +1 -0
- package/dist/database/server.d.mts +2 -0
- package/dist/database/server.mjs +3 -0
- package/dist/database.d.mts +3 -0
- package/dist/database.mjs +3 -0
- package/dist/emails/client.d.mts +1 -0
- package/dist/emails/client.mjs +1 -0
- package/dist/emails/server.d.mts +2 -0
- package/dist/emails/server.mjs +3 -0
- package/dist/emails.d.mts +1 -0
- package/dist/emails.mjs +1 -0
- package/dist/lib/utils/markdown.d.mts +10 -0
- package/dist/lib/utils/markdown.d.mts.map +1 -0
- package/dist/lib/utils/markdown.mjs +15 -0
- package/dist/lib/utils/markdown.mjs.map +1 -0
- package/dist/lib/utils/url.mjs +2 -1
- package/dist/lib/utils/url.mjs.map +1 -1
- package/dist/lib/utils/user-agent.mjs +15 -0
- package/dist/lib/utils/user-agent.mjs.map +1 -1
- package/dist/lib.d.mts +2 -2
- package/dist/lib.mjs +2 -2
- package/dist/modules/auth/components/create-first-user-guard.server.d.mts +16 -0
- package/dist/modules/auth/components/create-first-user-guard.server.d.mts.map +1 -0
- package/dist/modules/auth/components/create-first-user-guard.server.mjs +16 -0
- package/dist/modules/auth/components/create-first-user-guard.server.mjs.map +1 -0
- package/dist/modules/auth/components/guard.server.d.mts +2 -2
- package/dist/modules/auth/components/guard.server.mjs +1 -1
- package/dist/modules/auth/components/guard.server.mjs.map +1 -1
- package/dist/modules/auth/db/schema.d.mts +1 -1
- package/dist/modules/auth/db/schema.mjs +2 -2
- package/dist/modules/auth/handler/create-client.client.d.mts +4838 -229
- package/dist/modules/auth/handler/create-client.client.d.mts.map +1 -1
- package/dist/modules/auth/handler/create-client.client.mjs.map +1 -1
- package/dist/modules/auth/handler/proxy.server.mjs +2 -2
- package/dist/modules/auth/handler/proxy.server.mjs.map +1 -1
- package/dist/modules/auth/handler/route.server.d.mts +2 -2
- package/dist/modules/auth/handler/route.server.d.mts.map +1 -1
- package/dist/modules/auth/handler/route.server.mjs.map +1 -1
- package/dist/modules/auth/handler/{init.d.mts → service.server.d.mts} +322 -90
- package/dist/modules/auth/handler/service.server.d.mts.map +1 -0
- package/dist/modules/auth/handler/{init.mjs → service.server.mjs} +19 -8
- package/dist/modules/auth/handler/service.server.mjs.map +1 -0
- package/dist/modules/auth/hooks/use-session.d.mts +9 -4
- package/dist/modules/auth/hooks/use-session.d.mts.map +1 -1
- package/dist/modules/auth/lib/helpers.server.d.mts +1 -1
- package/dist/modules/auth/lib/permissions.d.mts +1 -1
- package/dist/modules/auth/lib/validators.mjs +1 -1
- package/dist/modules/config/lib/context.d.mts +9 -10
- package/dist/modules/config/lib/context.d.mts.map +1 -1
- package/dist/modules/config/lib/context.mjs.map +1 -1
- package/dist/modules/data-tables/lib/converters/search.d.mts +1 -1
- package/dist/modules/data-tables/lib/converters/sorting.d.mts +1 -1
- package/dist/modules/data-tables/server/get-data.server.d.mts +3 -3
- package/dist/modules/data-tables/server/get-data.server.mjs +1 -1
- package/dist/modules/data-tables/server/get-data.server.mjs.map +1 -1
- package/dist/modules/data-tables/strategies/infinite/strategy.d.mts +1 -1
- package/dist/modules/data-tables/strategies/infinite/strategy.mjs +3 -0
- package/dist/modules/data-tables/strategies/infinite/strategy.mjs.map +1 -1
- package/dist/modules/data-tables/tables/data-table/components/row.mjs +5 -15
- package/dist/modules/data-tables/tables/data-table/components/row.mjs.map +1 -1
- package/dist/modules/data-tables/tables/inline-table/components/body.mjs +1 -1
- package/dist/modules/data-tables/tables/inline-table/components/body.mjs.map +1 -1
- package/dist/modules/data-tables/tables/inline-table/components/row.client.mjs +13 -23
- package/dist/modules/data-tables/tables/inline-table/components/row.client.mjs.map +1 -1
- package/dist/modules/data-tables/tables/inline-table/components/table.d.mts +1 -0
- package/dist/modules/data-tables/tables/inline-table/components/table.d.mts.map +1 -1
- package/dist/modules/data-tables/tables/inline-table/components/table.mjs +2 -1
- package/dist/modules/data-tables/tables/inline-table/components/table.mjs.map +1 -1
- package/dist/modules/data-tables/tables/inline-table/hooks/context.client.d.mts +5 -1
- package/dist/modules/data-tables/tables/inline-table/hooks/context.client.d.mts.map +1 -1
- package/dist/modules/data-tables/tables/inline-table/hooks/context.client.mjs +2 -1
- package/dist/modules/data-tables/tables/inline-table/hooks/context.client.mjs.map +1 -1
- package/dist/modules/data-tables/tables/inline-table/hooks/use-hotkeys.client.d.mts +30 -0
- package/dist/modules/data-tables/tables/inline-table/hooks/use-hotkeys.client.d.mts.map +1 -0
- package/dist/modules/data-tables/tables/inline-table/hooks/use-hotkeys.client.mjs +77 -9
- package/dist/modules/data-tables/tables/inline-table/hooks/use-hotkeys.client.mjs.map +1 -1
- package/dist/modules/{config/db → database/lib}/helpers.d.mts +2 -2
- package/dist/modules/database/lib/helpers.d.mts.map +1 -0
- package/dist/modules/{config/db → database/lib}/helpers.mjs +1 -1
- package/dist/modules/database/lib/helpers.mjs.map +1 -0
- package/dist/modules/database/lib/service.server.d.mts +34 -0
- package/dist/modules/database/lib/service.server.d.mts.map +1 -0
- package/dist/modules/database/lib/service.server.mjs +24 -0
- package/dist/modules/database/lib/service.server.mjs.map +1 -0
- package/dist/modules/{config/db → database/lib}/types.d.mts +1 -1
- package/dist/modules/database/lib/types.d.mts.map +1 -0
- package/dist/modules/emails/lib/service.server.d.mts +29 -0
- package/dist/modules/emails/lib/service.server.d.mts.map +1 -0
- package/dist/modules/emails/lib/service.server.mjs +21 -0
- package/dist/modules/emails/lib/service.server.mjs.map +1 -0
- package/dist/modules/inline-edit/components/date-input.client.mjs +1 -1
- package/dist/modules/inline-edit/components/date-input.client.mjs.map +1 -1
- package/dist/modules/inline-edit/components/date-picker.client.mjs +1 -0
- package/dist/modules/inline-edit/components/date-picker.client.mjs.map +1 -1
- package/dist/modules/inline-edit/components/date-time.client.mjs +1 -0
- package/dist/modules/inline-edit/components/date-time.client.mjs.map +1 -1
- package/dist/modules/inline-edit/components/editor.client.mjs +1 -0
- package/dist/modules/inline-edit/components/editor.client.mjs.map +1 -1
- package/dist/modules/inline-edit/components/input-recipient.client.mjs +1 -0
- package/dist/modules/inline-edit/components/input-recipient.client.mjs.map +1 -1
- package/dist/modules/inline-edit/components/input-toggle.client.mjs +1 -0
- package/dist/modules/inline-edit/components/input-toggle.client.mjs.map +1 -1
- package/dist/modules/inline-edit/components/input.client.d.mts.map +1 -1
- package/dist/modules/inline-edit/components/input.client.mjs +3 -0
- package/dist/modules/inline-edit/components/input.client.mjs.map +1 -1
- package/dist/modules/inline-edit/components/select.client.d.mts.map +1 -1
- package/dist/modules/inline-edit/components/select.client.mjs +1 -0
- package/dist/modules/inline-edit/components/select.client.mjs.map +1 -1
- package/dist/modules/inline-edit/components/switch.client.mjs +1 -0
- package/dist/modules/inline-edit/components/switch.client.mjs.map +1 -1
- package/dist/modules/inline-edit/components/toggle.client.mjs +1 -0
- package/dist/modules/inline-edit/components/toggle.client.mjs.map +1 -1
- package/dist/modules/inline-edit/lib/variants.d.mts +1 -1
- package/dist/modules/router/handler/context.server.d.mts +12 -10
- package/dist/modules/router/handler/context.server.d.mts.map +1 -1
- package/dist/modules/router/handler/init.server.d.mts +13 -11
- package/dist/modules/router/handler/init.server.d.mts.map +1 -1
- package/dist/modules/router/handler/init.server.mjs +2 -2
- package/dist/modules/router/handler/init.server.mjs.map +1 -1
- package/dist/modules/router/handler/route.server.d.mts +1 -1
- package/dist/modules/storage/components/dropzone.client.d.mts +2 -2
- package/dist/modules/storage/components/dropzone.client.d.mts.map +1 -1
- package/dist/modules/storage/components/dropzone.client.mjs.map +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 +20 -22
- package/dist/modules/storage/components/image-grid.client.mjs.map +1 -1
- package/dist/modules/storage/components/image.client.d.mts +8 -0
- package/dist/modules/storage/components/image.client.d.mts.map +1 -0
- package/dist/modules/storage/components/image.client.mjs +17 -0
- package/dist/modules/storage/components/image.client.mjs.map +1 -0
- package/dist/modules/storage/components/upload-button.client.d.mts +12 -0
- package/dist/modules/storage/components/upload-button.client.d.mts.map +1 -0
- package/dist/modules/storage/components/upload-button.client.mjs +34 -0
- package/dist/modules/storage/components/upload-button.client.mjs.map +1 -0
- package/dist/modules/storage/components/upload-zone-context.client.d.mts +5 -5
- package/dist/modules/storage/components/upload-zone-context.client.d.mts.map +1 -1
- package/dist/modules/storage/components/upload-zone-context.client.mjs +2 -2
- package/dist/modules/storage/components/upload-zone-context.client.mjs.map +1 -1
- package/dist/modules/storage/components/upload-zone.client.d.mts +4 -4
- package/dist/modules/storage/components/upload-zone.client.d.mts.map +1 -1
- package/dist/modules/storage/components/upload-zone.client.mjs +16 -9
- package/dist/modules/storage/components/upload-zone.client.mjs.map +1 -1
- package/dist/modules/storage/lib/constants.d.mts +1 -5
- package/dist/modules/storage/lib/constants.d.mts.map +1 -1
- package/dist/modules/storage/lib/constants.mjs +1 -13
- package/dist/modules/storage/lib/constants.mjs.map +1 -1
- package/dist/modules/storage/lib/helpers.d.mts +14 -28
- package/dist/modules/storage/lib/helpers.d.mts.map +1 -1
- package/dist/modules/storage/lib/helpers.mjs +17 -75
- package/dist/modules/storage/lib/helpers.mjs.map +1 -1
- package/dist/modules/storage/lib/procedures.server.d.mts +1991 -0
- package/dist/modules/{auth/handler/init.d.mts.map → storage/lib/procedures.server.d.mts.map} +1 -1
- package/dist/modules/storage/lib/procedures.server.mjs +22 -0
- package/dist/modules/storage/lib/procedures.server.mjs.map +1 -0
- package/dist/modules/storage/lib/router-handlers.server.d.mts +41 -0
- package/dist/modules/storage/lib/router-handlers.server.d.mts.map +1 -0
- package/dist/modules/storage/lib/router-handlers.server.mjs +124 -0
- package/dist/modules/storage/lib/router-handlers.server.mjs.map +1 -0
- package/dist/modules/storage/lib/schema.d.mts +68 -958
- package/dist/modules/storage/lib/schema.d.mts.map +1 -1
- package/dist/modules/storage/lib/schema.mjs +28 -65
- package/dist/modules/storage/lib/schema.mjs.map +1 -1
- package/dist/modules/storage/lib/service.server.d.mts +2155 -141
- package/dist/modules/storage/lib/service.server.d.mts.map +1 -1
- package/dist/modules/storage/lib/service.server.mjs +453 -242
- package/dist/modules/storage/lib/service.server.mjs.map +1 -1
- package/dist/modules/storage/lib/upload.client.d.mts +58 -0
- package/dist/modules/storage/lib/upload.client.d.mts.map +1 -0
- package/dist/modules/storage/lib/upload.client.mjs +87 -0
- package/dist/modules/storage/lib/upload.client.mjs.map +1 -0
- package/dist/modules/storage/lib/validators.d.mts +297 -835
- package/dist/modules/storage/lib/validators.d.mts.map +1 -1
- package/dist/modules/storage/lib/validators.mjs +32 -76
- package/dist/modules/storage/lib/validators.mjs.map +1 -1
- package/dist/modules/storage/providers/adapters/s3.server.d.mts +19 -0
- package/dist/modules/storage/providers/adapters/s3.server.d.mts.map +1 -0
- package/dist/modules/storage/providers/adapters/s3.server.mjs +173 -0
- package/dist/modules/storage/providers/adapters/s3.server.mjs.map +1 -0
- package/dist/modules/storage/providers/lib/constants.d.mts +6 -0
- package/dist/modules/storage/providers/lib/constants.d.mts.map +1 -0
- package/dist/modules/storage/providers/lib/constants.mjs +6 -0
- package/dist/modules/storage/providers/lib/constants.mjs.map +1 -0
- package/dist/modules/storage/providers/lib/errors.d.mts +12 -0
- package/dist/modules/storage/providers/lib/errors.d.mts.map +1 -0
- package/dist/modules/storage/providers/lib/errors.mjs +13 -0
- package/dist/modules/storage/providers/lib/errors.mjs.map +1 -0
- package/dist/modules/storage/providers/lib/types.d.mts +21 -0
- package/dist/modules/storage/providers/lib/types.d.mts.map +1 -0
- package/dist/modules/storage/providers/lib/validators.d.mts +112 -0
- package/dist/modules/storage/providers/lib/validators.d.mts.map +1 -0
- package/dist/modules/storage/providers/lib/validators.mjs +75 -0
- package/dist/modules/storage/providers/lib/validators.mjs.map +1 -0
- package/dist/router/server.d.mts +1 -1
- package/dist/storage/client.d.mts +4 -2
- package/dist/storage/client.mjs +4 -2
- package/dist/storage/server.d.mts +5 -4
- package/dist/storage/server.mjs +5 -4
- package/dist/storage.d.mts +9 -6
- package/dist/storage.mjs +8 -6
- package/package.json +18 -5
- package/src/components/editor/components/editor.client.tsx +9 -1
- package/src/components/editor/extensions/file-handler/extension.ts +4 -4
- package/src/components/editor/extensions/file-handler/strategy.ts +15 -40
- package/src/components/editor/extensions/file-handler/utils.ts +1 -1
- package/src/components/editor/extensions/image/extension.ts +10 -10
- package/src/components/editor/lib/helpers.ts +28 -11
- package/src/components/ui/combobox-dropdown.client.tsx +1 -0
- package/src/components/ui/combobox.client.tsx +1 -1
- package/src/entry.ts +12 -51
- package/src/lib/entry.ts +1 -5
- package/src/lib/utils/markdown.ts +10 -0
- package/src/lib/utils/url.ts +2 -1
- package/src/lib/utils/user-agent.ts +15 -0
- package/src/modules/auth/components/{guard-first-user.server.tsx → create-first-user-guard.server.tsx} +8 -8
- package/src/modules/auth/components/guard.server.tsx +1 -1
- package/src/modules/auth/entry.server.ts +4 -5
- package/src/modules/auth/handler/create-client.client.ts +2 -2
- package/src/modules/auth/handler/proxy.server.ts +1 -1
- package/src/modules/auth/handler/route.server.ts +2 -2
- package/src/modules/auth/handler/{init.ts → service.server.ts} +30 -9
- package/src/modules/config/entry.server.ts +0 -9
- package/src/modules/config/entry.ts +2 -2
- package/src/modules/config/lib/context.ts +9 -9
- package/src/modules/data-tables/entry.client.ts +1 -0
- package/src/modules/data-tables/server/get-data.server.ts +1 -1
- package/src/modules/data-tables/strategies/infinite/strategy.ts +4 -1
- package/src/modules/data-tables/tables/data-table/components/row.tsx +12 -21
- package/src/modules/data-tables/tables/inline-table/components/body.tsx +1 -1
- package/src/modules/data-tables/tables/inline-table/components/row.client.tsx +24 -30
- package/src/modules/data-tables/tables/inline-table/components/table.tsx +6 -1
- package/src/modules/data-tables/tables/inline-table/hooks/context.client.tsx +5 -0
- package/src/modules/data-tables/tables/inline-table/hooks/use-hotkeys.client.ts +119 -91
- package/src/modules/database/entry.client.ts +0 -0
- package/src/modules/database/entry.server.ts +4 -0
- package/src/modules/database/entry.ts +5 -0
- package/src/modules/database/lib/service.server.ts +33 -0
- package/src/modules/emails/entry.client.ts +0 -0
- package/src/modules/emails/entry.server.ts +4 -0
- package/src/modules/emails/entry.ts +0 -0
- package/src/modules/emails/lib/service.server.ts +29 -0
- package/src/modules/inline-edit/components/date-input.client.tsx +1 -1
- package/src/modules/inline-edit/components/date-picker.client.tsx +1 -0
- package/src/modules/inline-edit/components/date-time.client.tsx +1 -0
- package/src/modules/inline-edit/components/editor.client.tsx +3 -0
- package/src/modules/inline-edit/components/input-recipient.client.tsx +1 -0
- package/src/modules/inline-edit/components/input-toggle.client.tsx +1 -0
- package/src/modules/inline-edit/components/input.client.tsx +3 -0
- package/src/modules/inline-edit/components/select.client.tsx +5 -1
- package/src/modules/inline-edit/components/switch.client.tsx +1 -0
- package/src/modules/inline-edit/components/toggle.client.tsx +1 -0
- package/src/modules/router/handler/init.server.ts +2 -2
- package/src/modules/storage/components/dropzone.client.tsx +1 -1
- package/src/modules/storage/components/image-grid.client.tsx +23 -20
- package/src/modules/storage/components/image.client.tsx +8 -0
- package/src/modules/storage/components/upload-zone-context.client.tsx +11 -8
- package/src/modules/storage/components/upload-zone.client.tsx +22 -16
- package/src/modules/storage/entry.client.ts +3 -1
- package/src/modules/storage/entry.server.ts +9 -3
- package/src/modules/storage/entry.ts +13 -1
- package/src/modules/storage/lib/constants.ts +0 -11
- package/src/modules/storage/lib/helpers.ts +18 -65
- package/src/modules/storage/lib/procedures.server.ts +60 -0
- package/src/modules/storage/lib/router-handlers.server.ts +178 -0
- package/src/modules/storage/lib/schema.ts +26 -97
- package/src/modules/storage/lib/service.server.ts +636 -374
- package/src/modules/storage/lib/upload.client.ts +156 -0
- package/src/modules/storage/lib/validators.ts +50 -111
- package/src/modules/storage/providers/adapters/s3.server.ts +281 -0
- package/src/modules/storage/providers/lib/constants.ts +3 -0
- package/src/modules/storage/providers/lib/errors.ts +21 -0
- package/src/modules/storage/providers/lib/types.ts +28 -0
- package/src/modules/storage/providers/lib/validators.ts +122 -0
- package/dist/lib/config/constants.d.mts +0 -5
- package/dist/lib/config/constants.d.mts.map +0 -1
- package/dist/lib/config/constants.mjs +0 -6
- package/dist/lib/config/constants.mjs.map +0 -1
- package/dist/modules/auth/components/guard-first-user.server.d.mts +0 -18
- package/dist/modules/auth/components/guard-first-user.server.d.mts.map +0 -1
- package/dist/modules/auth/components/guard-first-user.server.mjs +0 -16
- package/dist/modules/auth/components/guard-first-user.server.mjs.map +0 -1
- package/dist/modules/auth/handler/init.mjs.map +0 -1
- package/dist/modules/config/db/helpers.d.mts.map +0 -1
- package/dist/modules/config/db/helpers.mjs.map +0 -1
- package/dist/modules/config/db/init.d.mts +0 -20
- package/dist/modules/config/db/init.d.mts.map +0 -1
- package/dist/modules/config/db/init.mjs +0 -15
- package/dist/modules/config/db/init.mjs.map +0 -1
- package/dist/modules/config/db/types.d.mts.map +0 -1
- package/dist/modules/config/providers/email.d.mts +0 -12
- package/dist/modules/config/providers/email.d.mts.map +0 -1
- package/dist/modules/config/providers/email.mjs +0 -11
- package/dist/modules/config/providers/email.mjs.map +0 -1
- package/dist/modules/storage/config/filters.d.mts +0 -17
- package/dist/modules/storage/config/filters.d.mts.map +0 -1
- package/dist/modules/storage/config/filters.mjs +0 -17
- package/dist/modules/storage/config/filters.mjs.map +0 -1
- package/dist/modules/storage/lib/create-client.server.d.mts +0 -11
- package/dist/modules/storage/lib/create-client.server.d.mts.map +0 -1
- package/dist/modules/storage/lib/create-client.server.mjs +0 -11
- package/dist/modules/storage/lib/create-client.server.mjs.map +0 -1
- package/dist/modules/storage/lib/create-upload.client.d.mts +0 -56
- package/dist/modules/storage/lib/create-upload.client.d.mts.map +0 -1
- package/dist/modules/storage/lib/create-upload.client.mjs +0 -98
- package/dist/modules/storage/lib/create-upload.client.mjs.map +0 -1
- package/dist/modules/storage/lib/proxy.server.d.mts +0 -21
- package/dist/modules/storage/lib/proxy.server.d.mts.map +0 -1
- package/dist/modules/storage/lib/proxy.server.mjs +0 -46
- package/dist/modules/storage/lib/proxy.server.mjs.map +0 -1
- package/dist/modules/storage/lib/router.server.d.mts +0 -31002
- package/dist/modules/storage/lib/router.server.d.mts.map +0 -1
- package/dist/modules/storage/lib/router.server.mjs +0 -86
- package/dist/modules/storage/lib/router.server.mjs.map +0 -1
- package/src/lib/config/constants.ts +0 -1
- package/src/lib/utils/time-picker.ts +0 -139
- package/src/modules/config/db/init.ts +0 -21
- package/src/modules/config/providers/email.ts +0 -13
- package/src/modules/storage/config/filters.ts +0 -12
- package/src/modules/storage/lib/create-client.server.ts +0 -14
- package/src/modules/storage/lib/create-upload.client.ts +0 -134
- package/src/modules/storage/lib/proxy.server.ts +0 -63
- package/src/modules/storage/lib/router.server.ts +0 -182
- /package/src/modules/{config/db → database/lib}/helpers.ts +0 -0
- /package/src/modules/{config/db → database/lib}/types.ts +0 -0
package/dist/auth/server.d.mts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { AuthLayout } from "../modules/auth/components/auth-layout.server.mjs";
|
|
2
|
-
import {
|
|
2
|
+
import { Auth, authCookiePrefix } from "../modules/auth/handler/service.server.mjs";
|
|
3
|
+
import { CreateFirstUserPageGuard } from "../modules/auth/components/create-first-user-guard.server.mjs";
|
|
3
4
|
import { AuthGuard } from "../modules/auth/components/guard.server.mjs";
|
|
4
|
-
import { AuthGuardFirstUser } from "../modules/auth/components/guard-first-user.server.mjs";
|
|
5
5
|
import { createAuthProxy } from "../modules/auth/handler/proxy.server.mjs";
|
|
6
6
|
import { handleAuthRoute } from "../modules/auth/handler/route.server.mjs";
|
|
7
7
|
import { createUser, getSession, updateUser } from "../modules/auth/lib/helpers.server.mjs";
|
|
8
|
-
export {
|
|
8
|
+
export { Auth, AuthGuard, AuthLayout, CreateFirstUserPageGuard, authCookiePrefix, createAuthProxy, createUser, getSession, handleAuthRoute, updateUser };
|
package/dist/auth/server.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { AuthLayout } from "../modules/auth/components/auth-layout.server.mjs";
|
|
2
|
+
import { CreateFirstUserPageGuard } from "../modules/auth/components/create-first-user-guard.server.mjs";
|
|
2
3
|
import { createUser, getSession, updateUser } from "../modules/auth/lib/helpers.server.mjs";
|
|
3
4
|
import { AuthGuard } from "../modules/auth/components/guard.server.mjs";
|
|
4
|
-
import {
|
|
5
|
-
import { authCookiePrefix, initAuth } from "../modules/auth/handler/init.mjs";
|
|
5
|
+
import { Auth, authCookiePrefix } from "../modules/auth/handler/service.server.mjs";
|
|
6
6
|
import { createAuthProxy } from "../modules/auth/handler/proxy.server.mjs";
|
|
7
7
|
import { handleAuthRoute } from "../modules/auth/handler/route.server.mjs";
|
|
8
8
|
|
|
9
|
-
export {
|
|
9
|
+
export { Auth, AuthGuard, AuthLayout, CreateFirstUserPageGuard, authCookiePrefix, createAuthProxy, createUser, getSession, handleAuthRoute, updateUser };
|
|
@@ -4,7 +4,7 @@ import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
|
4
4
|
import { VariantProps } from "class-variance-authority";
|
|
5
5
|
import * as react from "react";
|
|
6
6
|
import { PropsWithChildren } from "react";
|
|
7
|
-
import { Content, Editor } from "@tiptap/react";
|
|
7
|
+
import { Content, Editor, EditorOptions } from "@tiptap/react";
|
|
8
8
|
import * as class_variance_authority_types0 from "class-variance-authority/types";
|
|
9
9
|
|
|
10
10
|
//#region src/components/editor/components/editor.client.d.ts
|
|
@@ -25,7 +25,7 @@ declare const editorVariants: (props?: ({
|
|
|
25
25
|
/**
|
|
26
26
|
* Editor context provider
|
|
27
27
|
*/
|
|
28
|
-
type EditorProps = VariantProps<typeof editorVariants> & PropsWithChildren<{
|
|
28
|
+
type EditorProps = VariantProps<typeof editorVariants> & Pick<EditorOptions["editorProps"], "attributes"> & PropsWithChildren<{
|
|
29
29
|
value?: Content;
|
|
30
30
|
extensions?: Partial<EditorExtensionsConfig>;
|
|
31
31
|
onUpdate?: (value: EditorJSONContent) => void;
|
|
@@ -41,7 +41,8 @@ declare function Editor$1({
|
|
|
41
41
|
disabled,
|
|
42
42
|
variant,
|
|
43
43
|
className,
|
|
44
|
-
children
|
|
44
|
+
children,
|
|
45
|
+
attributes
|
|
45
46
|
}: EditorProps): react_jsx_runtime0.JSX.Element | null;
|
|
46
47
|
//#endregion
|
|
47
48
|
export { Editor$1 as Editor, EditorContext, EditorProps, editorVariants };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editor.client.d.mts","names":[],"sources":["../../../../src/components/editor/components/editor.client.tsx"],"mappings":";;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"editor.client.d.mts","names":[],"sources":["../../../../src/components/editor/components/editor.client.tsx"],"mappings":";;;;;;;;;;;;;KAuBK,kBAAA;EACH,MAAA,EAAQ,MAAA;EACR,UAAA,EAAY,4BAAA;AAAA;AAAA,cAGD,aAAA,EAAa,KAAA,CAAA,OAAA,CAAA,kBAAA;;;;cAKb,cAAA,GAAc,KAAA;;IAazB,+BAAA,CAAA,SAAA;;AAlBF;;KAuBY,WAAA,GAAc,YAAA,QAAoB,cAAA,IAC5C,IAAA,CAAK,aAAA,iCACL,iBAAA;EACE,KAAA,GAAQ,OAAA;EACR,UAAA,GAAa,OAAA,CAAQ,sBAAA;EACrB,QAAA,IAAY,KAAA,EAAO,iBAAA;EACnB,MAAA,IAAU,KAAA,EAAO,iBAAA;EACjB,QAAA;EACA,SAAA;AAAA;AAAA,iBAGY,QAAA,CAAA;EACd,KAAA;EACA,UAAA;EACA,QAAA;EACA,MAAA;EACA,QAAA;EACA,OAAA;EACA,SAAA;EACA,QAAA;EACA;AAAA,GACC,WAAA,GAAW,kBAAA,CAAA,GAAA,CAAA,OAAA"}
|
|
@@ -21,7 +21,7 @@ const editorVariants = cva("", {
|
|
|
21
21
|
} },
|
|
22
22
|
defaultVariants: { variant: "default" }
|
|
23
23
|
});
|
|
24
|
-
function Editor$1({ value, extensions, onUpdate, onBlur, disabled, variant, className, children }) {
|
|
24
|
+
function Editor$1({ value, extensions, onUpdate, onBlur, disabled, variant, className, children, attributes }) {
|
|
25
25
|
const editor = useEditor({
|
|
26
26
|
extensions: editorExtensionsConfigToExtensions(extensions),
|
|
27
27
|
content: value,
|
|
@@ -32,7 +32,10 @@ function Editor$1({ value, extensions, onUpdate, onBlur, disabled, variant, clas
|
|
|
32
32
|
immediatelyRender: false,
|
|
33
33
|
editorProps: {
|
|
34
34
|
transformPastedHTML: (html) => html.replace(/<img.*?>/g, ""),
|
|
35
|
-
attributes: {
|
|
35
|
+
attributes: {
|
|
36
|
+
...attributes,
|
|
37
|
+
class: cn("editor-content text-sm max-w-full focus:outline-none", editorProseVariants(), editorImageVariants(), className)
|
|
38
|
+
}
|
|
36
39
|
}
|
|
37
40
|
});
|
|
38
41
|
if (!editor) return null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editor.client.mjs","names":["Editor"],"sources":["../../../../src/components/editor/components/editor.client.tsx"],"sourcesContent":["\"use client\";\n\nimport {
|
|
1
|
+
{"version":3,"file":"editor.client.mjs","names":["Editor"],"sources":["../../../../src/components/editor/components/editor.client.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n type Content,\n type Editor as TiptapEditor,\n type EditorOptions as TiptapEditorOptions,\n useEditor,\n} from \"@tiptap/react\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport { createContext, type PropsWithChildren } from \"react\";\nimport { cn } from \"@/lib/utils/cn\";\nimport {\n type EditorExtensionsConfig,\n type EditorExtensionsConfigResult,\n editorExtensionsConfigToExtensions,\n flattenEditorExtensionsConfig,\n} from \"../lib/extensions\";\nimport type { EditorJSONContent } from \"../lib/types\";\nimport { editorImageVariants, editorProseVariants } from \"../lib/variants\";\n\n/**\n * Editor context\n */\ntype EditorContextValue = {\n editor: TiptapEditor;\n extensions: EditorExtensionsConfigResult;\n};\n\nexport const EditorContext = createContext({} as EditorContextValue);\n\n/**\n * Editor variants\n */\nexport const editorVariants = cva(\"\", {\n variants: {\n variant: {\n default:\n \"border-input rounded-lg border [&_.editor-content]:p-3 [&_.editor-content[contenteditable='false']]:pointer-events-none [&_.editor-content[contenteditable='false']]:cursor-not-allowed [&_.editor-content[contenteditable='false']]:opacity-50\",\n table:\n \"[&_.editor-content[contenteditable='false']]:pointer-events-none [&_.editor-content[contenteditable='false']]:cursor-not-allowed [&_.editor-content[contenteditable='false']]:opacity-50\",\n preview: \"bg-transparent [&_.editor-content]:p-0 [&_.editor-content]:min-h-0\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n },\n});\n\n/**\n * Editor context provider\n */\nexport type EditorProps = VariantProps<typeof editorVariants> &\n Pick<TiptapEditorOptions[\"editorProps\"], \"attributes\"> &\n PropsWithChildren<{\n value?: Content;\n extensions?: Partial<EditorExtensionsConfig>;\n onUpdate?: (value: EditorJSONContent) => void;\n onBlur?: (value: EditorJSONContent) => void;\n disabled?: boolean;\n className?: string;\n }>;\n\nexport function Editor({\n value,\n extensions,\n onUpdate,\n onBlur,\n disabled,\n variant,\n className,\n children,\n attributes,\n}: EditorProps) {\n const editor = useEditor({\n extensions: editorExtensionsConfigToExtensions(extensions),\n content: value,\n onUpdate: ({ editor }) => onUpdate?.(editor.getJSON()),\n onBlur: ({ editor }) => onBlur?.(editor.getJSON()),\n editable: !disabled,\n injectCSS: false,\n immediatelyRender: false,\n editorProps: {\n transformPastedHTML: (html) => html.replace(/<img.*?>/g, \"\"),\n attributes: {\n ...attributes,\n class: cn(\n \"editor-content text-sm max-w-full focus:outline-none\",\n editorProseVariants(),\n editorImageVariants(),\n className,\n ),\n },\n },\n });\n\n if (!editor) return null;\n\n return (\n <EditorContext.Provider\n value={{\n editor,\n extensions: flattenEditorExtensionsConfig(extensions),\n }}\n >\n <div className={editorVariants({ variant })}>{children}</div>\n </EditorContext.Provider>\n );\n}\n"],"mappings":";;;;;;;;;;;AA4BA,MAAa,gBAAgB,cAAc,EAAE,CAAuB;;;;AAKpE,MAAa,iBAAiB,IAAI,IAAI;CACpC,UAAU,EACR,SAAS;EACP,SACE;EACF,OACE;EACF,SAAS;EACV,EACF;CACD,iBAAiB,EACf,SAAS,WACV;CACF,CAAC;AAgBF,SAAgBA,SAAO,EACrB,OACA,YACA,UACA,QACA,UACA,SACA,WACA,UACA,cACc;CACd,MAAM,SAAS,UAAU;EACvB,YAAY,mCAAmC,WAAW;EAC1D,SAAS;EACT,WAAW,EAAE,aAAa,WAAW,OAAO,SAAS,CAAC;EACtD,SAAS,EAAE,aAAa,SAAS,OAAO,SAAS,CAAC;EAClD,UAAU,CAAC;EACX,WAAW;EACX,mBAAmB;EACnB,aAAa;GACX,sBAAsB,SAAS,KAAK,QAAQ,aAAa,GAAG;GAC5D,YAAY;IACV,GAAG;IACH,OAAO,GACL,wDACA,qBAAqB,EACrB,qBAAqB,EACrB,UACD;IACF;GACF;EACF,CAAC;AAEF,KAAI,CAAC,OAAQ,QAAO;AAEpB,QACE,oBAAC,cAAc;EACb,OAAO;GACL;GACA,YAAY,8BAA8B,WAAW;GACtD;YAED,oBAAC;GAAI,WAAW,eAAe,EAAE,SAAS,CAAC;GAAG;IAAe;GACtC"}
|
|
@@ -5,16 +5,16 @@ import "@tiptap/core";
|
|
|
5
5
|
interface FileHandlerOptions$1 extends FileHandlerOptions {
|
|
6
6
|
/**
|
|
7
7
|
* Callback function invoked when a image reference is removed from the editor. Receives the node ID of the removed node.
|
|
8
|
-
* @type {(
|
|
8
|
+
* @type {(assetId: string) => void}
|
|
9
9
|
* @default undefined
|
|
10
10
|
**/
|
|
11
|
-
onReferenceRemoved?: (
|
|
11
|
+
onReferenceRemoved?: (assetId: string) => void;
|
|
12
12
|
/**
|
|
13
13
|
* Callback function invoked when a image reference is added to the editor. Receives the node ID of the added node.
|
|
14
|
-
* @type {(
|
|
14
|
+
* @type {(assetId: string) => void}
|
|
15
15
|
* @default undefined
|
|
16
16
|
**/
|
|
17
|
-
onReferenceAdded?: (
|
|
17
|
+
onReferenceAdded?: (assetId: string) => void;
|
|
18
18
|
}
|
|
19
19
|
//#endregion
|
|
20
20
|
export { FileHandlerOptions$1 as FileHandlerOptions };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extension.d.mts","names":[],"sources":["../../../../../src/components/editor/extensions/file-handler/extension.ts"],"mappings":";;;;UASiB,oBAAA,SAA2B,kBAAA;;;AAA5C;;;EAME,kBAAA,IAAsB,
|
|
1
|
+
{"version":3,"file":"extension.d.mts","names":[],"sources":["../../../../../src/components/editor/extensions/file-handler/extension.ts"],"mappings":";;;;UASiB,oBAAA,SAA2B,kBAAA;;;AAA5C;;;EAME,kBAAA,IAAsB,OAAA;EANoB;;;;;EAa1C,gBAAA,IAAoB,OAAA;AAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extension.mjs","names":["FileHandler","TiptapFileHandler"],"sources":["../../../../../src/components/editor/extensions/file-handler/extension.ts"],"sourcesContent":["\"use client\";\n\nimport {\n FileHandler as TiptapFileHandler,\n type FileHandlerOptions as TiptapFileHandlerOptions,\n} from \"@tiptap/extension-file-handler\";\nimport { Plugin, PluginKey } from \"@tiptap/pm/state\";\nimport { collectImageIds, diffIds } from \"./utils\";\n\nexport interface FileHandlerOptions extends TiptapFileHandlerOptions {\n /**\n * Callback function invoked when a image reference is removed from the editor. Receives the node ID of the removed node.\n * @type {(
|
|
1
|
+
{"version":3,"file":"extension.mjs","names":["FileHandler","TiptapFileHandler"],"sources":["../../../../../src/components/editor/extensions/file-handler/extension.ts"],"sourcesContent":["\"use client\";\n\nimport {\n FileHandler as TiptapFileHandler,\n type FileHandlerOptions as TiptapFileHandlerOptions,\n} from \"@tiptap/extension-file-handler\";\nimport { Plugin, PluginKey } from \"@tiptap/pm/state\";\nimport { collectImageIds, diffIds } from \"./utils\";\n\nexport interface FileHandlerOptions extends TiptapFileHandlerOptions {\n /**\n * Callback function invoked when a image reference is removed from the editor. Receives the node ID of the removed node.\n * @type {(assetId: string) => void}\n * @default undefined\n **/\n onReferenceRemoved?: (assetId: string) => void;\n\n /**\n * Callback function invoked when a image reference is added to the editor. Receives the node ID of the added node.\n * @type {(assetId: string) => void}\n * @default undefined\n **/\n onReferenceAdded?: (assetId: string) => void;\n}\n\n/**\n * File Handler extension for Tiptap Editor\n */\nexport const FileHandler = TiptapFileHandler.extend<FileHandlerOptions>({\n addOptions() {\n return {\n ...this.parent?.(),\n onReferenceRemoved: undefined,\n onReferenceAdded: undefined,\n };\n },\n addProseMirrorPlugins() {\n const parent = this.parent?.() ?? [];\n const key = new PluginKey(\"fileHandlerItemTracker\");\n\n return [\n ...parent,\n new Plugin({\n key,\n appendTransaction: (trs, oldState, newState) => {\n if (!trs.some((tr) => tr.docChanged)) return null;\n\n const onReferenceRemoved = this.options.onReferenceRemoved;\n const onReferenceAdded = this.options.onReferenceAdded;\n if (!onReferenceRemoved && !onReferenceAdded) return null;\n\n const before = collectImageIds(oldState.doc);\n const after = collectImageIds(newState.doc);\n const { removed, added } = diffIds(before, after);\n\n for (const id of removed) {\n onReferenceRemoved?.(id);\n }\n\n for (const id of added) {\n onReferenceAdded?.(id);\n }\n\n return null;\n },\n }),\n ];\n },\n});\n"],"mappings":";;;;;;;;;;AA4BA,MAAaA,gBAAcC,YAAkB,OAA2B;CACtE,aAAa;AACX,SAAO;GACL,GAAG,KAAK,UAAU;GAClB,oBAAoB;GACpB,kBAAkB;GACnB;;CAEH,wBAAwB;EACtB,MAAM,SAAS,KAAK,UAAU,IAAI,EAAE;EACpC,MAAM,MAAM,IAAI,UAAU,yBAAyB;AAEnD,SAAO,CACL,GAAG,QACH,IAAI,OAAO;GACT;GACA,oBAAoB,KAAK,UAAU,aAAa;AAC9C,QAAI,CAAC,IAAI,MAAM,OAAO,GAAG,WAAW,CAAE,QAAO;IAE7C,MAAM,qBAAqB,KAAK,QAAQ;IACxC,MAAM,mBAAmB,KAAK,QAAQ;AACtC,QAAI,CAAC,sBAAsB,CAAC,iBAAkB,QAAO;IAIrD,MAAM,EAAE,SAAS,UAAU,QAFZ,gBAAgB,SAAS,IAAI,EAC9B,gBAAgB,SAAS,IAAI,CACM;AAEjD,SAAK,MAAM,MAAM,QACf,sBAAqB,GAAG;AAG1B,SAAK,MAAM,MAAM,MACf,oBAAmB,GAAG;AAGxB,WAAO;;GAEV,CAAC,CACH;;CAEJ,CAAC"}
|
|
@@ -1,19 +1,17 @@
|
|
|
1
1
|
import { FileHandlerOptions } from "./extension.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import "../../../../storage.mjs";
|
|
4
|
-
import { UploadClient, UploadHooks } from "../../../../modules/storage/lib/create-upload.client.mjs";
|
|
5
|
-
import "../../../../storage/client.mjs";
|
|
2
|
+
import { PresignUploadInput, StorageAsset } from "../../../../modules/storage/lib/validators.mjs";
|
|
3
|
+
import { UploadClient, UploadHooks } from "../../../../modules/storage/lib/upload.client.mjs";
|
|
6
4
|
|
|
7
5
|
//#region src/components/editor/extensions/file-handler/strategy.d.ts
|
|
8
6
|
/**
|
|
9
7
|
* Handle File Handler props
|
|
10
8
|
*/
|
|
11
9
|
type CreateFileHandlerUploadStrategyProps = {
|
|
12
|
-
variables: Pick<
|
|
10
|
+
variables: Pick<PresignUploadInput, "visibility" | "metadata">;
|
|
13
11
|
uploadClient: UploadClient;
|
|
14
12
|
uploadHooks?: UploadHooks;
|
|
15
13
|
allowedMimeTypes?: string[];
|
|
16
|
-
onUploadCompleted?: (
|
|
14
|
+
onUploadCompleted?: (asset: StorageAsset) => Promise<void> | void;
|
|
17
15
|
onUploadFailed?: (error: unknown) => Promise<void> | void;
|
|
18
16
|
};
|
|
19
17
|
declare function createFileHandlerUploadStrategy({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"strategy.d.mts","names":[],"sources":["../../../../../src/components/editor/extensions/file-handler/strategy.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"strategy.d.mts","names":[],"sources":["../../../../../src/components/editor/extensions/file-handler/strategy.ts"],"mappings":";;;;;;;AAIsD;KAKjD,oCAAA;EACH,SAAA,EAAW,IAAA,CAAK,kBAAA;EAChB,YAAA,EAAc,YAAA;EACd,WAAA,GAAc,WAAA;EACd,gBAAA;EACA,iBAAA,IAAqB,KAAA,EAAO,YAAA,KAAiB,OAAA;EAC7C,cAAA,IAAkB,KAAA,cAAmB,OAAA;AAAA;AAAA,iBAGvB,+BAAA,CAAA;EACd,SAAA;EACA,YAAA;EACA,WAAA;EACA,iBAAA;EACA,cAAA;EACA;AAAA,GACC,oCAAA,GAAuC,kBAAA"}
|
|
@@ -22,7 +22,7 @@ function createFileHandlerUploadStrategy({ variables, uploadClient, uploadHooks,
|
|
|
22
22
|
* Create skeleton node
|
|
23
23
|
*/
|
|
24
24
|
const skeletonNode = editor.schema.nodes.skeleton?.create({
|
|
25
|
-
imageNodeId: input.
|
|
25
|
+
imageNodeId: input.uploadId,
|
|
26
26
|
width: 500,
|
|
27
27
|
height: 500
|
|
28
28
|
});
|
|
@@ -38,16 +38,16 @@ function createFileHandlerUploadStrategy({ variables, uploadClient, uploadHooks,
|
|
|
38
38
|
/**
|
|
39
39
|
* Upload the file
|
|
40
40
|
*/
|
|
41
|
-
const
|
|
41
|
+
const asset = await uploadClient.upload(input, uploadHooks);
|
|
42
42
|
/**
|
|
43
43
|
* Replace skeleton with image node
|
|
44
44
|
*/
|
|
45
45
|
const replacedTr = editor.state.tr;
|
|
46
46
|
let replaced = false;
|
|
47
47
|
replacedTr.doc.descendants((node, pos) => {
|
|
48
|
-
if (node.type.name === "skeleton" && node.attrs?.imageNodeId === input.
|
|
48
|
+
if (node.type.name === "skeleton" && node.attrs?.imageNodeId === input.uploadId) {
|
|
49
49
|
const imageNode = imageType.create({
|
|
50
|
-
|
|
50
|
+
assetId: asset.id,
|
|
51
51
|
alt: file.name,
|
|
52
52
|
fileName: file.name,
|
|
53
53
|
width: node.attrs.width ?? 500
|
|
@@ -61,7 +61,7 @@ function createFileHandlerUploadStrategy({ variables, uploadClient, uploadHooks,
|
|
|
61
61
|
else {
|
|
62
62
|
const tr = editor.state.tr;
|
|
63
63
|
const imageNode = imageType.create({
|
|
64
|
-
|
|
64
|
+
assetId: asset.id,
|
|
65
65
|
alt: file.name,
|
|
66
66
|
fileName: file.name,
|
|
67
67
|
width: 500
|
|
@@ -69,7 +69,7 @@ function createFileHandlerUploadStrategy({ variables, uploadClient, uploadHooks,
|
|
|
69
69
|
tr.insert(insertPos, imageNode);
|
|
70
70
|
editor.view.dispatch(tr);
|
|
71
71
|
}
|
|
72
|
-
await onUploadCompleted?.(
|
|
72
|
+
await onUploadCompleted?.(asset);
|
|
73
73
|
} catch (err) {
|
|
74
74
|
console.error("Upload error:", err);
|
|
75
75
|
/**
|
|
@@ -77,7 +77,7 @@ function createFileHandlerUploadStrategy({ variables, uploadClient, uploadHooks,
|
|
|
77
77
|
*/
|
|
78
78
|
const tr = editor.state.tr;
|
|
79
79
|
tr.doc.descendants((node, pos) => {
|
|
80
|
-
if (node.type.name === "
|
|
80
|
+
if (node.type.name === "skeleton" && node.attrs?.imageNodeId === input.uploadId) {
|
|
81
81
|
tr.delete(pos, pos + node.nodeSize);
|
|
82
82
|
return false;
|
|
83
83
|
}
|
|
@@ -97,11 +97,11 @@ function createFileHandlerUploadStrategy({ variables, uploadClient, uploadHooks,
|
|
|
97
97
|
const startPos = editor.state.selection.anchor;
|
|
98
98
|
await handleUpload(editor, files, startPos);
|
|
99
99
|
},
|
|
100
|
-
onReferenceRemoved: async (
|
|
101
|
-
await uploadClient.
|
|
100
|
+
onReferenceRemoved: async (assetId) => {
|
|
101
|
+
await uploadClient.deleteAsset(assetId);
|
|
102
102
|
},
|
|
103
|
-
onReferenceAdded: async (
|
|
104
|
-
await uploadClient.
|
|
103
|
+
onReferenceAdded: async (assetId) => {
|
|
104
|
+
await uploadClient.restoreAsset(assetId);
|
|
105
105
|
}
|
|
106
106
|
};
|
|
107
107
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"strategy.mjs","names":[],"sources":["../../../../../src/components/editor/extensions/file-handler/strategy.ts"],"sourcesContent":["import type { Editor } from \"@tiptap/core\";\nimport { TextSelection } from \"@tiptap/pm/state\";\nimport type {
|
|
1
|
+
{"version":3,"file":"strategy.mjs","names":[],"sources":["../../../../../src/components/editor/extensions/file-handler/strategy.ts"],"sourcesContent":["import type { Editor } from \"@tiptap/core\";\nimport { TextSelection } from \"@tiptap/pm/state\";\nimport type { UploadClient, UploadHooks } from \"@/modules/storage/lib/upload.client\";\nimport type { PresignUploadInput, StorageAsset } from \"@/modules/storage/lib/validators\";\nimport type { FileHandlerOptions } from \"./extension\";\n\n/**\n * Handle File Handler props\n */\ntype CreateFileHandlerUploadStrategyProps = {\n variables: Pick<PresignUploadInput, \"visibility\" | \"metadata\">;\n uploadClient: UploadClient;\n uploadHooks?: UploadHooks;\n allowedMimeTypes?: string[];\n onUploadCompleted?: (asset: StorageAsset) => Promise<void> | void;\n onUploadFailed?: (error: unknown) => Promise<void> | void;\n};\n\nexport function createFileHandlerUploadStrategy({\n variables,\n uploadClient,\n uploadHooks,\n onUploadCompleted,\n onUploadFailed,\n allowedMimeTypes,\n}: CreateFileHandlerUploadStrategyProps): FileHandlerOptions {\n const handleUpload = async (editor: Editor, files: File[], startPos: number) => {\n const insertPos = startPos;\n\n for (const file of files) {\n /**\n * Prepare upload\n */\n const input = uploadClient.prepareUpload({ file, ...variables });\n\n const imageType = editor.schema.nodes.image;\n if (!imageType) {\n console.error(\"Image type not found\");\n return;\n }\n\n try {\n /**\n * Create skeleton node\n */\n const skeletonNode = editor.schema.nodes.skeleton?.create({\n imageNodeId: input.uploadId,\n width: 500,\n height: 500,\n });\n\n /**\n * Insert skeleton node into the document\n */\n if (skeletonNode) {\n const tr = editor.state.tr.insert(insertPos, skeletonNode);\n tr.setSelection(TextSelection.create(tr.doc, insertPos + skeletonNode.nodeSize));\n tr.setMeta(\"addToHistory\", false);\n editor.view.dispatch(tr);\n }\n\n /**\n * Upload the file\n */\n const asset = await uploadClient.upload(input, uploadHooks);\n\n /**\n * Replace skeleton with image node\n */\n const replacedTr = editor.state.tr;\n let replaced = false;\n\n replacedTr.doc.descendants((node, pos) => {\n if (node.type.name === \"skeleton\" && node.attrs?.imageNodeId === input.uploadId) {\n const imageNode = imageType.create({\n assetId: asset.id,\n alt: file.name,\n fileName: file.name,\n width: node.attrs.width ?? 500,\n });\n\n replacedTr.replaceWith(pos, pos + node.nodeSize, imageNode);\n replaced = true;\n return false;\n }\n });\n\n if (replaced) {\n editor.view.dispatch(replacedTr);\n } else {\n // In case skeleton is not found, insert the image node at the original position\n const tr = editor.state.tr;\n const imageNode = imageType.create({\n assetId: asset.id,\n alt: file.name,\n fileName: file.name,\n width: 500,\n });\n tr.insert(insertPos, imageNode);\n editor.view.dispatch(tr);\n }\n\n await onUploadCompleted?.(asset);\n } catch (err) {\n console.error(\"Upload error:\", err);\n\n /**\n * Remove the pending image node from the document\n */\n const tr = editor.state.tr;\n tr.doc.descendants((node, pos) => {\n if (node.type.name === \"skeleton\" && node.attrs?.imageNodeId === input.uploadId) {\n tr.delete(pos, pos + node.nodeSize);\n return false;\n }\n });\n editor.view.dispatch(tr);\n\n await onUploadFailed?.(err);\n }\n }\n };\n\n return {\n allowedMimeTypes,\n onDrop: async (editor, files, pos) => {\n await handleUpload(editor, files, pos);\n },\n onPaste: async (editor, files, htmlContent) => {\n if (htmlContent?.length) return;\n\n const startPos = editor.state.selection.anchor;\n await handleUpload(editor, files, startPos);\n },\n onReferenceRemoved: async (assetId) => {\n await uploadClient.deleteAsset(assetId);\n },\n onReferenceAdded: async (assetId) => {\n await uploadClient.restoreAsset(assetId);\n },\n };\n}\n"],"mappings":";;;AAkBA,SAAgB,gCAAgC,EAC9C,WACA,cACA,aACA,mBACA,gBACA,oBAC2D;CAC3D,MAAM,eAAe,OAAO,QAAgB,OAAe,aAAqB;EAC9E,MAAM,YAAY;AAElB,OAAK,MAAM,QAAQ,OAAO;;;;GAIxB,MAAM,QAAQ,aAAa,cAAc;IAAE;IAAM,GAAG;IAAW,CAAC;GAEhE,MAAM,YAAY,OAAO,OAAO,MAAM;AACtC,OAAI,CAAC,WAAW;AACd,YAAQ,MAAM,uBAAuB;AACrC;;AAGF,OAAI;;;;IAIF,MAAM,eAAe,OAAO,OAAO,MAAM,UAAU,OAAO;KACxD,aAAa,MAAM;KACnB,OAAO;KACP,QAAQ;KACT,CAAC;;;;AAKF,QAAI,cAAc;KAChB,MAAM,KAAK,OAAO,MAAM,GAAG,OAAO,WAAW,aAAa;AAC1D,QAAG,aAAa,cAAc,OAAO,GAAG,KAAK,YAAY,aAAa,SAAS,CAAC;AAChF,QAAG,QAAQ,gBAAgB,MAAM;AACjC,YAAO,KAAK,SAAS,GAAG;;;;;IAM1B,MAAM,QAAQ,MAAM,aAAa,OAAO,OAAO,YAAY;;;;IAK3D,MAAM,aAAa,OAAO,MAAM;IAChC,IAAI,WAAW;AAEf,eAAW,IAAI,aAAa,MAAM,QAAQ;AACxC,SAAI,KAAK,KAAK,SAAS,cAAc,KAAK,OAAO,gBAAgB,MAAM,UAAU;MAC/E,MAAM,YAAY,UAAU,OAAO;OACjC,SAAS,MAAM;OACf,KAAK,KAAK;OACV,UAAU,KAAK;OACf,OAAO,KAAK,MAAM,SAAS;OAC5B,CAAC;AAEF,iBAAW,YAAY,KAAK,MAAM,KAAK,UAAU,UAAU;AAC3D,iBAAW;AACX,aAAO;;MAET;AAEF,QAAI,SACF,QAAO,KAAK,SAAS,WAAW;SAC3B;KAEL,MAAM,KAAK,OAAO,MAAM;KACxB,MAAM,YAAY,UAAU,OAAO;MACjC,SAAS,MAAM;MACf,KAAK,KAAK;MACV,UAAU,KAAK;MACf,OAAO;MACR,CAAC;AACF,QAAG,OAAO,WAAW,UAAU;AAC/B,YAAO,KAAK,SAAS,GAAG;;AAG1B,UAAM,oBAAoB,MAAM;YACzB,KAAK;AACZ,YAAQ,MAAM,iBAAiB,IAAI;;;;IAKnC,MAAM,KAAK,OAAO,MAAM;AACxB,OAAG,IAAI,aAAa,MAAM,QAAQ;AAChC,SAAI,KAAK,KAAK,SAAS,cAAc,KAAK,OAAO,gBAAgB,MAAM,UAAU;AAC/E,SAAG,OAAO,KAAK,MAAM,KAAK,SAAS;AACnC,aAAO;;MAET;AACF,WAAO,KAAK,SAAS,GAAG;AAExB,UAAM,iBAAiB,IAAI;;;;AAKjC,QAAO;EACL;EACA,QAAQ,OAAO,QAAQ,OAAO,QAAQ;AACpC,SAAM,aAAa,QAAQ,OAAO,IAAI;;EAExC,SAAS,OAAO,QAAQ,OAAO,gBAAgB;AAC7C,OAAI,aAAa,OAAQ;GAEzB,MAAM,WAAW,OAAO,MAAM,UAAU;AACxC,SAAM,aAAa,QAAQ,OAAO,SAAS;;EAE7C,oBAAoB,OAAO,YAAY;AACrC,SAAM,aAAa,YAAY,QAAQ;;EAEzC,kBAAkB,OAAO,YAAY;AACnC,SAAM,aAAa,aAAa,QAAQ;;EAE3C"}
|
|
@@ -15,7 +15,7 @@ function collectImageIds(doc) {
|
|
|
15
15
|
const counts = /* @__PURE__ */ new Map();
|
|
16
16
|
doc.descendants((node) => {
|
|
17
17
|
if (node.type.name !== "image") return;
|
|
18
|
-
const id = node.attrs?.
|
|
18
|
+
const id = node.attrs?.assetId;
|
|
19
19
|
if (!id) return;
|
|
20
20
|
counts.set(id, (counts.get(id) ?? 0) + 1);
|
|
21
21
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.mjs","names":[],"sources":["../../../../../src/components/editor/extensions/file-handler/utils.ts"],"sourcesContent":["import type { Node } from \"@tiptap/pm/model\";\n\n/**\n * Collects and counts all image node IDs from a document.\n *\n * @param doc - The document node to traverse and analyze\n * @returns A Map where keys are image node IDs and values are their occurrence counts\n *\n * @example\n * const imageCounts = collectImageIds(editorDoc);\n * imageCounts.forEach((count, imageId) => {\n * console.info(`Image ${imageId} appears ${count} times`);\n * });\n */\nexport function collectImageIds(doc: Node): Map<string, number> {\n const counts = new Map<string, number>();\n\n doc.descendants((node) => {\n if (node.type.name !== \"image\") return;\n\n const id = node.attrs?.
|
|
1
|
+
{"version":3,"file":"utils.mjs","names":[],"sources":["../../../../../src/components/editor/extensions/file-handler/utils.ts"],"sourcesContent":["import type { Node } from \"@tiptap/pm/model\";\n\n/**\n * Collects and counts all image node IDs from a document.\n *\n * @param doc - The document node to traverse and analyze\n * @returns A Map where keys are image node IDs and values are their occurrence counts\n *\n * @example\n * const imageCounts = collectImageIds(editorDoc);\n * imageCounts.forEach((count, imageId) => {\n * console.info(`Image ${imageId} appears ${count} times`);\n * });\n */\nexport function collectImageIds(doc: Node): Map<string, number> {\n const counts = new Map<string, number>();\n\n doc.descendants((node) => {\n if (node.type.name !== \"image\") return;\n\n const id = node.attrs?.assetId;\n if (!id) return;\n\n counts.set(id, (counts.get(id) ?? 0) + 1);\n });\n\n return counts;\n}\n\n/**\n * Compares two maps of string keys to numeric values and identifies which keys have been removed or restored.\n * @param before - A Map containing the previous state of string keys with their associated numeric values\n * @param after - A Map containing the current state of string keys with their associated numeric values\n * @returns An object containing two arrays:\n * - `removed`: Array of keys where the numeric value decreased (or was deleted)\n * - `restored`: Array of keys where the numeric value increased\n */\nexport function diffIds(before: Map<string, number>, after: Map<string, number>) {\n const removed: string[] = [];\n const added: string[] = [];\n\n const keys = new Set([...before.keys(), ...after.keys()]);\n\n for (const key of keys) {\n const b = before.get(key) ?? 0;\n const a = after.get(key) ?? 0;\n\n if (a < b) removed.push(key);\n if (a > b) added.push(key);\n }\n\n return { removed, added };\n}\n"],"mappings":";;;;;;;;;;;;;AAcA,SAAgB,gBAAgB,KAAgC;CAC9D,MAAM,yBAAS,IAAI,KAAqB;AAExC,KAAI,aAAa,SAAS;AACxB,MAAI,KAAK,KAAK,SAAS,QAAS;EAEhC,MAAM,KAAK,KAAK,OAAO;AACvB,MAAI,CAAC,GAAI;AAET,SAAO,IAAI,KAAK,OAAO,IAAI,GAAG,IAAI,KAAK,EAAE;GACzC;AAEF,QAAO;;;;;;;;;;AAWT,SAAgB,QAAQ,QAA6B,OAA4B;CAC/E,MAAM,UAAoB,EAAE;CAC5B,MAAM,QAAkB,EAAE;CAE1B,MAAM,OAAO,IAAI,IAAI,CAAC,GAAG,OAAO,MAAM,EAAE,GAAG,MAAM,MAAM,CAAC,CAAC;AAEzD,MAAK,MAAM,OAAO,MAAM;EACtB,MAAM,IAAI,OAAO,IAAI,IAAI,IAAI;EAC7B,MAAM,IAAI,MAAM,IAAI,IAAI,IAAI;AAE5B,MAAI,IAAI,EAAG,SAAQ,KAAK,IAAI;AAC5B,MAAI,IAAI,EAAG,OAAM,KAAK,IAAI;;AAG5B,QAAO;EAAE;EAAS;EAAO"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { getAssetURL } from "../../../../modules/storage/lib/helpers.mjs";
|
|
4
4
|
import { Image } from "@tiptap/extension-image";
|
|
5
5
|
|
|
6
6
|
//#region src/components/editor/extensions/image/extension.ts
|
|
@@ -9,14 +9,14 @@ const Image$1 = Image.extend({
|
|
|
9
9
|
addAttributes() {
|
|
10
10
|
return {
|
|
11
11
|
...this.parent?.(),
|
|
12
|
-
|
|
12
|
+
assetId: {
|
|
13
13
|
default: null,
|
|
14
|
-
parseHTML: (el) => el.getAttribute("data-
|
|
14
|
+
parseHTML: (el) => el.getAttribute("data-asset-id"),
|
|
15
15
|
renderHTML: (attrs) => {
|
|
16
|
-
if (!attrs.
|
|
16
|
+
if (!attrs.assetId) return {};
|
|
17
17
|
return {
|
|
18
|
-
"data-
|
|
19
|
-
...attrs.
|
|
18
|
+
"data-asset-id": attrs.assetId,
|
|
19
|
+
...attrs.assetId && !attrs.isPending ? { src: getAssetURL(attrs.assetId) } : {}
|
|
20
20
|
};
|
|
21
21
|
}
|
|
22
22
|
},
|
|
@@ -32,13 +32,13 @@ const Image$1 = Image.extend({
|
|
|
32
32
|
};
|
|
33
33
|
},
|
|
34
34
|
parseHTML() {
|
|
35
|
-
return [{ tag: "img[data-
|
|
35
|
+
return [{ tag: "img[data-asset-id]" }];
|
|
36
36
|
},
|
|
37
37
|
renderHTML({ HTMLAttributes }) {
|
|
38
38
|
const { src: _, ...attrs } = HTMLAttributes;
|
|
39
|
-
const
|
|
39
|
+
const assetId = attrs.assetId;
|
|
40
40
|
const isPending = Boolean(attrs.isPending);
|
|
41
|
-
const src =
|
|
41
|
+
const src = assetId && !isPending ? getAssetURL(assetId) : null;
|
|
42
42
|
return ["img", {
|
|
43
43
|
...attrs,
|
|
44
44
|
...src ? { src } : {}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extension.mjs","names":["Image","TiptapImage"],"sources":["../../../../../src/components/editor/extensions/image/extension.ts"],"sourcesContent":["\"use client\";\n\nimport {\n Image as TiptapImage,\n type ImageOptions as TiptapImageOptions,\n} from \"@tiptap/extension-image\";\nimport {
|
|
1
|
+
{"version":3,"file":"extension.mjs","names":["Image","TiptapImage"],"sources":["../../../../../src/components/editor/extensions/image/extension.ts"],"sourcesContent":["\"use client\";\n\nimport {\n Image as TiptapImage,\n type ImageOptions as TiptapImageOptions,\n} from \"@tiptap/extension-image\";\nimport { getAssetURL } from \"@/modules/storage/entry\";\n\nexport interface ImageOptions extends TiptapImageOptions {}\n\nexport const Image = TiptapImage.extend<ImageOptions>({\n atom: true,\n addAttributes() {\n return {\n ...this.parent?.(),\n // asset id\n assetId: {\n default: null,\n parseHTML: (el) => el.getAttribute(\"data-asset-id\"),\n renderHTML: (attrs) => {\n if (!attrs.assetId) return {};\n return {\n \"data-asset-id\": attrs.assetId,\n ...(attrs.assetId && !attrs.isPending ? { src: getAssetURL(attrs.assetId) } : {}),\n };\n },\n },\n\n // semantics\n alt: { default: null },\n title: { default: null },\n\n // layout stability\n width: { default: null },\n height: { default: null },\n\n // upload UX\n isPending: {\n default: false,\n renderHTML: (attrs) => (attrs.isPending ? { \"data-pending\": \"true\" } : {}),\n },\n fileName: { default: null },\n };\n },\n parseHTML() {\n return [{ tag: \"img[data-asset-id]\" }];\n },\n renderHTML({ HTMLAttributes }) {\n const { src: _, ...attrs } = HTMLAttributes;\n\n const assetId = attrs.assetId as string | null;\n const isPending = Boolean(attrs.isPending);\n\n const src = assetId && !isPending ? getAssetURL(assetId) : null;\n\n return [\"img\", { ...attrs, ...(src ? { src } : {}) }];\n },\n});\n"],"mappings":";;;;;;AAUA,MAAaA,UAAQC,MAAY,OAAqB;CACpD,MAAM;CACN,gBAAgB;AACd,SAAO;GACL,GAAG,KAAK,UAAU;GAElB,SAAS;IACP,SAAS;IACT,YAAY,OAAO,GAAG,aAAa,gBAAgB;IACnD,aAAa,UAAU;AACrB,SAAI,CAAC,MAAM,QAAS,QAAO,EAAE;AAC7B,YAAO;MACL,iBAAiB,MAAM;MACvB,GAAI,MAAM,WAAW,CAAC,MAAM,YAAY,EAAE,KAAK,YAAY,MAAM,QAAQ,EAAE,GAAG,EAAE;MACjF;;IAEJ;GAGD,KAAK,EAAE,SAAS,MAAM;GACtB,OAAO,EAAE,SAAS,MAAM;GAGxB,OAAO,EAAE,SAAS,MAAM;GACxB,QAAQ,EAAE,SAAS,MAAM;GAGzB,WAAW;IACT,SAAS;IACT,aAAa,UAAW,MAAM,YAAY,EAAE,gBAAgB,QAAQ,GAAG,EAAE;IAC1E;GACD,UAAU,EAAE,SAAS,MAAM;GAC5B;;CAEH,YAAY;AACV,SAAO,CAAC,EAAE,KAAK,sBAAsB,CAAC;;CAExC,WAAW,EAAE,kBAAkB;EAC7B,MAAM,EAAE,KAAK,GAAG,GAAG,UAAU;EAE7B,MAAM,UAAU,MAAM;EACtB,MAAM,YAAY,QAAQ,MAAM,UAAU;EAE1C,MAAM,MAAM,WAAW,CAAC,YAAY,YAAY,QAAQ,GAAG;AAE3D,SAAO,CAAC,OAAO;GAAE,GAAG;GAAO,GAAI,MAAM,EAAE,KAAK,GAAG,EAAE;GAAG,CAAC;;CAExD,CAAC"}
|
|
@@ -11,9 +11,9 @@ import * as _tiptap_extension_list0 from "@tiptap/extension-list";
|
|
|
11
11
|
import * as _tiptap_extension_paragraph0 from "@tiptap/extension-paragraph";
|
|
12
12
|
import * as _tiptap_extension_strike0 from "@tiptap/extension-strike";
|
|
13
13
|
import * as _tiptap_extension_underline0 from "@tiptap/extension-underline";
|
|
14
|
-
import * as _tiptap_extensions0 from "@tiptap/extensions";
|
|
15
14
|
import * as _tiptap_extension_highlight0 from "@tiptap/extension-highlight";
|
|
16
15
|
import * as _tiptap_extension_text_style0 from "@tiptap/extension-text-style";
|
|
16
|
+
import * as _tiptap_extensions0 from "@tiptap/extensions";
|
|
17
17
|
import * as _tiptap_core0 from "@tiptap/core";
|
|
18
18
|
|
|
19
19
|
//#region src/components/editor/lib/constants.d.ts
|
|
@@ -15,9 +15,9 @@ import Paragraph from "@tiptap/extension-paragraph";
|
|
|
15
15
|
import Strike from "@tiptap/extension-strike";
|
|
16
16
|
import Text from "@tiptap/extension-text";
|
|
17
17
|
import Underline from "@tiptap/extension-underline";
|
|
18
|
-
import { Dropcursor, Gapcursor, TrailingNode, UndoRedo } from "@tiptap/extensions";
|
|
19
18
|
import Highlight from "@tiptap/extension-highlight";
|
|
20
19
|
import { Color, TextStyle } from "@tiptap/extension-text-style";
|
|
20
|
+
import { Dropcursor, Gapcursor, TrailingNode, UndoRedo } from "@tiptap/extensions";
|
|
21
21
|
|
|
22
22
|
//#region src/components/editor/lib/constants.ts
|
|
23
23
|
/**
|
|
@@ -12,10 +12,10 @@ import { BulletListOptions, ListItemOptions, ListKeymapOptions, OrderedListOptio
|
|
|
12
12
|
import { ParagraphOptions } from "@tiptap/extension-paragraph";
|
|
13
13
|
import { StrikeOptions } from "@tiptap/extension-strike";
|
|
14
14
|
import { UnderlineOptions } from "@tiptap/extension-underline";
|
|
15
|
-
import { DropcursorOptions, TrailingNodeOptions, UndoRedoOptions } from "@tiptap/extensions";
|
|
16
15
|
import "@tiptap/react";
|
|
17
16
|
import { HighlightOptions } from "@tiptap/extension-highlight";
|
|
18
17
|
import { ColorOptions, TextStyleOptions } from "@tiptap/extension-text-style";
|
|
18
|
+
import { DropcursorOptions, TrailingNodeOptions, UndoRedoOptions } from "@tiptap/extensions";
|
|
19
19
|
import "@tiptap/core";
|
|
20
20
|
|
|
21
21
|
//#region src/components/editor/lib/extensions.d.ts
|
|
@@ -2,13 +2,21 @@ import { EditorJSONContent } from "./types.mjs";
|
|
|
2
2
|
|
|
3
3
|
//#region src/components/editor/lib/helpers.d.ts
|
|
4
4
|
/**
|
|
5
|
-
* Convert
|
|
5
|
+
* Convert HTML to editor content
|
|
6
6
|
*/
|
|
7
7
|
declare function convertHTMLToEditorContent(html: string): EditorJSONContent;
|
|
8
8
|
/**
|
|
9
|
-
* Convert editor content
|
|
9
|
+
* Convert markdown to editor content
|
|
10
|
+
*/
|
|
11
|
+
declare function convertMarkdownToEditorContent(markdown: string): EditorJSONContent;
|
|
12
|
+
/**
|
|
13
|
+
* Convert editor content to HTML
|
|
10
14
|
*/
|
|
11
15
|
declare function convertEditorContentToHTML(content: EditorJSONContent): string;
|
|
16
|
+
/**
|
|
17
|
+
* Convert editor content to markdown
|
|
18
|
+
*/
|
|
19
|
+
declare function convertEditorContentToMarkdown(content: EditorJSONContent): string;
|
|
12
20
|
//#endregion
|
|
13
|
-
export { convertEditorContentToHTML, convertHTMLToEditorContent };
|
|
21
|
+
export { convertEditorContentToHTML, convertEditorContentToMarkdown, convertHTMLToEditorContent, convertMarkdownToEditorContent };
|
|
14
22
|
//# sourceMappingURL=helpers.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.mts","names":[],"sources":["../../../../src/components/editor/lib/helpers.ts"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"helpers.d.mts","names":[],"sources":["../../../../src/components/editor/lib/helpers.ts"],"mappings":";;;;;AAuCA;iBAAgB,0BAAA,CAA2B,IAAA,WAAe,iBAAA;;;;iBAO1C,8BAAA,CAA+B,QAAA,WAAmB,iBAAA;;;;iBAQlD,0BAAA,CAA2B,OAAA,EAAS,iBAAA;AAApD;;;AAAA,iBAUgB,8BAAA,CAA+B,OAAA,EAAS,iBAAA"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { markdownParser } from "../../../lib/utils/markdown.mjs";
|
|
1
2
|
import Blockquote from "@tiptap/extension-blockquote";
|
|
2
3
|
import Bold from "@tiptap/extension-bold";
|
|
3
4
|
import Document from "@tiptap/extension-document";
|
|
@@ -6,13 +7,13 @@ import Heading from "@tiptap/extension-heading";
|
|
|
6
7
|
import HorizontalRule from "@tiptap/extension-horizontal-rule";
|
|
7
8
|
import Italic from "@tiptap/extension-italic";
|
|
8
9
|
import Link from "@tiptap/extension-link";
|
|
9
|
-
import { BulletList, ListItem,
|
|
10
|
+
import { BulletList, ListItem, OrderedList } from "@tiptap/extension-list";
|
|
10
11
|
import Paragraph from "@tiptap/extension-paragraph";
|
|
11
12
|
import Strike from "@tiptap/extension-strike";
|
|
12
13
|
import Text from "@tiptap/extension-text";
|
|
13
14
|
import Underline from "@tiptap/extension-underline";
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
15
|
+
import { generateJSON } from "@tiptap/html";
|
|
16
|
+
import { renderToHTMLString, renderToMarkdown } from "@tiptap/static-renderer";
|
|
16
17
|
|
|
17
18
|
//#region src/components/editor/lib/helpers.ts
|
|
18
19
|
const EXTENSIONS_FOR_GENERATION = [
|
|
@@ -30,26 +31,39 @@ const EXTENSIONS_FOR_GENERATION = [
|
|
|
30
31
|
Italic,
|
|
31
32
|
Link,
|
|
32
33
|
Strike,
|
|
33
|
-
Underline
|
|
34
|
-
Dropcursor,
|
|
35
|
-
Gapcursor,
|
|
36
|
-
UndoRedo,
|
|
37
|
-
ListKeymap,
|
|
38
|
-
TrailingNode
|
|
34
|
+
Underline
|
|
39
35
|
];
|
|
40
36
|
/**
|
|
41
|
-
* Convert
|
|
37
|
+
* Convert HTML to editor content
|
|
42
38
|
*/
|
|
43
39
|
function convertHTMLToEditorContent(html) {
|
|
44
40
|
return generateJSON(html, EXTENSIONS_FOR_GENERATION);
|
|
45
41
|
}
|
|
46
42
|
/**
|
|
47
|
-
* Convert editor content
|
|
43
|
+
* Convert markdown to editor content
|
|
44
|
+
*/
|
|
45
|
+
function convertMarkdownToEditorContent(markdown) {
|
|
46
|
+
return convertHTMLToEditorContent(markdownParser.render(markdown));
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Convert editor content to HTML
|
|
48
50
|
*/
|
|
49
51
|
function convertEditorContentToHTML(content) {
|
|
50
|
-
return
|
|
52
|
+
return renderToHTMLString({
|
|
53
|
+
content,
|
|
54
|
+
extensions: EXTENSIONS_FOR_GENERATION
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Convert editor content to markdown
|
|
59
|
+
*/
|
|
60
|
+
function convertEditorContentToMarkdown(content) {
|
|
61
|
+
return renderToMarkdown({
|
|
62
|
+
content,
|
|
63
|
+
extensions: EXTENSIONS_FOR_GENERATION
|
|
64
|
+
});
|
|
51
65
|
}
|
|
52
66
|
|
|
53
67
|
//#endregion
|
|
54
|
-
export { convertEditorContentToHTML, convertHTMLToEditorContent };
|
|
68
|
+
export { convertEditorContentToHTML, convertEditorContentToMarkdown, convertHTMLToEditorContent, convertMarkdownToEditorContent };
|
|
55
69
|
//# sourceMappingURL=helpers.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.mjs","names":[],"sources":["../../../../src/components/editor/lib/helpers.ts"],"sourcesContent":["import Blockquote from \"@tiptap/extension-blockquote\";\nimport Bold from \"@tiptap/extension-bold\";\nimport Document from \"@tiptap/extension-document\";\nimport HardBreak from \"@tiptap/extension-hard-break\";\nimport Heading from \"@tiptap/extension-heading\";\nimport HorizontalRule from \"@tiptap/extension-horizontal-rule\";\nimport Italic from \"@tiptap/extension-italic\";\nimport Link from \"@tiptap/extension-link\";\nimport { BulletList, ListItem,
|
|
1
|
+
{"version":3,"file":"helpers.mjs","names":[],"sources":["../../../../src/components/editor/lib/helpers.ts"],"sourcesContent":["import Blockquote from \"@tiptap/extension-blockquote\";\nimport Bold from \"@tiptap/extension-bold\";\nimport Document from \"@tiptap/extension-document\";\nimport HardBreak from \"@tiptap/extension-hard-break\";\nimport Heading from \"@tiptap/extension-heading\";\nimport HorizontalRule from \"@tiptap/extension-horizontal-rule\";\nimport Italic from \"@tiptap/extension-italic\";\nimport Link from \"@tiptap/extension-link\";\nimport { BulletList, ListItem, OrderedList } from \"@tiptap/extension-list\";\nimport Paragraph from \"@tiptap/extension-paragraph\";\nimport Strike from \"@tiptap/extension-strike\";\nimport Text from \"@tiptap/extension-text\";\nimport Underline from \"@tiptap/extension-underline\";\nimport { generateJSON } from \"@tiptap/html\";\nimport { renderToHTMLString, renderToMarkdown } from \"@tiptap/static-renderer\";\nimport { markdownParser } from \"@/lib/utils/markdown\";\nimport type { EditorJSONContent } from \"./types\";\n\nconst EXTENSIONS_FOR_GENERATION = [\n Blockquote,\n BulletList,\n Document,\n HardBreak,\n Heading,\n HorizontalRule,\n ListItem,\n OrderedList,\n Paragraph,\n Text,\n Bold,\n Italic,\n Link,\n Strike,\n Underline,\n];\n\n/**\n * Convert HTML to editor content\n */\nexport function convertHTMLToEditorContent(html: string): EditorJSONContent {\n return generateJSON(html, EXTENSIONS_FOR_GENERATION);\n}\n\n/**\n * Convert markdown to editor content\n */\nexport function convertMarkdownToEditorContent(markdown: string): EditorJSONContent {\n const html = markdownParser.render(markdown);\n return convertHTMLToEditorContent(html);\n}\n\n/**\n * Convert editor content to HTML\n */\nexport function convertEditorContentToHTML(content: EditorJSONContent): string {\n return renderToHTMLString({\n content,\n extensions: EXTENSIONS_FOR_GENERATION,\n });\n}\n\n/**\n * Convert editor content to markdown\n */\nexport function convertEditorContentToMarkdown(content: EditorJSONContent): string {\n return renderToMarkdown({\n content,\n extensions: EXTENSIONS_FOR_GENERATION,\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAkBA,MAAM,4BAA4B;CAChC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD;;;;AAKD,SAAgB,2BAA2B,MAAiC;AAC1E,QAAO,aAAa,MAAM,0BAA0B;;;;;AAMtD,SAAgB,+BAA+B,UAAqC;AAElF,QAAO,2BADM,eAAe,OAAO,SAAS,CACL;;;;;AAMzC,SAAgB,2BAA2B,SAAoC;AAC7E,QAAO,mBAAmB;EACxB;EACA,YAAY;EACb,CAAC;;;;;AAMJ,SAAgB,+BAA+B,SAAoC;AACjF,QAAO,iBAAiB;EACtB;EACA,YAAY;EACb,CAAC"}
|
|
@@ -5,7 +5,7 @@ import * as class_variance_authority_types0 from "class-variance-authority/types
|
|
|
5
5
|
|
|
6
6
|
//#region src/components/ui/badge.d.ts
|
|
7
7
|
declare const badgeVariants: (props?: ({
|
|
8
|
-
variant?: "
|
|
8
|
+
variant?: "link" | "default" | "destructive" | "secondary" | "outline" | "ghost" | null | undefined;
|
|
9
9
|
} & class_variance_authority_types0.ClassProp) | undefined) => string;
|
|
10
10
|
declare function Badge({
|
|
11
11
|
className,
|
|
@@ -5,7 +5,7 @@ import * as class_variance_authority_types0 from "class-variance-authority/types
|
|
|
5
5
|
|
|
6
6
|
//#region src/components/ui/button-group.d.ts
|
|
7
7
|
declare const buttonGroupVariants: (props?: ({
|
|
8
|
-
orientation?: "
|
|
8
|
+
orientation?: "horizontal" | "vertical" | null | undefined;
|
|
9
9
|
} & class_variance_authority_types0.ClassProp) | undefined) => string;
|
|
10
10
|
declare function ButtonGroup({
|
|
11
11
|
className,
|
|
@@ -5,8 +5,8 @@ import * as class_variance_authority_types0 from "class-variance-authority/types
|
|
|
5
5
|
|
|
6
6
|
//#region src/components/ui/button.d.ts
|
|
7
7
|
declare const buttonVariants: (props?: ({
|
|
8
|
-
variant?: "
|
|
9
|
-
size?: "default" | "xs" | "sm" | "
|
|
8
|
+
variant?: "link" | "default" | "destructive" | "secondary" | "outline" | "ghost" | null | undefined;
|
|
9
|
+
size?: "default" | "xs" | "sm" | "lg" | "icon" | "icon-xs" | "icon-sm" | "icon-lg" | null | undefined;
|
|
10
10
|
} & class_variance_authority_types0.ClassProp) | undefined) => string;
|
|
11
11
|
declare function Button({
|
|
12
12
|
className,
|
|
@@ -25,6 +25,7 @@ function ComboboxDropdown({ placeholder, searchPlaceholder, items, onSelect, sel
|
|
|
25
25
|
asChild: true,
|
|
26
26
|
disabled,
|
|
27
27
|
children: /* @__PURE__ */ jsxs(Button, {
|
|
28
|
+
"data-inline-input": "combobox-dropdown",
|
|
28
29
|
variant: "outline",
|
|
29
30
|
role: "combobox",
|
|
30
31
|
"aria-expanded": open,
|