@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/src/entry.ts
CHANGED
|
@@ -38,6 +38,18 @@ export const entry = {
|
|
|
38
38
|
"data-tables": "./src/modules/data-tables/entry.ts",
|
|
39
39
|
"data-tables/client": "./src/modules/data-tables/entry.client.ts",
|
|
40
40
|
"data-tables/server": "./src/modules/data-tables/entry.server.ts",
|
|
41
|
+
/**
|
|
42
|
+
* Database Module
|
|
43
|
+
*/
|
|
44
|
+
database: "./src/modules/database/entry.ts",
|
|
45
|
+
"database/client": "./src/modules/database/entry.client.ts",
|
|
46
|
+
"database/server": "./src/modules/database/entry.server.ts",
|
|
47
|
+
/**
|
|
48
|
+
* Emails Module
|
|
49
|
+
*/
|
|
50
|
+
emails: "./src/modules/emails/entry.ts",
|
|
51
|
+
"emails/client": "./src/modules/emails/entry.client.ts",
|
|
52
|
+
"emails/server": "./src/modules/emails/entry.server.ts",
|
|
41
53
|
/**
|
|
42
54
|
* Inline Edit Module
|
|
43
55
|
*/
|
|
@@ -57,54 +69,3 @@ export const entry = {
|
|
|
57
69
|
"storage/client": "./src/modules/storage/entry.client.ts",
|
|
58
70
|
"storage/server": "./src/modules/storage/entry.server.ts",
|
|
59
71
|
};
|
|
60
|
-
|
|
61
|
-
// export const entry = [
|
|
62
|
-
// /**
|
|
63
|
-
// * Components
|
|
64
|
-
// */
|
|
65
|
-
// "./src/components/entry.ts",
|
|
66
|
-
// "./src/components/entry.client.ts",
|
|
67
|
-
// "./src/components/entry.server.ts",
|
|
68
|
-
// /**
|
|
69
|
-
// * Lib
|
|
70
|
-
// */
|
|
71
|
-
// "./src/lib/entry.ts",
|
|
72
|
-
// "./src/lib/entry.client.ts",
|
|
73
|
-
// "./src/lib/entry.server.ts",
|
|
74
|
-
// /**
|
|
75
|
-
// * Auth Module
|
|
76
|
-
// */
|
|
77
|
-
// "./src/modules/auth/entry.ts",
|
|
78
|
-
// "./src/modules/auth/entry.client.ts",
|
|
79
|
-
// "./src/modules/auth/entry.server.ts",
|
|
80
|
-
// /**
|
|
81
|
-
// * Commands Module
|
|
82
|
-
// */
|
|
83
|
-
// "./src/modules/commands/entry.ts",
|
|
84
|
-
// "./src/modules/commands/entry.client.ts",
|
|
85
|
-
// "./src/modules/commands/entry.server.ts",
|
|
86
|
-
// /**
|
|
87
|
-
// * Config Module
|
|
88
|
-
// */
|
|
89
|
-
// "./src/modules/config/entry.ts",
|
|
90
|
-
// "./src/modules/config/entry.client.ts",
|
|
91
|
-
// "./src/modules/config/entry.server.ts",
|
|
92
|
-
// /**
|
|
93
|
-
// * Data Table Module
|
|
94
|
-
// */
|
|
95
|
-
// "./src/modules/data-tables/entry.ts",
|
|
96
|
-
// "./src/modules/data-tables/entry.client.ts",
|
|
97
|
-
// "./src/modules/data-tables/entry.server.ts",
|
|
98
|
-
// /**
|
|
99
|
-
// * Inline Edit Module
|
|
100
|
-
// */
|
|
101
|
-
// "./src/modules/inline-edit/entry.ts",
|
|
102
|
-
// "./src/modules/inline-edit/entry.client.ts",
|
|
103
|
-
// "./src/modules/inline-edit/entry.server.ts",
|
|
104
|
-
// /**
|
|
105
|
-
// * Uploads Module
|
|
106
|
-
// */
|
|
107
|
-
// "./src/modules/uploads/entry.ts",
|
|
108
|
-
// "./src/modules/uploads/entry.client.ts",
|
|
109
|
-
// "./src/modules/uploads/entry.server.ts",
|
|
110
|
-
// ];
|
package/src/lib/entry.ts
CHANGED
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Config
|
|
3
|
-
*/
|
|
4
|
-
export * from "./config/constants";
|
|
5
|
-
|
|
6
1
|
/**
|
|
7
2
|
* Types
|
|
8
3
|
*/
|
|
@@ -15,4 +10,5 @@ export * from "./utils/array-move";
|
|
|
15
10
|
export * from "./utils/cn";
|
|
16
11
|
export * from "./utils/format";
|
|
17
12
|
export * from "./utils/manifest";
|
|
13
|
+
export * from "./utils/markdown";
|
|
18
14
|
export * from "./utils/url";
|
package/src/lib/utils/url.ts
CHANGED
|
@@ -5,8 +5,9 @@
|
|
|
5
5
|
*/
|
|
6
6
|
export function url(path: string = ""): string {
|
|
7
7
|
const base = process.env.NEXT_PUBLIC_DEPLOYMENT_URL ?? process.env.NEXT_PUBLIC_VERCEL_URL;
|
|
8
|
+
const protocol = process.env.NODE_ENV === "production" ? "https" : "http";
|
|
8
9
|
|
|
9
|
-
if (base) return
|
|
10
|
+
if (base) return `${protocol}://${base}${path}`;
|
|
10
11
|
|
|
11
12
|
return `http://localhost:${process.env.NEXT_PUBLIC_PORT ?? 3000}${path}`;
|
|
12
13
|
}
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Detects the browser name and version from a user agent string.
|
|
3
|
+
* @param ua - The user agent string.
|
|
4
|
+
* @returns An object with the browser name and optional version.
|
|
5
|
+
*/
|
|
1
6
|
export function detectBrowser(ua: string): { name: string; version?: string } {
|
|
2
7
|
// Edge
|
|
3
8
|
let m = ua.match(/Edg\/(\d+)/);
|
|
@@ -22,6 +27,11 @@ export function detectBrowser(ua: string): { name: string; version?: string } {
|
|
|
22
27
|
return { name: "Unknown browser" };
|
|
23
28
|
}
|
|
24
29
|
|
|
30
|
+
/**
|
|
31
|
+
* Detects the operating system name and version from a user agent string.
|
|
32
|
+
* @param ua - The user agent string.
|
|
33
|
+
* @returns An object with the OS name and optional version.
|
|
34
|
+
*/
|
|
25
35
|
export function detectOS(ua: string): { name: string; version?: string } {
|
|
26
36
|
// macOS
|
|
27
37
|
let m = ua.match(/Mac OS X ([\d_]+)/);
|
|
@@ -48,6 +58,11 @@ export function detectOS(ua: string): { name: string; version?: string } {
|
|
|
48
58
|
return { name: "Unknown OS" };
|
|
49
59
|
}
|
|
50
60
|
|
|
61
|
+
/**
|
|
62
|
+
* Detects the device type (Desktop, Mobile, or Tablet) from a user agent string.
|
|
63
|
+
* @param ua - The user agent string.
|
|
64
|
+
* @returns The device type as "Desktop", "Mobile", or "Tablet".
|
|
65
|
+
*/
|
|
51
66
|
export function detectDevice(ua: string): "Desktop" | "Mobile" | "Tablet" {
|
|
52
67
|
const s = ua.toLowerCase();
|
|
53
68
|
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
+
import "server-cli-only";
|
|
2
|
+
|
|
1
3
|
import { redirect } from "next/navigation";
|
|
4
|
+
import { connection } from "next/server";
|
|
2
5
|
import type { PropsWithChildren } from "react";
|
|
3
6
|
import type { TDatabaseSchema, TulipContext } from "@/modules/config/entry";
|
|
4
7
|
import { users } from "../db/schema";
|
|
5
8
|
|
|
6
9
|
type AuthGuardFirstUserProps<TSchema extends TDatabaseSchema> = PropsWithChildren<
|
|
7
|
-
Pick<TulipContext<TSchema>, "db">
|
|
10
|
+
Pick<TulipContext<TSchema>, "db">
|
|
8
11
|
>;
|
|
9
12
|
|
|
10
|
-
export async function
|
|
13
|
+
export async function CreateFirstUserPageGuard<TSchema extends TDatabaseSchema>({
|
|
11
14
|
children,
|
|
12
15
|
db,
|
|
13
|
-
login = false,
|
|
14
16
|
}: AuthGuardFirstUserProps<TSchema>) {
|
|
17
|
+
await connection();
|
|
18
|
+
|
|
15
19
|
const allUsers = await db.select().from(users).limit(1);
|
|
16
20
|
const usersExist = allUsers.length > 0;
|
|
17
21
|
|
|
18
|
-
if (login)
|
|
19
|
-
if (!usersExist) redirect("/auth/create-first-user");
|
|
20
|
-
} else {
|
|
21
|
-
if (usersExist) redirect("/auth/login");
|
|
22
|
-
}
|
|
22
|
+
if (usersExist) redirect("/auth/login");
|
|
23
23
|
|
|
24
24
|
return <>{children}</>;
|
|
25
25
|
}
|
|
@@ -2,15 +2,14 @@
|
|
|
2
2
|
* Components
|
|
3
3
|
*/
|
|
4
4
|
export * from "./components/auth-layout.server";
|
|
5
|
+
export * from "./components/create-first-user-guard.server";
|
|
5
6
|
export * from "./components/guard.server";
|
|
6
|
-
export * from "./
|
|
7
|
-
|
|
7
|
+
export * from "./handler/proxy.server";
|
|
8
|
+
export * from "./handler/route.server";
|
|
8
9
|
/**
|
|
9
10
|
* Handlers
|
|
10
11
|
*/
|
|
11
|
-
export * from "./handler/
|
|
12
|
-
export * from "./handler/proxy.server";
|
|
13
|
-
export * from "./handler/route.server";
|
|
12
|
+
export * from "./handler/service.server";
|
|
14
13
|
|
|
15
14
|
/**
|
|
16
15
|
* Lib
|
|
@@ -5,7 +5,7 @@ import { adminClient, emailOTPClient, inferAdditionalFields } from "better-auth/
|
|
|
5
5
|
import type { AccessControl, Role } from "better-auth/plugins";
|
|
6
6
|
import { createAuthClient as createBetterAuthClient } from "better-auth/react";
|
|
7
7
|
import { url } from "@/lib/utils/url";
|
|
8
|
-
import type {
|
|
8
|
+
import type { Auth } from "./service.server";
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Create auth client
|
|
@@ -39,7 +39,7 @@ export function createAuthClient<
|
|
|
39
39
|
emailOTPClient(),
|
|
40
40
|
passkeyClient(),
|
|
41
41
|
adminClient({ ac, roles }),
|
|
42
|
-
inferAdditionalFields<
|
|
42
|
+
inferAdditionalFields<Auth>(),
|
|
43
43
|
],
|
|
44
44
|
});
|
|
45
45
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { toNextJsHandler } from "better-auth/next-js";
|
|
2
2
|
import type { NextRequest } from "next/server";
|
|
3
3
|
import "server-cli-only";
|
|
4
|
-
import type {
|
|
4
|
+
import type { Auth } from "./service.server";
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Handle the auth routes
|
|
8
8
|
*/
|
|
9
|
-
export function handleAuthRoute(props: { auth:
|
|
9
|
+
export function handleAuthRoute(props: { auth: Auth }) {
|
|
10
10
|
/**
|
|
11
11
|
* GET route handler
|
|
12
12
|
*/
|
|
@@ -1,30 +1,36 @@
|
|
|
1
1
|
import { passkey } from "@better-auth/passkey";
|
|
2
2
|
import { drizzleAdapter } from "better-auth/adapters/drizzle";
|
|
3
|
+
import { createAuthMiddleware } from "better-auth/api";
|
|
3
4
|
import { betterAuth } from "better-auth/minimal";
|
|
4
|
-
import {
|
|
5
|
-
import { admin, createAuthMiddleware, emailOTP } from "better-auth/plugins";
|
|
5
|
+
import { admin, emailOTP } from "better-auth/plugins";
|
|
6
6
|
import { eq } from "drizzle-orm";
|
|
7
7
|
import ForgetPasswordEmail from "@/components/emails/forget-password-email";
|
|
8
8
|
import { url } from "@/lib/utils/url";
|
|
9
9
|
import type { TDatabaseSchema } from "@/modules/config/entry";
|
|
10
|
-
import type { DatabaseClient, EmailClient } from "@/modules/config/entry.server";
|
|
11
10
|
import type { TulipConfig } from "@/modules/config/lib/config";
|
|
11
|
+
import type { Database } from "@/modules/database/lib/service.server";
|
|
12
|
+
import type { Email } from "@/modules/emails/lib/service.server";
|
|
12
13
|
import { users } from "../entry";
|
|
13
14
|
import type { createAccessControl, Role } from "../lib/permissions";
|
|
14
15
|
|
|
15
16
|
export const authCookiePrefix = "tulip";
|
|
16
17
|
|
|
17
18
|
type InitAuthProps<TSchema extends TDatabaseSchema> = {
|
|
18
|
-
db:
|
|
19
|
-
email:
|
|
19
|
+
db: Database<TSchema>;
|
|
20
|
+
email: Email;
|
|
20
21
|
config: TulipConfig;
|
|
21
22
|
ac: ReturnType<typeof createAccessControl>;
|
|
22
23
|
roles: {
|
|
23
24
|
[key in string]?: Role;
|
|
24
25
|
};
|
|
26
|
+
allowedHosts: string[];
|
|
27
|
+
defaultRole?: string;
|
|
25
28
|
};
|
|
26
29
|
|
|
27
|
-
|
|
30
|
+
/**
|
|
31
|
+
* Create the Better Auth server instance.
|
|
32
|
+
*/
|
|
33
|
+
function createAuth<TSchema extends TDatabaseSchema>(props: InitAuthProps<TSchema>) {
|
|
28
34
|
return betterAuth({
|
|
29
35
|
advanced: {
|
|
30
36
|
cookiePrefix: authCookiePrefix,
|
|
@@ -32,10 +38,12 @@ export function initAuth<TSchema extends TDatabaseSchema>(props: InitAuthProps<T
|
|
|
32
38
|
generateId: () => false,
|
|
33
39
|
},
|
|
34
40
|
},
|
|
41
|
+
baseURL: {
|
|
42
|
+
allowedHosts: props.allowedHosts,
|
|
43
|
+
},
|
|
35
44
|
database: drizzleAdapter(props.db, {
|
|
36
45
|
provider: "pg",
|
|
37
46
|
usePlural: true,
|
|
38
|
-
// schema: props.schema,
|
|
39
47
|
}),
|
|
40
48
|
emailAndPassword: {
|
|
41
49
|
enabled: true,
|
|
@@ -75,12 +83,12 @@ export function initAuth<TSchema extends TDatabaseSchema>(props: InitAuthProps<T
|
|
|
75
83
|
}),
|
|
76
84
|
},
|
|
77
85
|
plugins: [
|
|
78
|
-
nextCookies(),
|
|
79
86
|
passkey(),
|
|
80
87
|
admin({
|
|
81
88
|
roles: props.roles,
|
|
82
89
|
ac: props.ac,
|
|
83
90
|
adminRoles: ["admin", "developer"],
|
|
91
|
+
defaultRole: props.defaultRole ?? "user",
|
|
84
92
|
}),
|
|
85
93
|
emailOTP({
|
|
86
94
|
sendVerificationOTP: async ({ email, otp, type }) => {
|
|
@@ -108,4 +116,17 @@ export function initAuth<TSchema extends TDatabaseSchema>(props: InitAuthProps<T
|
|
|
108
116
|
});
|
|
109
117
|
}
|
|
110
118
|
|
|
111
|
-
|
|
119
|
+
/**
|
|
120
|
+
* Better Auth instance type returned by `Auth.init()`.
|
|
121
|
+
*/
|
|
122
|
+
export type Auth = ReturnType<typeof createAuth>;
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Auth service namespace.
|
|
126
|
+
*
|
|
127
|
+
* @example
|
|
128
|
+
* const auth = Auth.init({ db, email, config, ac, roles, allowedHosts });
|
|
129
|
+
*/
|
|
130
|
+
export const Auth = {
|
|
131
|
+
init: createAuth,
|
|
132
|
+
};
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
4
|
-
import type {
|
|
5
|
-
import type {
|
|
1
|
+
import type { Auth } from "@/modules/auth/handler/service.server";
|
|
2
|
+
import type { Database } from "@/modules/database/lib/service.server";
|
|
3
|
+
import type { TDatabaseSchema } from "@/modules/database/lib/types";
|
|
4
|
+
import type { Email } from "@/modules/emails/lib/service.server";
|
|
5
|
+
import type { Storage } from "@/modules/storage/lib/service.server";
|
|
6
6
|
|
|
7
7
|
export type TulipContext<TSchema extends TDatabaseSchema> = {
|
|
8
|
-
db:
|
|
8
|
+
db: Database<TSchema>;
|
|
9
9
|
schema: TSchema;
|
|
10
|
-
auth:
|
|
11
|
-
email:
|
|
12
|
-
storage:
|
|
10
|
+
auth: Auth;
|
|
11
|
+
email: Email;
|
|
12
|
+
storage: Storage<TSchema>;
|
|
13
13
|
};
|
|
14
14
|
|
|
15
15
|
export function createContext<TSchema extends TDatabaseSchema>(props: TulipContext<TSchema>) {
|
|
@@ -29,3 +29,4 @@ export * from "./tables/inline-table/components/cells/drag-handle.client";
|
|
|
29
29
|
export * from "./tables/inline-table/components/cells/read-only";
|
|
30
30
|
export * from "./tables/inline-table/components/table";
|
|
31
31
|
export * from "./tables/inline-table/hooks/context.client";
|
|
32
|
+
export * from "./tables/inline-table/hooks/use-hotkeys.client";
|
|
@@ -16,7 +16,7 @@ export interface UseInfiniteStrategyInput {
|
|
|
16
16
|
|
|
17
17
|
export type InfiniteStrategyMeta = Pick<
|
|
18
18
|
UseInfiniteStrategyInput,
|
|
19
|
-
"isFetching" | "isFetchingNextPage"
|
|
19
|
+
"isFetching" | "isFetchingNextPage" | "total" | "cursor" | "fetchNextPage"
|
|
20
20
|
>;
|
|
21
21
|
|
|
22
22
|
export function useInfiniteStrategy({
|
|
@@ -63,6 +63,9 @@ export function useInfiniteStrategy({
|
|
|
63
63
|
manualSorting: true,
|
|
64
64
|
onSortingChange: handleSortingChange({ sortingState, setQuery, resetCursor }),
|
|
65
65
|
meta: {
|
|
66
|
+
total,
|
|
67
|
+
cursor,
|
|
68
|
+
fetchNextPage,
|
|
66
69
|
isFetching,
|
|
67
70
|
isFetchingNextPage,
|
|
68
71
|
} satisfies InfiniteStrategyMeta,
|
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
import type { Row, Table } from "@tanstack/react-table";
|
|
2
2
|
import type * as React from "react";
|
|
3
|
-
import {
|
|
4
|
-
ContextCommandMenu,
|
|
5
|
-
ContextCommandMenuContent,
|
|
6
|
-
ContextCommandMenuTrigger,
|
|
7
|
-
} from "@/modules/commands/menus/context-menu.client";
|
|
8
3
|
import { TableRow } from "@/modules/data-tables/components/table";
|
|
9
|
-
import type { TableMeta } from "../../../lib/types";
|
|
10
4
|
|
|
11
5
|
export type DataTableRowProps<TData extends { id: string }> = React.ComponentProps<
|
|
12
6
|
typeof TableRow
|
|
@@ -21,20 +15,17 @@ export function DataTableRow<TData extends { id: string }>({
|
|
|
21
15
|
className,
|
|
22
16
|
...props
|
|
23
17
|
}: DataTableRowProps<TData>) {
|
|
24
|
-
|
|
18
|
+
return <TableRow {...props} data-state={row.getIsSelected() && "selected"} />;
|
|
19
|
+
}
|
|
25
20
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
<TableRow {...props} data-state={row.getIsSelected() && "selected"} />
|
|
30
|
-
</ContextCommandMenuTrigger>
|
|
21
|
+
// <ContextCommandMenu>
|
|
22
|
+
// <ContextCommandMenuTrigger asChild>
|
|
23
|
+
// </ContextCommandMenuTrigger>
|
|
31
24
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
);
|
|
40
|
-
}
|
|
25
|
+
// <ContextCommandMenuContent
|
|
26
|
+
// data={row.original}
|
|
27
|
+
// commands={meta.commands || []}
|
|
28
|
+
// meta={meta as never}
|
|
29
|
+
// className="w-[300px]"
|
|
30
|
+
// />
|
|
31
|
+
// </ContextCommandMenu>
|
|
@@ -4,14 +4,8 @@ import { useSortable } from "@dnd-kit/sortable";
|
|
|
4
4
|
import { CSS } from "@dnd-kit/utilities";
|
|
5
5
|
import type { Row, Table } from "@tanstack/react-table";
|
|
6
6
|
import type * as React from "react";
|
|
7
|
-
import {
|
|
8
|
-
ContextCommandMenu,
|
|
9
|
-
ContextCommandMenuContent,
|
|
10
|
-
ContextCommandMenuTrigger,
|
|
11
|
-
} from "@/modules/commands/entry.client";
|
|
12
7
|
import { TableRow } from "@/modules/data-tables/components/table";
|
|
13
8
|
import { InlineEditProvider } from "@/modules/inline-edit/entry.client";
|
|
14
|
-
import type { TableMeta } from "../../../lib/types";
|
|
15
9
|
|
|
16
10
|
export type InlineTableRowProps<TData extends { id: string }> =
|
|
17
11
|
React.HTMLAttributes<HTMLTableRowElement> & {
|
|
@@ -25,34 +19,34 @@ export function InlineTableRow<TData extends { id: string }>({
|
|
|
25
19
|
children,
|
|
26
20
|
...props
|
|
27
21
|
}: InlineTableRowProps<TData>) {
|
|
28
|
-
const meta = table.options.meta as TableMeta<TData>;
|
|
29
|
-
|
|
30
22
|
const rowId = (row.original as { id: string }).id;
|
|
31
23
|
|
|
32
24
|
const { setNodeRef, transform, transition } = useSortable({ id: rowId });
|
|
33
25
|
|
|
34
26
|
return (
|
|
35
|
-
<
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
<InlineEditProvider id={row.original.id}>{children}</InlineEditProvider>
|
|
47
|
-
</TableRow>
|
|
48
|
-
</ContextCommandMenuTrigger>
|
|
49
|
-
|
|
50
|
-
<ContextCommandMenuContent
|
|
51
|
-
data={row.original}
|
|
52
|
-
commands={meta.commands || []}
|
|
53
|
-
meta={meta as never}
|
|
54
|
-
className="w-[300px]"
|
|
55
|
-
/>
|
|
56
|
-
</ContextCommandMenu>
|
|
27
|
+
<TableRow
|
|
28
|
+
{...props}
|
|
29
|
+
ref={setNodeRef}
|
|
30
|
+
data-state={row.getIsSelected() && "selected"}
|
|
31
|
+
style={{
|
|
32
|
+
transform: CSS.Transform.toString(transform),
|
|
33
|
+
transition,
|
|
34
|
+
}}
|
|
35
|
+
>
|
|
36
|
+
<InlineEditProvider id={row.original.id}>{children}</InlineEditProvider>
|
|
37
|
+
</TableRow>
|
|
57
38
|
);
|
|
58
39
|
}
|
|
40
|
+
|
|
41
|
+
{
|
|
42
|
+
/* <ContextCommandMenu>
|
|
43
|
+
<ContextCommandMenuTrigger asChild></ContextCommandMenuTrigger>
|
|
44
|
+
|
|
45
|
+
<ContextCommandMenuContent
|
|
46
|
+
data={row.original}
|
|
47
|
+
commands={meta.commands || []}
|
|
48
|
+
meta={meta as never}
|
|
49
|
+
className="w-[300px]"
|
|
50
|
+
/>
|
|
51
|
+
</ContextCommandMenu>; */
|
|
52
|
+
}
|
|
@@ -14,13 +14,18 @@ import { InlineTableHeader } from "./header";
|
|
|
14
14
|
export function InlineTable<TData extends { id: string }>({
|
|
15
15
|
disabledColumns,
|
|
16
16
|
moveRowAction,
|
|
17
|
+
hotkeys,
|
|
17
18
|
...props
|
|
18
19
|
}: ComponentProps<typeof Table> & ComponentProps<typeof InlineTableProvider>) {
|
|
19
20
|
const table = useTable<TData>();
|
|
20
21
|
const meta = table.options.meta as TableMeta<TData>;
|
|
21
22
|
|
|
22
23
|
return (
|
|
23
|
-
<InlineTableProvider
|
|
24
|
+
<InlineTableProvider
|
|
25
|
+
disabledColumns={disabledColumns}
|
|
26
|
+
moveRowAction={moveRowAction}
|
|
27
|
+
hotkeys={hotkeys}
|
|
28
|
+
>
|
|
24
29
|
<div className="space-y-4">
|
|
25
30
|
<div className="rounded-md border">
|
|
26
31
|
<Table {...props}>
|
|
@@ -5,6 +5,7 @@ import React, { type PropsWithChildren } from "react";
|
|
|
5
5
|
import { arrayMove } from "@/lib/entry";
|
|
6
6
|
import { useAction } from "@/lib/hooks/use-action";
|
|
7
7
|
import { useTableConfigContext } from "@/modules/data-tables/entry.client";
|
|
8
|
+
import type { InlineDataTableHotkeysConfig } from "./use-hotkeys.client";
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
11
|
* Move row method as meta
|
|
@@ -24,6 +25,7 @@ type MoveRowMethod =
|
|
|
24
25
|
*/
|
|
25
26
|
export type InlineTableContextValue = MoveRowMethod & {
|
|
26
27
|
disabledColumns?: VisibilityState;
|
|
28
|
+
hotkeys?: InlineDataTableHotkeysConfig;
|
|
27
29
|
// setData: React.Dispatch<React.SetStateAction<TData[]>>;
|
|
28
30
|
};
|
|
29
31
|
|
|
@@ -49,9 +51,11 @@ export function InlineTableProvider<TData extends { id: string }>({
|
|
|
49
51
|
children,
|
|
50
52
|
disabledColumns,
|
|
51
53
|
moveRowAction,
|
|
54
|
+
hotkeys,
|
|
52
55
|
}: PropsWithChildren<{
|
|
53
56
|
disabledColumns?: VisibilityState;
|
|
54
57
|
moveRowAction?: (input: { fromIndex: number; toIndex: number }) => Promise<unknown>;
|
|
58
|
+
hotkeys?: InlineDataTableHotkeysConfig;
|
|
55
59
|
}>) {
|
|
56
60
|
const { queryData, setData } = useTableConfigContext<TData>();
|
|
57
61
|
|
|
@@ -74,6 +78,7 @@ export function InlineTableProvider<TData extends { id: string }>({
|
|
|
74
78
|
<InlineTableContext.Provider
|
|
75
79
|
value={{
|
|
76
80
|
disabledColumns,
|
|
81
|
+
hotkeys,
|
|
77
82
|
...(moveRowAction
|
|
78
83
|
? { isDraggable: true, moveRow: moveRowMutation.mutate }
|
|
79
84
|
: { isDraggable: false, moveRow: undefined }),
|