@contember/create 2.1.0-alpha.3 → 2.1.0-alpha.35
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/development/run.cjs +6 -4
- package/dist/development/run.cjs.map +1 -1
- package/dist/development/run.js +6 -4
- package/dist/development/run.js.map +1 -1
- package/dist/development/src/commands/WorkspaceCreateCommand.cjs +37 -23
- package/dist/development/src/commands/WorkspaceCreateCommand.cjs.map +1 -1
- package/dist/development/src/commands/WorkspaceCreateCommand.js +37 -23
- package/dist/development/src/commands/WorkspaceCreateCommand.js.map +1 -1
- package/dist/development/src/lib/FileSystem.cjs +1 -0
- package/dist/development/src/lib/FileSystem.cjs.map +1 -1
- package/dist/development/src/lib/FileSystem.js +1 -0
- package/dist/development/src/lib/FileSystem.js.map +1 -1
- package/dist/development/src/lib/TemplateInstaller.cjs +28 -12
- package/dist/development/src/lib/TemplateInstaller.cjs.map +1 -1
- package/dist/development/src/lib/TemplateInstaller.js +28 -12
- package/dist/development/src/lib/TemplateInstaller.js.map +1 -1
- package/dist/development/src/lib/packageManagerDetector.cjs +22 -0
- package/dist/development/src/lib/packageManagerDetector.cjs.map +1 -0
- package/dist/development/src/lib/packageManagerDetector.js +22 -0
- package/dist/development/src/lib/packageManagerDetector.js.map +1 -0
- package/dist/development/src/lib/version.cjs.map +1 -1
- package/dist/development/src/lib/version.js.map +1 -1
- package/dist/development/src/paths.cjs.map +1 -1
- package/dist/development/src/paths.js.map +1 -1
- package/dist/production/run.cjs +6 -4
- package/dist/production/run.cjs.map +1 -1
- package/dist/production/run.js +6 -4
- package/dist/production/run.js.map +1 -1
- package/dist/production/src/commands/WorkspaceCreateCommand.cjs +37 -23
- package/dist/production/src/commands/WorkspaceCreateCommand.cjs.map +1 -1
- package/dist/production/src/commands/WorkspaceCreateCommand.js +37 -23
- package/dist/production/src/commands/WorkspaceCreateCommand.js.map +1 -1
- package/dist/production/src/lib/FileSystem.cjs +1 -0
- package/dist/production/src/lib/FileSystem.cjs.map +1 -1
- package/dist/production/src/lib/FileSystem.js +1 -0
- package/dist/production/src/lib/FileSystem.js.map +1 -1
- package/dist/production/src/lib/TemplateInstaller.cjs +28 -12
- package/dist/production/src/lib/TemplateInstaller.cjs.map +1 -1
- package/dist/production/src/lib/TemplateInstaller.js +28 -12
- package/dist/production/src/lib/TemplateInstaller.js.map +1 -1
- package/dist/production/src/lib/packageManagerDetector.cjs +22 -0
- package/dist/production/src/lib/packageManagerDetector.cjs.map +1 -0
- package/dist/production/src/lib/packageManagerDetector.js +22 -0
- package/dist/production/src/lib/packageManagerDetector.js.map +1 -0
- package/dist/production/src/lib/version.cjs.map +1 -1
- package/dist/production/src/lib/version.js.map +1 -1
- package/dist/production/src/paths.cjs.map +1 -1
- package/dist/production/src/paths.js.map +1 -1
- package/dist/types/commands/WorkspaceCreateCommand.d.ts +4 -2
- package/dist/types/commands/WorkspaceCreateCommand.d.ts.map +1 -1
- package/dist/types/lib/FileSystem.d.ts +1 -0
- package/dist/types/lib/FileSystem.d.ts.map +1 -1
- package/dist/types/lib/TemplateInstaller.d.ts.map +1 -1
- package/dist/types/lib/packageManagerDetector.d.ts +3 -0
- package/dist/types/lib/packageManagerDetector.d.ts.map +1 -0
- package/package.json +15 -6
- package/resources/templates/{template-workspace → default}/.github/workflows/deploy.yaml +1 -1
- package/resources/templates/default/.gitignore.dist +154 -0
- package/resources/templates/default/README.md +98 -0
- package/resources/templates/{template-workspace → default}/admin/.env.development +1 -0
- package/resources/templates/default/admin/.env.production +6 -0
- package/resources/templates/{template-workspace → default}/admin/app/components/layout.tsx +7 -3
- package/resources/templates/default/admin/app/components/navigation.tsx +85 -0
- package/resources/templates/{template-workspace → default}/admin/app/index.tsx +4 -4
- package/resources/templates/default/admin/app/pages/tenant.tsx +160 -0
- package/resources/templates/default/admin/entrypoint/components/layout.tsx +14 -0
- package/resources/templates/default/admin/entrypoint/components/logged-in.tsx +47 -0
- package/resources/templates/default/admin/entrypoint/components/login.tsx +103 -0
- package/resources/templates/default/admin/entrypoint/config.ts +35 -0
- package/resources/templates/default/admin/entrypoint/contexts/login.tsx +18 -0
- package/resources/templates/default/admin/entrypoint/index.tsx +12 -0
- package/resources/templates/default/admin/entrypoint/login-entrypoint.tsx +24 -0
- package/resources/templates/default/admin/entrypoint/pages/index.tsx +48 -0
- package/resources/templates/default/admin/entrypoint/pages/magicLink.tsx +56 -0
- package/resources/templates/default/admin/entrypoint/pages/magicLinkSent.tsx +63 -0
- package/resources/templates/default/admin/entrypoint/pages/passwordReset.tsx +44 -0
- package/resources/templates/default/admin/entrypoint/pages/resetRequest.tsx +35 -0
- package/resources/templates/default/admin/entrypoint/pages/resetRequestSuccess.tsx +34 -0
- package/resources/templates/default/admin/index.css +94 -0
- package/resources/templates/{template-workspace → default}/admin/index.html +1 -1
- package/resources/templates/{template-workspace → default}/admin/lib/binding/binding.tsx +0 -2
- package/resources/templates/{template-workspace → default}/admin/lib/binding/hooks.tsx +14 -8
- package/resources/templates/default/admin/lib/binding/identity.tsx +51 -0
- package/resources/templates/{template-workspace → default}/admin/lib/binding/navigation-guard-dialog.tsx +12 -8
- package/resources/templates/{template-workspace → default}/admin/lib/binding/persist.tsx +7 -5
- package/resources/templates/{template-workspace → default}/admin/lib/block-repeater/block-repeater.tsx +14 -16
- package/resources/templates/{template-workspace → default}/admin/lib/board/board.tsx +61 -47
- package/resources/templates/{template-workspace → default}/admin/lib/buttons/back-button.tsx +1 -1
- package/resources/templates/{template-workspace → default}/admin/lib/datagrid/cells.tsx +49 -35
- package/resources/templates/{template-workspace → default}/admin/lib/datagrid/column-header.tsx +47 -38
- package/resources/templates/{template-workspace → default}/admin/lib/datagrid/columns.tsx +128 -105
- package/resources/templates/default/admin/lib/datagrid/elements.tsx +63 -0
- package/resources/templates/{template-workspace → default}/admin/lib/datagrid/empty.tsx +1 -1
- package/resources/templates/{template-workspace → default}/admin/lib/datagrid/filters/boolean.tsx +1 -4
- package/resources/templates/{template-workspace → default}/admin/lib/datagrid/filters/common.tsx +14 -14
- package/resources/templates/{template-workspace → default}/admin/lib/datagrid/filters/date.tsx +35 -21
- package/resources/templates/{template-workspace → default}/admin/lib/datagrid/filters/defined.tsx +0 -1
- package/resources/templates/{template-workspace → default}/admin/lib/datagrid/filters/enum.tsx +24 -30
- package/resources/templates/{template-workspace → default}/admin/lib/datagrid/filters/mobile.tsx +2 -3
- package/resources/templates/{template-workspace → default}/admin/lib/datagrid/filters/number.tsx +0 -3
- package/resources/templates/{template-workspace → default}/admin/lib/datagrid/filters/relation.tsx +36 -30
- package/resources/templates/{template-workspace → default}/admin/lib/datagrid/labels.tsx +0 -1
- package/resources/templates/{template-workspace → default}/admin/lib/datagrid/loader.tsx +2 -7
- package/resources/templates/{template-workspace → default}/admin/lib/datagrid/pagination.tsx +33 -38
- package/resources/templates/{template-workspace → default}/admin/lib/datagrid/table.tsx +8 -6
- package/resources/templates/{template-workspace → default}/admin/lib/datagrid/tiles.tsx +10 -5
- package/resources/templates/{template-workspace → default}/admin/lib/datagrid/toolbar.tsx +10 -7
- package/resources/templates/{template-workspace → default}/admin/lib/datagrid/ui.tsx +12 -15
- package/resources/templates/{template-workspace → default}/admin/lib/dev/login-panel.tsx +23 -16
- package/resources/templates/{template-workspace → default}/admin/lib/dict.ts +17 -5
- package/resources/templates/default/admin/lib/dimensions/dimensions.tsx +159 -0
- package/resources/templates/{template-workspace → default}/admin/lib/editor/block-editor.tsx +22 -10
- package/resources/templates/{template-workspace → default}/admin/lib/editor/common/baseEditorPlugins.tsx +0 -2
- package/resources/templates/default/admin/lib/editor/common/buttons.tsx +205 -0
- package/resources/templates/{template-workspace → default}/admin/lib/editor/common/editor-block-toolbar.tsx +3 -1
- package/resources/templates/{template-workspace → default}/admin/lib/editor/common/editor-canvas.tsx +6 -4
- package/resources/templates/{template-workspace → default}/admin/lib/editor/common/editor-editable-canvas.tsx +0 -1
- package/resources/templates/{template-workspace → default}/admin/lib/editor/common/editor-inline-toolbar.tsx +5 -2
- package/resources/templates/{template-workspace → default}/admin/lib/editor/common/elements/AnchorRenderer.tsx +18 -16
- package/resources/templates/default/admin/lib/editor/common/elements/BlockElement.tsx +60 -0
- package/resources/templates/{template-workspace → default}/admin/lib/editor/common/elements/HeadingRenderer.tsx +1 -1
- package/resources/templates/{template-workspace → default}/admin/lib/editor/common/elements/TableCellElementRenderer.tsx +1 -1
- package/resources/templates/{template-workspace → default}/admin/lib/editor/common/elements/TableElementRenderer.tsx +2 -7
- package/resources/templates/{template-workspace → default}/admin/lib/editor/common/elements/TableRowElementRenderer.tsx +1 -5
- package/resources/templates/{template-workspace → default}/admin/lib/editor/editor-block.tsx +17 -10
- package/resources/templates/{template-workspace → default}/admin/lib/editor/rich-text-view.tsx +11 -6
- package/resources/templates/{template-workspace → default}/admin/lib/editor/rich-text.tsx +6 -7
- package/resources/templates/default/admin/lib/editor/sortable-block.tsx +57 -0
- package/resources/templates/default/admin/lib/form/container.tsx +72 -0
- package/resources/templates/{template-workspace → default}/admin/lib/form/inputs.tsx +14 -12
- package/resources/templates/{template-workspace → default}/admin/lib/form/select.tsx +93 -51
- package/resources/templates/{template-workspace → default}/admin/lib/form/ui.tsx +1 -1
- package/resources/templates/default/admin/lib/form/upload-repeaters.tsx +221 -0
- package/resources/templates/{template-workspace → default}/admin/lib/form/upload.tsx +61 -62
- package/resources/templates/{template-workspace → default}/admin/lib/labels/enum-labels.ts +6 -3
- package/resources/templates/{template-workspace → default}/admin/lib/labels/field-labels.ts +4 -2
- package/resources/templates/{template-workspace → default}/admin/lib/layout/layout-boxed.tsx +39 -29
- package/resources/templates/{template-workspace → default}/admin/lib/layout/slots.tsx +1 -4
- package/resources/templates/{template-workspace → default}/admin/lib/outdated-application-dialog/outdated-application-dialog.tsx +10 -4
- package/resources/templates/{template-workspace → default}/admin/lib/repeater/repeater.tsx +24 -15
- package/resources/templates/{template-workspace → default}/admin/lib/select/create-new.tsx +0 -3
- package/resources/templates/{template-workspace → default}/admin/lib/select/filter.tsx +0 -1
- package/resources/templates/{template-workspace → default}/admin/lib/select/list.tsx +33 -28
- package/resources/templates/default/admin/lib/select/multi-select.tsx +92 -0
- package/resources/templates/default/admin/lib/select/select.tsx +109 -0
- package/resources/templates/default/admin/lib/select/sortable-select.tsx +138 -0
- package/resources/templates/{template-workspace → default}/admin/lib/select/ui.tsx +13 -11
- package/resources/templates/{template-workspace → default}/admin/lib/tenant/forms/change-my-password.tsx +21 -8
- package/resources/templates/{template-workspace → default}/admin/lib/tenant/forms/common.tsx +21 -12
- package/resources/templates/{template-workspace → default}/admin/lib/tenant/forms/create-api-key.tsx +9 -5
- package/resources/templates/{template-workspace → default}/admin/lib/tenant/forms/invite.tsx +12 -7
- package/resources/templates/{template-workspace → default}/admin/lib/tenant/forms/login.tsx +26 -7
- package/resources/templates/{template-workspace → default}/admin/lib/tenant/forms/memberships-control.tsx +32 -20
- package/resources/templates/{template-workspace → default}/admin/lib/tenant/forms/password-reset-request.tsx +9 -5
- package/resources/templates/{template-workspace → default}/admin/lib/tenant/forms/password-reset.tsx +21 -8
- package/resources/templates/{template-workspace → default}/admin/lib/tenant/forms/passwordless-signin-init.tsx +9 -5
- package/resources/templates/{template-workspace → default}/admin/lib/tenant/forms/passwordless-signin.tsx +25 -12
- package/resources/templates/{template-workspace → default}/admin/lib/tenant/forms/update-project-member.tsx +3 -4
- package/resources/templates/{template-workspace → default}/admin/lib/tenant/hooks/useInviteUser.tsx +2 -3
- package/resources/templates/{template-workspace → default}/admin/lib/tenant/listing/api-key-list.tsx +5 -3
- package/resources/templates/{template-workspace → default}/admin/lib/tenant/listing/member-delete-dialog.tsx +13 -2
- package/resources/templates/{template-workspace → default}/admin/lib/tenant/listing/member-list.tsx +17 -11
- package/resources/templates/{template-workspace → default}/admin/lib/tenant/listing/person-list.tsx +6 -4
- package/resources/templates/{template-workspace → default}/admin/lib/tenant/otp/otp-setup.tsx +86 -59
- package/resources/templates/default/admin/lib/toast/toast.tsx +113 -0
- package/resources/templates/{template-workspace → default}/admin/lib/toast/toaster.tsx +0 -1
- package/resources/templates/{template-workspace → default}/admin/lib/ui/alert-dialog.tsx +4 -3
- package/resources/templates/default/admin/lib/ui/button.tsx +30 -0
- package/resources/templates/{template-workspace → default}/admin/lib/ui/card.tsx +1 -1
- package/resources/templates/{template-workspace → default}/admin/lib/ui/dialog.tsx +12 -8
- package/resources/templates/default/admin/lib/ui/dimension.tsx +9 -0
- package/resources/templates/{template-workspace → default}/admin/lib/ui/dropdown.tsx +18 -15
- package/resources/templates/default/admin/lib/ui/input.tsx +68 -0
- package/resources/templates/{template-workspace → default}/admin/lib/ui/loader.tsx +1 -1
- package/resources/templates/{template-workspace → default}/admin/lib/ui/menu.tsx +3 -11
- package/resources/templates/{template-workspace → default}/admin/lib/ui/overlay.tsx +11 -9
- package/resources/templates/{template-workspace → default}/admin/lib/ui/popover.tsx +2 -2
- package/resources/templates/{template-workspace → default}/admin/lib/ui/property-list.tsx +5 -5
- package/resources/templates/{template-workspace → default}/admin/lib/ui/scroll-area.tsx +11 -11
- package/resources/templates/{template-workspace → default}/admin/lib/ui/select.tsx +4 -5
- package/resources/templates/{template-workspace → default}/admin/lib/ui/sheet.tsx +9 -8
- package/resources/templates/{template-workspace → default}/admin/lib/ui/sidebar.tsx +53 -42
- package/resources/templates/{template-workspace → default}/admin/lib/ui/sortable.tsx +1 -1
- package/resources/templates/default/admin/lib/ui/switch.tsx +11 -0
- package/resources/templates/{template-workspace → default}/admin/lib/ui/table.tsx +3 -3
- package/resources/templates/{template-workspace → default}/admin/lib/ui/textarea.tsx +10 -7
- package/resources/templates/{template-workspace → default}/admin/lib/ui/toggle-group.tsx +9 -5
- package/resources/templates/{template-workspace → default}/admin/lib/ui/toggle.tsx +3 -5
- package/resources/templates/{template-workspace → default}/admin/lib/ui/tooltip.tsx +4 -3
- package/resources/templates/{template-workspace → default}/admin/lib/upload/dropzone.tsx +14 -10
- package/resources/templates/{template-workspace → default}/admin/lib/upload/repeater.tsx +0 -1
- package/resources/templates/{template-workspace → default}/admin/lib/upload/ui.tsx +4 -8
- package/resources/templates/{template-workspace → default}/admin/lib/upload/upload-progress.tsx +28 -12
- package/resources/templates/{template-workspace → default}/admin/lib/upload/view.tsx +130 -68
- package/resources/templates/{template-workspace → default}/admin/lib/utils/createComponentOpenHooks.tsx +10 -6
- package/resources/templates/{template-workspace → default}/admin/lib/utils/uic.tsx +24 -14
- package/resources/templates/{template-workspace → default}/admin/lib/utils/use-mobile.ts +1 -3
- package/resources/templates/{template-workspace → default}/admin/package.json +6 -4
- package/resources/templates/default/admin/sentry.ts +26 -0
- package/resources/templates/{template-workspace → default}/admin/tsconfig.json +1 -9
- package/resources/templates/default/admin/vite-env.d.ts +12 -0
- package/resources/templates/default/admin/vite.config.ts +11 -0
- package/resources/templates/default/api/README.md +87 -0
- package/resources/templates/{template-workspace → default}/biome.json +1 -1
- package/resources/templates/default/client/README.md +285 -0
- package/resources/templates/{template-workspace → default}/contember.template.yaml +5 -0
- package/resources/templates/{template-workspace → default}/package.json +1 -1
- package/resources/templates/default/scripts/generate-client.sh +7 -0
- package/resources/templates/default/scripts/update-ui-lib.sh +344 -0
- package/src/commands/WorkspaceCreateCommand.ts +41 -25
- package/src/lib/FileSystem.ts +1 -0
- package/src/lib/TemplateInstaller.ts +32 -12
- package/src/lib/packageManagerDetector.ts +24 -0
- package/src/run.ts +8 -7
- package/dist/types/tsconfig.tsbuildinfo +0 -1
- package/resources/templates/template-workspace/.gitignore.dist +0 -3
- package/resources/templates/template-workspace/admin/app/components/navigation.tsx +0 -1
- package/resources/templates/template-workspace/admin/index.css +0 -53
- package/resources/templates/template-workspace/admin/index.tsx +0 -268
- package/resources/templates/template-workspace/admin/lib/binding/identity.tsx +0 -50
- package/resources/templates/template-workspace/admin/lib/datagrid/elements.tsx +0 -48
- package/resources/templates/template-workspace/admin/lib/dimensions/dimensions.tsx +0 -135
- package/resources/templates/template-workspace/admin/lib/editor/common/buttons.tsx +0 -83
- package/resources/templates/template-workspace/admin/lib/editor/common/elements/BlockElement.tsx +0 -48
- package/resources/templates/template-workspace/admin/lib/editor/sortable-block.tsx +0 -51
- package/resources/templates/template-workspace/admin/lib/form/container.tsx +0 -59
- package/resources/templates/template-workspace/admin/lib/form/upload-repeaters.tsx +0 -188
- package/resources/templates/template-workspace/admin/lib/select/multi-select.tsx +0 -96
- package/resources/templates/template-workspace/admin/lib/select/select.tsx +0 -104
- package/resources/templates/template-workspace/admin/lib/select/sortable-select.tsx +0 -136
- package/resources/templates/template-workspace/admin/lib/toast/toast.tsx +0 -112
- package/resources/templates/template-workspace/admin/lib/ui/button.tsx +0 -29
- package/resources/templates/template-workspace/admin/lib/ui/input.tsx +0 -69
- package/resources/templates/template-workspace/admin/lib/ui/switch.tsx +0 -9
- package/resources/templates/template-workspace/admin/postcss.config.js +0 -6
- package/resources/templates/template-workspace/admin/tailwind.config.js +0 -73
- package/resources/templates/template-workspace/admin/vite-env.d.ts +0 -7
- package/resources/templates/template-workspace/scripts/generate-client.sh +0 -8
- package/resources/templates/{template-workspace → default}/.github/scripts/setup-actions-variables.sh +0 -0
- package/resources/templates/{template-workspace → default}/admin/app/components/logo.tsx +0 -0
- package/resources/templates/{template-workspace → default}/admin/app/config.ts +0 -0
- package/resources/templates/{template-workspace → default}/admin/app/index.html +0 -0
- package/resources/templates/{template-workspace → default}/admin/app/pages/index.tsx +0 -0
- package/resources/templates/{template-workspace → default}/admin/lib/binding/delete.tsx +0 -0
- package/resources/templates/{template-workspace → default}/admin/lib/binding/index.ts +0 -0
- package/resources/templates/{template-workspace → default}/admin/lib/block-repeater/index.ts +0 -0
- package/resources/templates/{template-workspace → default}/admin/lib/board/index.ts +0 -0
- package/resources/templates/{template-workspace → default}/admin/lib/buttons/index.ts +0 -0
- package/resources/templates/{template-workspace → default}/admin/lib/buttons/link-back-button.tsx +0 -0
- package/resources/templates/{template-workspace → default}/admin/lib/datagrid/column-leaf.tsx +0 -0
- package/resources/templates/{template-workspace → default}/admin/lib/datagrid/export.tsx +0 -0
- package/resources/templates/{template-workspace → default}/admin/lib/datagrid/filters/index.ts +0 -0
- package/resources/templates/{template-workspace → default}/admin/lib/datagrid/filters/text.tsx +0 -0
- package/resources/templates/{template-workspace → default}/admin/lib/datagrid/grid.tsx +0 -0
- package/resources/templates/{template-workspace → default}/admin/lib/datagrid/index.ts +21 -21
- /package/resources/templates/{template-workspace → default}/admin/lib/datagrid/layout-switcher.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/dev/index.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/dev/todo.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/dimensions/index.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/editor/common/elements/HorizontalRuleRenderer.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/editor/common/elements/ListItemRenderer.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/editor/common/elements/OrderedListRenderer.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/editor/common/elements/ParagraphRenderer.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/editor/common/elements/ScrollTargetRenderer.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/editor/common/elements/UnorderedListRenderer.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/editor/common/index.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/editor/index.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/editor/plugins.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/errors/error-boundary.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/errors/index.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/errors/use-error-formatter.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/field/formatted-field.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/field/index.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/form/index.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/form/labels.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/formatting/formatting.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/formatting/index.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/images/formatImageResizeUrl.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/images/index.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/labels/index.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/layout/index.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/layout/layout.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/outdated-application-dialog/index.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/repeater/index.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/select/highlight.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/select/index.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/tenant/forms/index.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/tenant/hooks/useInvite.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/tenant/index.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/tenant/listing/index.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/tenant/otp/index.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/toast/index.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/ui/avatar.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/ui/collapsible.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/ui/divider.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/ui/label.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/ui/progress.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/ui/separator.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/ui/skeleton.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/upload/index.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/utils/cn.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/utils/index.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/public/favicon.png +0 -0
- /package/resources/templates/{template-workspace → default}/api/index.ts +0 -0
- /package/resources/templates/{template-workspace → default}/api/migrations/.gitkeep +0 -0
- /package/resources/templates/{template-workspace → default}/api/model/index.ts +0 -0
- /package/resources/templates/{template-workspace → default}/api/package.json +0 -0
- /package/resources/templates/{template-workspace → default}/api/tsconfig.json +0 -0
- /package/resources/templates/{template-workspace → default}/client/package.json +0 -0
- /package/resources/templates/{template-workspace → default}/client/src/index.ts +0 -0
- /package/resources/templates/{template-workspace → default}/client/tsconfig.json +0 -0
- /package/resources/templates/{template-workspace → default}/docker-compose.yaml +0 -0
- /package/resources/templates/{template-workspace → default}/tsconfig.json +0 -0
- /package/resources/templates/{template-workspace → default}/tsconfig.settings.json +0 -0
|
@@ -67,11 +67,8 @@ export const DataGridActiveFilterUI = forwardRef<HTMLButtonElement, {
|
|
|
67
67
|
)
|
|
68
68
|
})
|
|
69
69
|
|
|
70
|
-
|
|
71
70
|
export const DataGridSingleFilterUI = forwardRef<HTMLDivElement, { children: ReactNode }>((props, ref) => {
|
|
72
|
-
return
|
|
73
|
-
<div className="flex flex-wrap gap-2 rounded bg-gray-50 items-center text-sm px-2 py-1.5 border" ref={ref} {...props} />
|
|
74
|
-
)
|
|
71
|
+
return <div className="flex flex-wrap gap-2 rounded-sm bg-gray-50 items-center text-sm px-2 py-1.5 border border-gray-200" ref={ref} {...props} />
|
|
75
72
|
})
|
|
76
73
|
|
|
77
74
|
export const DataGridFilterSelectTriggerUI = forwardRef<HTMLButtonElement, { children: ReactNode }>(({
|
|
@@ -80,12 +77,12 @@ export const DataGridFilterSelectTriggerUI = forwardRef<HTMLButtonElement, { chi
|
|
|
80
77
|
}, ref) => {
|
|
81
78
|
return (
|
|
82
79
|
<button className="hover:underline inline-flex items-center gap-2 group px-1" ref={ref} {...props}>
|
|
83
|
-
{children &&
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
>
|
|
80
|
+
{children && (
|
|
81
|
+
<span className="text-xs font-medium">
|
|
82
|
+
{children}
|
|
83
|
+
</span>
|
|
84
|
+
)}
|
|
85
|
+
<span className="bg-gray-100 rounded-full border border-gray-200 group-data-[state=open]:bg-background group-data-[state=open]:shadow-inner h-5 w-5 inline-flex items-center justify-center">
|
|
89
86
|
<PlusIcon className="w-3 h-3" />
|
|
90
87
|
</span>
|
|
91
88
|
</button>
|
|
@@ -125,7 +122,9 @@ export const DataGridFilterSelectItemUI = forwardRef<HTMLButtonElement, DataGrid
|
|
|
125
122
|
onClick={include}
|
|
126
123
|
size="sm"
|
|
127
124
|
className="pl-1 w-full text-left justify-start gap-1 data-[highlighted]:bg-gray-200"
|
|
128
|
-
variant="ghost"
|
|
125
|
+
variant="ghost"
|
|
126
|
+
{...props}
|
|
127
|
+
>
|
|
129
128
|
{isIncluded ? <CheckSquareIcon className="w-3 h-3" /> : <SquareIcon className="w-3 h-3" />}
|
|
130
129
|
<span className={cn('font-normal', isIncluded && 'text-blue-700')}>
|
|
131
130
|
{children}
|
|
@@ -134,23 +133,21 @@ export const DataGridFilterSelectItemUI = forwardRef<HTMLButtonElement, DataGrid
|
|
|
134
133
|
<button
|
|
135
134
|
onClick={exclude}
|
|
136
135
|
className={cn(
|
|
137
|
-
'p-1 border rounded hover:bg-red-200',
|
|
136
|
+
'p-1 border border-gray-200 rounded-sm hover:bg-red-200',
|
|
138
137
|
isExcluded ? 'bg-red-300 shadow-inner' : '',
|
|
139
138
|
)}
|
|
140
139
|
>
|
|
141
140
|
<FilterXIcon className="h-3 w-3" />
|
|
142
141
|
</button>
|
|
143
142
|
</div>
|
|
144
|
-
|
|
145
143
|
)
|
|
146
144
|
})
|
|
147
145
|
|
|
148
|
-
|
|
149
146
|
export const DataGridToolbarUI = uic('div', {
|
|
150
147
|
baseClass: 'flex flex-col md:flex-row gap-2 md:items-end mb-4 items-stretch',
|
|
151
148
|
variants: {
|
|
152
149
|
sticky: {
|
|
153
|
-
true: 'sticky top-
|
|
150
|
+
true: 'sticky -top-4 z-50 bg-background border-b border-gray-200 py-4',
|
|
154
151
|
},
|
|
155
152
|
},
|
|
156
153
|
})
|
|
@@ -8,21 +8,23 @@ export const LoginWithEmail = () => {
|
|
|
8
8
|
const sessionToken = useSessionTokenWithMeta()
|
|
9
9
|
const setSessionToken = useSetSessionToken()
|
|
10
10
|
|
|
11
|
-
return
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
11
|
+
return (
|
|
12
|
+
<>
|
|
13
|
+
<CreateSessionTokenForm
|
|
14
|
+
expiration={3600 * 24 * 7}
|
|
15
|
+
apiToken={sessionToken.propsToken}
|
|
16
|
+
onSuccess={it => {
|
|
17
|
+
setSessionToken(it.result.token)
|
|
18
|
+
}}
|
|
19
|
+
>
|
|
20
|
+
<form>
|
|
21
|
+
<CreateSessionTokenFormFields />
|
|
22
|
+
</form>
|
|
23
|
+
</CreateSessionTokenForm>
|
|
24
|
+
</>
|
|
25
|
+
)
|
|
23
26
|
}
|
|
24
27
|
|
|
25
|
-
|
|
26
28
|
const CreateSessionTokenFormFields = () => {
|
|
27
29
|
const form = useCreateSessionTokenForm()
|
|
28
30
|
|
|
@@ -38,12 +40,17 @@ const CreateSessionTokenFormFields = () => {
|
|
|
38
40
|
{form.state === 'submitting' ? <Loader position="absolute" /> : null}
|
|
39
41
|
|
|
40
42
|
<TenantFormError
|
|
41
|
-
form={form}
|
|
43
|
+
form={form}
|
|
44
|
+
messages={messages}
|
|
42
45
|
/>
|
|
43
46
|
|
|
44
47
|
<TenantFormField
|
|
45
|
-
form={form}
|
|
46
|
-
|
|
48
|
+
form={form}
|
|
49
|
+
messages={messages}
|
|
50
|
+
field="email"
|
|
51
|
+
type="text"
|
|
52
|
+
required
|
|
53
|
+
autoFocus
|
|
47
54
|
>
|
|
48
55
|
E-mail
|
|
49
56
|
</TenantFormField>
|
|
@@ -2,8 +2,18 @@ import { TextFilterArtifactsMatchMode } from '@contember/react-dataview'
|
|
|
2
2
|
import { InviteErrorCodes } from './tenant/hooks/useInvite'
|
|
3
3
|
import { UploaderErrorType } from '@contember/react-uploader'
|
|
4
4
|
import { ChangeMyPasswordFormErrorCode, CreateApiKeyFormErrorCode } from '@contember/interface'
|
|
5
|
-
import {
|
|
6
|
-
|
|
5
|
+
import {
|
|
6
|
+
InviteFormErrorCode,
|
|
7
|
+
LoginFormErrorCode,
|
|
8
|
+
OtpConfirmFormErrorCode,
|
|
9
|
+
OtpPrepareFormErrorCode,
|
|
10
|
+
PasswordlessSignInFormErrorCode,
|
|
11
|
+
PasswordlessSignInInitFormErrorCode,
|
|
12
|
+
PasswordResetFormErrorCode,
|
|
13
|
+
PasswordResetRequestFormErrorCode,
|
|
14
|
+
UpdateProjectMemberFormErrorCode,
|
|
15
|
+
} from '@contember/react-identity'
|
|
16
|
+
import { ActivatePasswordlessOtpErrorCode, WeakPasswordReason } from '@contember/graphql-client-tenant'
|
|
7
17
|
|
|
8
18
|
export const dict = {
|
|
9
19
|
deleteEntityDialog: {
|
|
@@ -67,7 +77,6 @@ export const dict = {
|
|
|
67
77
|
filters: 'Filters',
|
|
68
78
|
exclude: 'Exclude',
|
|
69
79
|
export: 'Export',
|
|
70
|
-
|
|
71
80
|
},
|
|
72
81
|
select: {
|
|
73
82
|
confirmNew: 'Confirm',
|
|
@@ -99,7 +108,7 @@ export const dict = {
|
|
|
99
108
|
VARIABLE_EMPTY: 'Variable is empty',
|
|
100
109
|
VARIABLE_NOT_FOUND: 'Variable not found',
|
|
101
110
|
fallback: 'Failed to invite user',
|
|
102
|
-
} satisfies Record<InviteErrorCodes | 'fallback',
|
|
111
|
+
} satisfies Record<InviteErrorCodes | 'fallback', string>,
|
|
103
112
|
uploader: {
|
|
104
113
|
uploadErrors: {
|
|
105
114
|
httpError: 'HTTP error',
|
|
@@ -209,6 +218,8 @@ export const dict = {
|
|
|
209
218
|
'NO_PASSWORD_SET': 'No password set',
|
|
210
219
|
'PERSON_DISABLED': 'Person disabled',
|
|
211
220
|
'UNKNOWN_EMAIL': 'Unknown email',
|
|
221
|
+
'INVALID_CREDENTIALS': 'Invalid credentials',
|
|
222
|
+
'RATE_LIMIT_EXCEEDED': 'Too many failed attempts, please try again later',
|
|
212
223
|
'OTP_REQUIRED': undefined,
|
|
213
224
|
} satisfies Record<LoginFormErrorCode, string | undefined>,
|
|
214
225
|
idpInitError: 'Failed to initialize IdP login:',
|
|
@@ -256,7 +267,8 @@ export const dict = {
|
|
|
256
267
|
disable: 'Disable',
|
|
257
268
|
disabledSuccess: 'Two-factor authentication was disabled.',
|
|
258
269
|
setupAgain: 'Setup again',
|
|
259
|
-
description:
|
|
270
|
+
description:
|
|
271
|
+
'2-Step Verification provides stronger security for your account by requiring a second step of verification when you sign in. In addition to your password, you’ll also need a code generated by an application on your phone.',
|
|
260
272
|
setupTwoFactor: 'Setup two-factor authentication',
|
|
261
273
|
enabledSuccess: 'Two-factor authentication was enabled.',
|
|
262
274
|
otpToken: 'OTP token',
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Component,
|
|
3
|
+
DimensionLink,
|
|
4
|
+
DimensionRenderer,
|
|
5
|
+
Entity,
|
|
6
|
+
EntityAccessor,
|
|
7
|
+
Field,
|
|
8
|
+
HasOne,
|
|
9
|
+
LabelMiddlewareProvider,
|
|
10
|
+
StaticRender,
|
|
11
|
+
SugaredQualifiedEntityList,
|
|
12
|
+
SugaredRelativeSingleEntity,
|
|
13
|
+
SugaredRelativeSingleField,
|
|
14
|
+
useDimensionState,
|
|
15
|
+
useEntity,
|
|
16
|
+
} from '@contember/interface'
|
|
17
|
+
import { DataView, DataViewEachRow, DataViewLoaderState, DataViewSortingDirections, useDataViewEntityListAccessor } from '@contember/react-dataview'
|
|
18
|
+
import { ReactNode, useMemo } from 'react'
|
|
19
|
+
import { CheckIcon } from 'lucide-react'
|
|
20
|
+
import { Loader } from '../ui/loader'
|
|
21
|
+
import { Popover, PopoverContent, PopoverTrigger } from '../ui/popover'
|
|
22
|
+
import { Button } from '../ui/button'
|
|
23
|
+
import { DimensionLabelUI, DimensionLabelWrapperUI } from '../ui/dimension'
|
|
24
|
+
|
|
25
|
+
export type DimensionsSwitcherProps = {
|
|
26
|
+
options: SugaredQualifiedEntityList['entities']
|
|
27
|
+
orderBy?: DataViewSortingDirections
|
|
28
|
+
dimension: string
|
|
29
|
+
children: ReactNode
|
|
30
|
+
slugField: SugaredRelativeSingleField['field']
|
|
31
|
+
isMulti?: boolean
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export const DimensionsSwitcher = Component(({ options, dimension, children, slugField, orderBy, isMulti }: DimensionsSwitcherProps) => (
|
|
35
|
+
<DataView entities={options} initialSorting={orderBy}>
|
|
36
|
+
<DataViewLoaderState initial refreshing>
|
|
37
|
+
<Loader position="static" />
|
|
38
|
+
</DataViewLoaderState>
|
|
39
|
+
<DataViewLoaderState loaded>
|
|
40
|
+
<Popover>
|
|
41
|
+
<PopoverTrigger asChild>
|
|
42
|
+
<Button variant="outline" size="sm">
|
|
43
|
+
<DimensionSwitcherCurrentValues dimension={dimension} slugField={slugField}>
|
|
44
|
+
{children}
|
|
45
|
+
</DimensionSwitcherCurrentValues>
|
|
46
|
+
</Button>
|
|
47
|
+
</PopoverTrigger>
|
|
48
|
+
<PopoverContent className="p-2" align="start">
|
|
49
|
+
<div className="flex flex-col gap-1">
|
|
50
|
+
<DataViewEachRow>
|
|
51
|
+
<DimensionSwitcherItem dimension={dimension} slugField={slugField} isMulti={isMulti}>
|
|
52
|
+
{children}
|
|
53
|
+
<StaticRender>
|
|
54
|
+
<Field field={slugField} />
|
|
55
|
+
</StaticRender>
|
|
56
|
+
</DimensionSwitcherItem>
|
|
57
|
+
</DataViewEachRow>
|
|
58
|
+
</div>
|
|
59
|
+
</PopoverContent>
|
|
60
|
+
</Popover>
|
|
61
|
+
</DataViewLoaderState>
|
|
62
|
+
</DataView>
|
|
63
|
+
))
|
|
64
|
+
|
|
65
|
+
const DimensionSwitcherCurrentValues = (
|
|
66
|
+
{ children, dimension, slugField }: { children: ReactNode; dimension: string; slugField: SugaredRelativeSingleField['field'] },
|
|
67
|
+
) => {
|
|
68
|
+
const entitiesBySlug = useDimensionEntitiesBySlug(slugField)
|
|
69
|
+
const currentDimensionValue = useDimensionState({
|
|
70
|
+
dimension,
|
|
71
|
+
defaultValue: Object.keys(entitiesBySlug)[0],
|
|
72
|
+
storage: 'local',
|
|
73
|
+
})
|
|
74
|
+
const values = useMemo(() => currentDimensionValue.map(it => entitiesBySlug[it]).filter(Boolean), [currentDimensionValue, entitiesBySlug])
|
|
75
|
+
|
|
76
|
+
return (
|
|
77
|
+
<div className="flex gap-1">
|
|
78
|
+
{values.map(it => (
|
|
79
|
+
<Entity key={it.key} accessor={it}>
|
|
80
|
+
<div className="gap-1 group text-black text-left inline-flex items-center px-1 text-sm border-b border-gray-200">
|
|
81
|
+
<span>{children}</span>
|
|
82
|
+
</div>
|
|
83
|
+
</Entity>
|
|
84
|
+
))}
|
|
85
|
+
</div>
|
|
86
|
+
)
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
const DimensionSwitcherItem = (
|
|
90
|
+
{ children, dimension, slugField, isMulti }: {
|
|
91
|
+
children: ReactNode
|
|
92
|
+
dimension: string
|
|
93
|
+
slugField: SugaredRelativeSingleField['field']
|
|
94
|
+
isMulti?: boolean
|
|
95
|
+
},
|
|
96
|
+
) => {
|
|
97
|
+
const entity = useEntity()
|
|
98
|
+
const slugValue = entity.getField<string>(slugField).value
|
|
99
|
+
|
|
100
|
+
if (!slugValue) return null
|
|
101
|
+
|
|
102
|
+
return (
|
|
103
|
+
<DimensionLink dimension={dimension} value={slugValue} action={isMulti ? 'toggle' : 'set'}>
|
|
104
|
+
<a className="gap-1 group text-gray-800 text-left inline-flex items-center px-1 py-1 text-sm rounded transition-all hover:bg-accent hover:text-accent-foreground group data-[active]:text-black">
|
|
105
|
+
<CheckIcon className="w-3 h-3 hidden group-data-[active]:block" />
|
|
106
|
+
<span className="w-3 h-3 group-data-[active]:hidden" />
|
|
107
|
+
<span>{children}</span>
|
|
108
|
+
</a>
|
|
109
|
+
</DimensionLink>
|
|
110
|
+
)
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export const DimensionLabel = ({ label, dimensionValue }: { label: ReactNode; dimensionValue: ReactNode }) => (
|
|
114
|
+
<DimensionLabelWrapperUI>
|
|
115
|
+
{label}
|
|
116
|
+
<DimensionLabelUI>{dimensionValue}</DimensionLabelUI>
|
|
117
|
+
</DimensionLabelWrapperUI>
|
|
118
|
+
)
|
|
119
|
+
|
|
120
|
+
export type RenderLabelProps = {
|
|
121
|
+
label: ReactNode
|
|
122
|
+
dimensionValue: string | null
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
export type SideDimensionsProps = {
|
|
126
|
+
dimension: string
|
|
127
|
+
as: string
|
|
128
|
+
field: SugaredRelativeSingleEntity['field']
|
|
129
|
+
children: ReactNode
|
|
130
|
+
renderLabel?: ({ label, dimensionValue }: RenderLabelProps) => ReactNode
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export const SideDimensions = Component<SideDimensionsProps>(({ dimension, children, as, field, renderLabel }) => (
|
|
134
|
+
<div className="flex mt-4 gap-4">
|
|
135
|
+
<DimensionRenderer dimension={dimension} as={as}>
|
|
136
|
+
<LabelMiddlewareProvider
|
|
137
|
+
value={(label, environment) => {
|
|
138
|
+
const dimensionValue = environment.getVariableOrElse(as, null) as string | null
|
|
139
|
+
const Component = renderLabel || DimensionLabel
|
|
140
|
+
|
|
141
|
+
return <Component label={label} dimensionValue={dimensionValue} />
|
|
142
|
+
}}
|
|
143
|
+
>
|
|
144
|
+
<HasOne field={field}>
|
|
145
|
+
<div className="flex-1">{children}</div>
|
|
146
|
+
</HasOne>
|
|
147
|
+
</LabelMiddlewareProvider>
|
|
148
|
+
</DimensionRenderer>
|
|
149
|
+
</div>
|
|
150
|
+
))
|
|
151
|
+
|
|
152
|
+
const useDimensionEntitiesBySlug = (slugField: SugaredRelativeSingleField['field']): Record<string, EntityAccessor> => {
|
|
153
|
+
const accessor = useDataViewEntityListAccessor()
|
|
154
|
+
|
|
155
|
+
return useMemo(
|
|
156
|
+
() => Object.fromEntries(Array.from(accessor ?? []).map(it => [it.getField<string>(slugField).value, it])),
|
|
157
|
+
[accessor, slugField],
|
|
158
|
+
)
|
|
159
|
+
}
|
package/resources/templates/{template-workspace → default}/admin/lib/editor/block-editor.tsx
RENAMED
|
@@ -6,7 +6,17 @@ import { Component, SugaredRelativeEntityList, SugaredRelativeSingleField } from
|
|
|
6
6
|
import { SortableContext, verticalListSortingStrategy } from '@dnd-kit/sortable'
|
|
7
7
|
import { useSlate, useSlateStatic } from 'slate-react'
|
|
8
8
|
import { blockEditorPlugins } from './plugins'
|
|
9
|
-
import {
|
|
9
|
+
import {
|
|
10
|
+
closestCenter,
|
|
11
|
+
DndContext,
|
|
12
|
+
DragEndEvent,
|
|
13
|
+
KeyboardSensor,
|
|
14
|
+
MeasuringStrategy,
|
|
15
|
+
MouseSensor,
|
|
16
|
+
TouchSensor,
|
|
17
|
+
useSensor,
|
|
18
|
+
useSensors,
|
|
19
|
+
} from '@dnd-kit/core'
|
|
10
20
|
import { Transforms } from 'slate'
|
|
11
21
|
|
|
12
22
|
export type BlockEditorFieldProps =
|
|
@@ -19,14 +29,17 @@ export type BlockEditorFieldProps =
|
|
|
19
29
|
|
|
20
30
|
export const BlockEditorField = Component<BlockEditorFieldProps>(({ placeholder, children, ...props }) => {
|
|
21
31
|
return (
|
|
22
|
-
<BlockEditor
|
|
23
|
-
...
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
32
|
+
<BlockEditor
|
|
33
|
+
{...props as BlockEditorProps}
|
|
34
|
+
plugins={[
|
|
35
|
+
...blockEditorPlugins,
|
|
36
|
+
...props.plugins ?? [],
|
|
37
|
+
withReferences({
|
|
38
|
+
field: props.referencesField,
|
|
39
|
+
discriminationField: props.referenceDiscriminationField,
|
|
40
|
+
}),
|
|
41
|
+
]}
|
|
42
|
+
>
|
|
30
43
|
<SortableBlockEditor>
|
|
31
44
|
<BlockEditorInner placeholder={placeholder}>
|
|
32
45
|
{children}
|
|
@@ -103,7 +116,6 @@ export const BlockEditorInner = ({ children, placeholder }: {
|
|
|
103
116
|
}),
|
|
104
117
|
placeholder: placeholder,
|
|
105
118
|
}}
|
|
106
|
-
|
|
107
119
|
>
|
|
108
120
|
{children}
|
|
109
121
|
</EditorCanvas>
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
import {
|
|
2
|
+
anchorElementType,
|
|
3
|
+
boldMark,
|
|
4
|
+
codeMark,
|
|
5
|
+
createAlignHandler,
|
|
6
|
+
EditorElementTrigger,
|
|
7
|
+
EditorGenericTrigger,
|
|
8
|
+
EditorMarkTrigger,
|
|
9
|
+
headingElementType,
|
|
10
|
+
highlightMark,
|
|
11
|
+
horizontalRuleElementType,
|
|
12
|
+
italicMark,
|
|
13
|
+
orderedListElementType,
|
|
14
|
+
paragraphElementType,
|
|
15
|
+
scrollTargetElementType,
|
|
16
|
+
strikeThroughMark,
|
|
17
|
+
tableElementType,
|
|
18
|
+
underlineMark,
|
|
19
|
+
unorderedListElementType,
|
|
20
|
+
} from '@contember/react-slate-editor-base'
|
|
21
|
+
import * as React from 'react'
|
|
22
|
+
import { ReactNode } from 'react'
|
|
23
|
+
import { Toggle } from '../../ui/toggle'
|
|
24
|
+
import {
|
|
25
|
+
AlignCenterIcon,
|
|
26
|
+
AlignJustifyIcon,
|
|
27
|
+
AlignLeftIcon,
|
|
28
|
+
AlignRightIcon,
|
|
29
|
+
BoldIcon,
|
|
30
|
+
CodeIcon,
|
|
31
|
+
HashIcon,
|
|
32
|
+
Heading1Icon,
|
|
33
|
+
Heading2Icon,
|
|
34
|
+
Heading3Icon,
|
|
35
|
+
Heading4Icon,
|
|
36
|
+
Heading5Icon,
|
|
37
|
+
Heading6Icon,
|
|
38
|
+
HighlighterIcon,
|
|
39
|
+
ItalicIcon,
|
|
40
|
+
LinkIcon,
|
|
41
|
+
ListIcon,
|
|
42
|
+
ListOrderedIcon,
|
|
43
|
+
LocateIcon,
|
|
44
|
+
MinusIcon,
|
|
45
|
+
PilcrowIcon,
|
|
46
|
+
StrikethroughIcon,
|
|
47
|
+
TableIcon,
|
|
48
|
+
UnderlineIcon,
|
|
49
|
+
} from 'lucide-react'
|
|
50
|
+
|
|
51
|
+
export const editorButtons: ReactNode = (
|
|
52
|
+
<>
|
|
53
|
+
<EditorMarkTrigger mark={boldMark}>
|
|
54
|
+
<Toggle>
|
|
55
|
+
<BoldIcon className="h-3 w-3" />
|
|
56
|
+
</Toggle>
|
|
57
|
+
</EditorMarkTrigger>
|
|
58
|
+
<EditorMarkTrigger mark={italicMark}>
|
|
59
|
+
<Toggle>
|
|
60
|
+
<ItalicIcon className="h-3 w-3" />
|
|
61
|
+
</Toggle>
|
|
62
|
+
</EditorMarkTrigger>
|
|
63
|
+
<EditorMarkTrigger mark={underlineMark}>
|
|
64
|
+
<Toggle>
|
|
65
|
+
<UnderlineIcon className="h-3 w-3" />
|
|
66
|
+
</Toggle>
|
|
67
|
+
</EditorMarkTrigger>
|
|
68
|
+
<EditorMarkTrigger mark={strikeThroughMark}>
|
|
69
|
+
<Toggle>
|
|
70
|
+
<StrikethroughIcon className="h-3 w-3" />
|
|
71
|
+
</Toggle>
|
|
72
|
+
</EditorMarkTrigger>
|
|
73
|
+
<EditorMarkTrigger mark={highlightMark}>
|
|
74
|
+
<Toggle>
|
|
75
|
+
<HighlighterIcon className="h-3 w-3" />
|
|
76
|
+
</Toggle>
|
|
77
|
+
</EditorMarkTrigger>
|
|
78
|
+
<EditorMarkTrigger mark={codeMark}>
|
|
79
|
+
<Toggle>
|
|
80
|
+
<CodeIcon className="h-3 w-3" />
|
|
81
|
+
</Toggle>
|
|
82
|
+
</EditorMarkTrigger>
|
|
83
|
+
<EditorElementTrigger elementType={anchorElementType}>
|
|
84
|
+
<Toggle>
|
|
85
|
+
<LinkIcon className="h-3 w-3" />
|
|
86
|
+
</Toggle>
|
|
87
|
+
</EditorElementTrigger>
|
|
88
|
+
<EditorElementTrigger elementType={headingElementType} suchThat={{ level: 1, isNumbered: false }}>
|
|
89
|
+
<Toggle>
|
|
90
|
+
<Heading1Icon className="h-3 w-3" />
|
|
91
|
+
</Toggle>
|
|
92
|
+
</EditorElementTrigger>
|
|
93
|
+
<EditorElementTrigger elementType={headingElementType} suchThat={{ level: 1, isNumbered: true }}>
|
|
94
|
+
<Toggle className="relative">
|
|
95
|
+
<Heading1Icon className="h-3 w-3" /> <HashIcon className="h-2.5 w-2.5 absolute right-2 top-1" />
|
|
96
|
+
</Toggle>
|
|
97
|
+
</EditorElementTrigger>
|
|
98
|
+
<EditorElementTrigger elementType={headingElementType} suchThat={{ level: 2, isNumbered: false }}>
|
|
99
|
+
<Toggle>
|
|
100
|
+
<Heading2Icon className="h-3 w-3" />
|
|
101
|
+
</Toggle>
|
|
102
|
+
</EditorElementTrigger>
|
|
103
|
+
<EditorElementTrigger elementType={headingElementType} suchThat={{ level: 2, isNumbered: true }}>
|
|
104
|
+
<Toggle className="relative">
|
|
105
|
+
<Heading2Icon className="h-3 w-3" /> <HashIcon className="h-2.5 w-2.5 absolute right-2 top-1" />
|
|
106
|
+
</Toggle>
|
|
107
|
+
</EditorElementTrigger>
|
|
108
|
+
<EditorElementTrigger elementType={headingElementType} suchThat={{ level: 3, isNumbered: false }}>
|
|
109
|
+
<Toggle>
|
|
110
|
+
<Heading3Icon className="h-3 w-3" />
|
|
111
|
+
</Toggle>
|
|
112
|
+
</EditorElementTrigger>
|
|
113
|
+
<EditorElementTrigger elementType={headingElementType} suchThat={{ level: 3, isNumbered: true }}>
|
|
114
|
+
<Toggle className="relative">
|
|
115
|
+
<Heading3Icon className="h-3 w-3" /> <HashIcon className="h-2.5 w-2.5 absolute right-2 top-1" />
|
|
116
|
+
</Toggle>
|
|
117
|
+
</EditorElementTrigger>
|
|
118
|
+
<EditorElementTrigger elementType={headingElementType} suchThat={{ level: 4, isNumbered: false }}>
|
|
119
|
+
<Toggle>
|
|
120
|
+
<Heading4Icon className="h-3 w-3" />
|
|
121
|
+
</Toggle>
|
|
122
|
+
</EditorElementTrigger>
|
|
123
|
+
<EditorElementTrigger elementType={headingElementType} suchThat={{ level: 4, isNumbered: true }}>
|
|
124
|
+
<Toggle className="relative">
|
|
125
|
+
<Heading4Icon className="h-3 w-3" /> <HashIcon className="h-2.5 w-2.5 absolute right-2 top-1" />
|
|
126
|
+
</Toggle>
|
|
127
|
+
</EditorElementTrigger>
|
|
128
|
+
<EditorElementTrigger elementType={headingElementType} suchThat={{ level: 5, isNumbered: false }}>
|
|
129
|
+
<Toggle>
|
|
130
|
+
<Heading5Icon className="h-3 w-3" />
|
|
131
|
+
</Toggle>
|
|
132
|
+
</EditorElementTrigger>
|
|
133
|
+
<EditorElementTrigger elementType={headingElementType} suchThat={{ level: 5, isNumbered: true }}>
|
|
134
|
+
<Toggle className="relative">
|
|
135
|
+
<Heading5Icon className="h-3 w-3" /> <HashIcon className="h-2.5 w-2.5 absolute right-2 top-1" />
|
|
136
|
+
</Toggle>
|
|
137
|
+
</EditorElementTrigger>
|
|
138
|
+
<EditorElementTrigger elementType={headingElementType} suchThat={{ level: 6, isNumbered: false }}>
|
|
139
|
+
<Toggle>
|
|
140
|
+
<Heading6Icon className="h-3 w-3" />
|
|
141
|
+
</Toggle>
|
|
142
|
+
</EditorElementTrigger>
|
|
143
|
+
<EditorElementTrigger elementType={headingElementType} suchThat={{ level: 6, isNumbered: true }}>
|
|
144
|
+
<Toggle className="relative">
|
|
145
|
+
<Heading6Icon className="h-3 w-3" />
|
|
146
|
+
<HashIcon className="h-2.5 w-2.5 absolute right-2 top-1" />
|
|
147
|
+
</Toggle>
|
|
148
|
+
</EditorElementTrigger>
|
|
149
|
+
<EditorElementTrigger elementType={horizontalRuleElementType}>
|
|
150
|
+
<Toggle>
|
|
151
|
+
<MinusIcon className="h-3 w-3" />
|
|
152
|
+
</Toggle>
|
|
153
|
+
</EditorElementTrigger>
|
|
154
|
+
<EditorElementTrigger elementType={unorderedListElementType}>
|
|
155
|
+
<Toggle>
|
|
156
|
+
<ListIcon className="h-3 w-3" />
|
|
157
|
+
</Toggle>
|
|
158
|
+
</EditorElementTrigger>
|
|
159
|
+
<EditorElementTrigger elementType={orderedListElementType}>
|
|
160
|
+
<Toggle>
|
|
161
|
+
<ListOrderedIcon className="h-3 w-3" />
|
|
162
|
+
</Toggle>
|
|
163
|
+
</EditorElementTrigger>
|
|
164
|
+
<EditorElementTrigger elementType={scrollTargetElementType}>
|
|
165
|
+
<Toggle>
|
|
166
|
+
<LocateIcon className="h-3 w-3" />
|
|
167
|
+
</Toggle>
|
|
168
|
+
</EditorElementTrigger>
|
|
169
|
+
<EditorElementTrigger elementType={paragraphElementType} suchThat={{ isNumbered: false }}>
|
|
170
|
+
<Toggle>
|
|
171
|
+
<PilcrowIcon className="h-3 w-3" />
|
|
172
|
+
</Toggle>
|
|
173
|
+
</EditorElementTrigger>
|
|
174
|
+
<EditorElementTrigger elementType={paragraphElementType} suchThat={{ isNumbered: true }}>
|
|
175
|
+
<Toggle className="relative">
|
|
176
|
+
<PilcrowIcon className="h-3 w-3" /> <HashIcon className="h-2.5 w-2.5 absolute right-2 top-1" />
|
|
177
|
+
</Toggle>
|
|
178
|
+
</EditorElementTrigger>
|
|
179
|
+
<EditorElementTrigger elementType={tableElementType}>
|
|
180
|
+
<Toggle>
|
|
181
|
+
<TableIcon className="h-3 w-3" />
|
|
182
|
+
</Toggle>
|
|
183
|
+
</EditorElementTrigger>
|
|
184
|
+
<EditorGenericTrigger {...createAlignHandler('start')}>
|
|
185
|
+
<Toggle>
|
|
186
|
+
<AlignLeftIcon className="h-3 w-3" />
|
|
187
|
+
</Toggle>
|
|
188
|
+
</EditorGenericTrigger>
|
|
189
|
+
<EditorGenericTrigger {...createAlignHandler('end')}>
|
|
190
|
+
<Toggle>
|
|
191
|
+
<AlignRightIcon className="h-3 w-3" />
|
|
192
|
+
</Toggle>
|
|
193
|
+
</EditorGenericTrigger>
|
|
194
|
+
<EditorGenericTrigger {...createAlignHandler('center')}>
|
|
195
|
+
<Toggle>
|
|
196
|
+
<AlignCenterIcon className="h-3 w-3" />
|
|
197
|
+
</Toggle>
|
|
198
|
+
</EditorGenericTrigger>
|
|
199
|
+
<EditorGenericTrigger {...createAlignHandler('justify')}>
|
|
200
|
+
<Toggle>
|
|
201
|
+
<AlignJustifyIcon className="h-3 w-3" />
|
|
202
|
+
</Toggle>
|
|
203
|
+
</EditorGenericTrigger>
|
|
204
|
+
</>
|
|
205
|
+
)
|
|
@@ -11,7 +11,9 @@ export const EditorBlockToolbar = memo(({ children }: EditorBlockToolbarProps) =
|
|
|
11
11
|
|
|
12
12
|
return (
|
|
13
13
|
<div className="sticky bottom-0" contentEditable={false}>
|
|
14
|
-
<div className={cn('-mx-3 -mb-2 p-2 rounded-b-md border-t bg-gray-50 flex flex-wrap gap-2', !selection && 'pointer-events-none')}>
|
|
14
|
+
<div className={cn('-mx-3 -mb-2 p-2 rounded-b-md border-t border-gray-200 bg-gray-50 flex flex-wrap gap-2', !selection && 'pointer-events-none')}>
|
|
15
|
+
{children}
|
|
16
|
+
</div>
|
|
15
17
|
</div>
|
|
16
18
|
)
|
|
17
19
|
})
|
package/resources/templates/{template-workspace → default}/admin/lib/editor/common/editor-canvas.tsx
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { dataAttribute } from '@contember/utilities'
|
|
2
2
|
import { ComponentType, memo, ReactElement, ReactNode, TextareaHTMLAttributes } from 'react'
|
|
3
3
|
|
|
4
|
-
export interface HTMLTextAreaDivTargetProps extends TextareaHTMLAttributes<HTMLDivElement> {
|
|
4
|
+
export interface HTMLTextAreaDivTargetProps extends TextareaHTMLAttributes<HTMLDivElement> {}
|
|
5
5
|
|
|
6
6
|
export interface EditorCanvasProps<P extends HTMLTextAreaDivTargetProps> {
|
|
7
7
|
underlyingComponent: ComponentType<P>
|
|
@@ -16,10 +16,12 @@ export const EditorCanvas = memo(<P extends HTMLTextAreaDivTargetProps>({
|
|
|
16
16
|
underlyingComponent: Component,
|
|
17
17
|
componentProps: props,
|
|
18
18
|
}: EditorCanvasProps<P>) => {
|
|
19
|
-
|
|
20
19
|
return (
|
|
21
|
-
<div
|
|
22
|
-
|
|
20
|
+
<div
|
|
21
|
+
data-focus-ring={dataAttribute(focusRing)}
|
|
22
|
+
className={'relative w-full rounded-md border border-gray-200 border-input bg-transparent px-3 py-2 text-sm shadow-xs placeholder:text-muted-foreground focus-within:outline-hidden focus-within:ring-1 focus-within:ring-ring disabled:cursor-not-allowed disabled:opacity-50'}
|
|
23
|
+
>
|
|
24
|
+
<Component className="outline-hidden" {...props} />
|
|
23
25
|
{children}
|
|
24
26
|
</div>
|
|
25
27
|
)
|
|
@@ -5,7 +5,6 @@ import { Editable, useSlate } from 'slate-react'
|
|
|
5
5
|
type EditableProps = typeof Editable extends (p: infer P) => any ? P : never
|
|
6
6
|
|
|
7
7
|
export interface EditorEditableCanvasProps extends EditableProps {
|
|
8
|
-
|
|
9
8
|
}
|
|
10
9
|
|
|
11
10
|
export const EditorEditableCanvas = (editableProps: EditorEditableCanvasProps) => {
|
|
@@ -36,7 +36,10 @@ export const EditorInlineToolbar = memo(({ children }: EditorInlineToolbarProps)
|
|
|
36
36
|
Math.max(0, document.documentElement.clientWidth - toolbar.offsetWidth),
|
|
37
37
|
Math.max(
|
|
38
38
|
0,
|
|
39
|
-
Math.min(
|
|
39
|
+
Math.min(
|
|
40
|
+
parentRect.width - toolbar.offsetWidth - borderWidth * 2,
|
|
41
|
+
rangeRect.left - parentRect.left - toolbar.offsetWidth / 2 + rangeRect.width / 2,
|
|
42
|
+
),
|
|
40
43
|
),
|
|
41
44
|
)
|
|
42
45
|
toolbar.style.top = `${top}px`
|
|
@@ -53,7 +56,7 @@ export const EditorInlineToolbar = memo(({ children }: EditorInlineToolbarProps)
|
|
|
53
56
|
return (
|
|
54
57
|
<>
|
|
55
58
|
<div className="absolute p-2" ref={ref}>
|
|
56
|
-
<div className="p-1 rounded-xl shadow-md border bg-
|
|
59
|
+
<div className="p-1 rounded-xl shadow-md border border-gray-200 bg-background space-x-1">{children}</div>
|
|
57
60
|
</div>
|
|
58
61
|
</>
|
|
59
62
|
)
|