@contember/create 1.4.0-rc.4 → 1.4.0-rc.5

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.
Files changed (223) hide show
  1. package/dist/src/commands/WorkspaceCreateCommand.d.ts +4 -3
  2. package/dist/src/commands/WorkspaceCreateCommand.d.ts.map +1 -1
  3. package/dist/src/commands/WorkspaceCreateCommand.js +10 -4
  4. package/dist/src/commands/WorkspaceCreateCommand.js.map +1 -1
  5. package/dist/src/lib/FileSystem.d.ts +14 -0
  6. package/dist/src/lib/FileSystem.d.ts.map +1 -0
  7. package/dist/src/lib/FileSystem.js +54 -0
  8. package/dist/src/lib/FileSystem.js.map +1 -0
  9. package/dist/src/lib/PackageDownloader.d.ts +7 -0
  10. package/dist/src/lib/PackageDownloader.d.ts.map +1 -0
  11. package/dist/src/lib/PackageDownloader.js +32 -0
  12. package/dist/src/lib/PackageDownloader.js.map +1 -0
  13. package/dist/src/lib/TemplateInstaller.d.ts +13 -0
  14. package/dist/src/lib/TemplateInstaller.d.ts.map +1 -0
  15. package/dist/src/lib/TemplateInstaller.js +75 -0
  16. package/dist/src/lib/TemplateInstaller.js.map +1 -0
  17. package/dist/src/lib/pathUtils.d.ts +3 -0
  18. package/dist/src/lib/pathUtils.d.ts.map +1 -0
  19. package/dist/src/lib/pathUtils.js +7 -0
  20. package/dist/src/lib/pathUtils.js.map +1 -0
  21. package/dist/src/run.js +7 -3
  22. package/dist/src/run.js.map +1 -1
  23. package/dist/src/tsconfig.tsbuildinfo +1 -1
  24. package/package.json +9 -3
  25. package/resources/templates/template-workspace/.gitignore.dist +3 -0
  26. package/resources/templates/template-workspace/admin/.env.development +3 -0
  27. package/resources/templates/template-workspace/admin/.env.production +3 -0
  28. package/resources/templates/template-workspace/admin/app/components/layout.tsx +32 -0
  29. package/resources/templates/template-workspace/admin/app/components/logo.tsx +16 -0
  30. package/resources/templates/template-workspace/admin/app/components/navigation.tsx +1 -0
  31. package/resources/templates/template-workspace/admin/app/config.ts +27 -0
  32. package/resources/templates/template-workspace/admin/app/index.html +15 -0
  33. package/resources/templates/template-workspace/admin/app/index.tsx +40 -0
  34. package/resources/templates/template-workspace/admin/app/pages/index.tsx +5 -0
  35. package/resources/templates/template-workspace/admin/index.css +53 -0
  36. package/resources/templates/template-workspace/admin/index.html +13 -0
  37. package/resources/templates/template-workspace/admin/index.tsx +268 -0
  38. package/resources/templates/template-workspace/admin/lib/binding/binding.tsx +45 -0
  39. package/resources/templates/template-workspace/admin/lib/binding/delete.tsx +43 -0
  40. package/resources/templates/template-workspace/admin/lib/binding/hooks.tsx +71 -0
  41. package/resources/templates/template-workspace/admin/lib/binding/identity.tsx +19 -0
  42. package/resources/templates/template-workspace/admin/lib/binding/index.ts +5 -0
  43. package/resources/templates/template-workspace/admin/lib/binding/persist.tsx +70 -0
  44. package/resources/templates/template-workspace/admin/lib/block-repeater/block-repeater.tsx +224 -0
  45. package/resources/templates/template-workspace/admin/lib/block-repeater/index.ts +1 -0
  46. package/resources/templates/template-workspace/admin/lib/board/board.tsx +240 -0
  47. package/resources/templates/template-workspace/admin/lib/board/index.ts +1 -0
  48. package/resources/templates/template-workspace/admin/lib/buttons/back-button.tsx +20 -0
  49. package/resources/templates/template-workspace/admin/lib/buttons/index.ts +2 -0
  50. package/resources/templates/template-workspace/admin/lib/buttons/link-back-button.tsx +21 -0
  51. package/resources/templates/template-workspace/admin/lib/datagrid/cells.tsx +64 -0
  52. package/resources/templates/template-workspace/admin/lib/datagrid/column-header.tsx +65 -0
  53. package/resources/templates/template-workspace/admin/lib/datagrid/columns.tsx +166 -0
  54. package/resources/templates/template-workspace/admin/lib/datagrid/elements.tsx +42 -0
  55. package/resources/templates/template-workspace/admin/lib/datagrid/empty.tsx +8 -0
  56. package/resources/templates/template-workspace/admin/lib/datagrid/export.tsx +17 -0
  57. package/resources/templates/template-workspace/admin/lib/datagrid/filters/boolean.tsx +76 -0
  58. package/resources/templates/template-workspace/admin/lib/datagrid/filters/common.tsx +29 -0
  59. package/resources/templates/template-workspace/admin/lib/datagrid/filters/date.tsx +153 -0
  60. package/resources/templates/template-workspace/admin/lib/datagrid/filters/enum.tsx +115 -0
  61. package/resources/templates/template-workspace/admin/lib/datagrid/filters/index.ts +7 -0
  62. package/resources/templates/template-workspace/admin/lib/datagrid/filters/mobile.tsx +19 -0
  63. package/resources/templates/template-workspace/admin/lib/datagrid/filters/number.tsx +100 -0
  64. package/resources/templates/template-workspace/admin/lib/datagrid/filters/relation.tsx +180 -0
  65. package/resources/templates/template-workspace/admin/lib/datagrid/filters/text.tsx +121 -0
  66. package/resources/templates/template-workspace/admin/lib/datagrid/grid.tsx +61 -0
  67. package/resources/templates/template-workspace/admin/lib/datagrid/index.ts +16 -0
  68. package/resources/templates/template-workspace/admin/lib/datagrid/layout-switcher.tsx +32 -0
  69. package/resources/templates/template-workspace/admin/lib/datagrid/loader.tsx +10 -0
  70. package/resources/templates/template-workspace/admin/lib/datagrid/pagination.tsx +103 -0
  71. package/resources/templates/template-workspace/admin/lib/datagrid/table.tsx +69 -0
  72. package/resources/templates/template-workspace/admin/lib/datagrid/tiles.tsx +24 -0
  73. package/resources/templates/template-workspace/admin/lib/datagrid/toolbar.tsx +66 -0
  74. package/resources/templates/template-workspace/admin/lib/datagrid/ui.tsx +153 -0
  75. package/resources/templates/template-workspace/admin/lib/dev/index.ts +2 -0
  76. package/resources/templates/template-workspace/admin/lib/dev/login-panel.tsx +56 -0
  77. package/resources/templates/template-workspace/admin/lib/dev/todo.tsx +14 -0
  78. package/resources/templates/template-workspace/admin/lib/dict.ts +324 -0
  79. package/resources/templates/template-workspace/admin/lib/dimensions/dimensions.tsx +135 -0
  80. package/resources/templates/template-workspace/admin/lib/dimensions/index.ts +1 -0
  81. package/resources/templates/template-workspace/admin/lib/editor/block-editor.tsx +111 -0
  82. package/resources/templates/template-workspace/admin/lib/editor/common/baseEditorPlugins.tsx +66 -0
  83. package/resources/templates/template-workspace/admin/lib/editor/common/buttons.tsx +83 -0
  84. package/resources/templates/template-workspace/admin/lib/editor/common/editor-block-toolbar.tsx +17 -0
  85. package/resources/templates/template-workspace/admin/lib/editor/common/editor-canvas.tsx +30 -0
  86. package/resources/templates/template-workspace/admin/lib/editor/common/editor-editable-canvas.tsx +50 -0
  87. package/resources/templates/template-workspace/admin/lib/editor/common/editor-inline-toolbar.tsx +63 -0
  88. package/resources/templates/template-workspace/admin/lib/editor/common/elements/AnchorRenderer.tsx +36 -0
  89. package/resources/templates/template-workspace/admin/lib/editor/common/elements/BlockElement.tsx +48 -0
  90. package/resources/templates/template-workspace/admin/lib/editor/common/elements/HeadingRenderer.tsx +48 -0
  91. package/resources/templates/template-workspace/admin/lib/editor/common/elements/HorizontalRuleRenderer.tsx +28 -0
  92. package/resources/templates/template-workspace/admin/lib/editor/common/elements/ListItemRenderer.tsx +13 -0
  93. package/resources/templates/template-workspace/admin/lib/editor/common/elements/OrderedListRenderer.tsx +13 -0
  94. package/resources/templates/template-workspace/admin/lib/editor/common/elements/ParagraphRenderer.tsx +15 -0
  95. package/resources/templates/template-workspace/admin/lib/editor/common/elements/ScrollTargetRenderer.tsx +30 -0
  96. package/resources/templates/template-workspace/admin/lib/editor/common/elements/TableCellElementRenderer.tsx +20 -0
  97. package/resources/templates/template-workspace/admin/lib/editor/common/elements/TableElementRenderer.tsx +96 -0
  98. package/resources/templates/template-workspace/admin/lib/editor/common/elements/TableRowElementRenderer.tsx +15 -0
  99. package/resources/templates/template-workspace/admin/lib/editor/common/elements/UnorderedListRenderer.tsx +13 -0
  100. package/resources/templates/template-workspace/admin/lib/editor/common/index.ts +6 -0
  101. package/resources/templates/template-workspace/admin/lib/editor/editor-block.tsx +96 -0
  102. package/resources/templates/template-workspace/admin/lib/editor/index.ts +5 -0
  103. package/resources/templates/template-workspace/admin/lib/editor/plugins.tsx +36 -0
  104. package/resources/templates/template-workspace/admin/lib/editor/rich-text.tsx +54 -0
  105. package/resources/templates/template-workspace/admin/lib/editor/sortable-block.tsx +51 -0
  106. package/resources/templates/template-workspace/admin/lib/errors/index.ts +1 -0
  107. package/resources/templates/template-workspace/admin/lib/errors/use-error-formatter.ts +26 -0
  108. package/resources/templates/template-workspace/admin/lib/form/container.tsx +63 -0
  109. package/resources/templates/template-workspace/admin/lib/form/index.ts +5 -0
  110. package/resources/templates/template-workspace/admin/lib/form/inputs.tsx +99 -0
  111. package/resources/templates/template-workspace/admin/lib/form/select.tsx +123 -0
  112. package/resources/templates/template-workspace/admin/lib/form/ui.tsx +29 -0
  113. package/resources/templates/template-workspace/admin/lib/form/upload.tsx +243 -0
  114. package/resources/templates/template-workspace/admin/lib/formatting/formatting.ts +62 -0
  115. package/resources/templates/template-workspace/admin/lib/formatting/index.ts +1 -0
  116. package/resources/templates/template-workspace/admin/lib/images/formatImageResizeUrl.ts +23 -0
  117. package/resources/templates/template-workspace/admin/lib/images/index.ts +1 -0
  118. package/resources/templates/template-workspace/admin/lib/layout/index.ts +2 -0
  119. package/resources/templates/template-workspace/admin/lib/layout/layout.tsx +167 -0
  120. package/resources/templates/template-workspace/admin/lib/layout/slots.tsx +24 -0
  121. package/resources/templates/template-workspace/admin/lib/outdated-application-dialog/index.ts +1 -0
  122. package/resources/templates/template-workspace/admin/lib/outdated-application-dialog/outdated-application-dialog.tsx +41 -0
  123. package/resources/templates/template-workspace/admin/lib/repeater/index.ts +1 -0
  124. package/resources/templates/template-workspace/admin/lib/repeater/repeater.tsx +142 -0
  125. package/resources/templates/template-workspace/admin/lib/select/create-new.tsx +34 -0
  126. package/resources/templates/template-workspace/admin/lib/select/filter.tsx +13 -0
  127. package/resources/templates/template-workspace/admin/lib/select/highlight.tsx +16 -0
  128. package/resources/templates/template-workspace/admin/lib/select/index.ts +7 -0
  129. package/resources/templates/template-workspace/admin/lib/select/list.tsx +49 -0
  130. package/resources/templates/template-workspace/admin/lib/select/multi-select.tsx +95 -0
  131. package/resources/templates/template-workspace/admin/lib/select/pagination.tsx +48 -0
  132. package/resources/templates/template-workspace/admin/lib/select/select.tsx +87 -0
  133. package/resources/templates/template-workspace/admin/lib/select/sortable-select.tsx +129 -0
  134. package/resources/templates/template-workspace/admin/lib/select/ui.tsx +80 -0
  135. package/resources/templates/template-workspace/admin/lib/tenant/forms/change-my-password.tsx +40 -0
  136. package/resources/templates/template-workspace/admin/lib/tenant/forms/common.tsx +94 -0
  137. package/resources/templates/template-workspace/admin/lib/tenant/forms/create-api-key.tsx +39 -0
  138. package/resources/templates/template-workspace/admin/lib/tenant/forms/index.ts +8 -0
  139. package/resources/templates/template-workspace/admin/lib/tenant/forms/invite.tsx +46 -0
  140. package/resources/templates/template-workspace/admin/lib/tenant/forms/login.tsx +52 -0
  141. package/resources/templates/template-workspace/admin/lib/tenant/forms/memberships-control.tsx +128 -0
  142. package/resources/templates/template-workspace/admin/lib/tenant/forms/password-reset-request.tsx +31 -0
  143. package/resources/templates/template-workspace/admin/lib/tenant/forms/password-reset.tsx +44 -0
  144. package/resources/templates/template-workspace/admin/lib/tenant/forms/update-project-member.tsx +32 -0
  145. package/resources/templates/template-workspace/admin/lib/tenant/hooks/useInvite.ts +28 -0
  146. package/resources/templates/template-workspace/admin/lib/tenant/hooks/useInviteUser.tsx +45 -0
  147. package/resources/templates/template-workspace/admin/lib/tenant/index.ts +3 -0
  148. package/resources/templates/template-workspace/admin/lib/tenant/listing/api-key-list.tsx +25 -0
  149. package/resources/templates/template-workspace/admin/lib/tenant/listing/index.ts +4 -0
  150. package/resources/templates/template-workspace/admin/lib/tenant/listing/member-delete-dialog.tsx +38 -0
  151. package/resources/templates/template-workspace/admin/lib/tenant/listing/member-list.tsx +147 -0
  152. package/resources/templates/template-workspace/admin/lib/tenant/listing/person-list.tsx +25 -0
  153. package/resources/templates/template-workspace/admin/lib/tenant/otp/index.ts +1 -0
  154. package/resources/templates/template-workspace/admin/lib/tenant/otp/otp-setup.tsx +146 -0
  155. package/resources/templates/template-workspace/admin/lib/toast/index.ts +2 -0
  156. package/resources/templates/template-workspace/admin/lib/toast/toast.tsx +112 -0
  157. package/resources/templates/template-workspace/admin/lib/toast/toaster.tsx +104 -0
  158. package/resources/templates/template-workspace/admin/lib/ui/alert-dialog.tsx +59 -0
  159. package/resources/templates/template-workspace/admin/lib/ui/button.tsx +29 -0
  160. package/resources/templates/template-workspace/admin/lib/ui/card.tsx +25 -0
  161. package/resources/templates/template-workspace/admin/lib/ui/dialog.tsx +51 -0
  162. package/resources/templates/template-workspace/admin/lib/ui/divider.tsx +11 -0
  163. package/resources/templates/template-workspace/admin/lib/ui/dropdown.tsx +108 -0
  164. package/resources/templates/template-workspace/admin/lib/ui/input.tsx +62 -0
  165. package/resources/templates/template-workspace/admin/lib/ui/label.tsx +7 -0
  166. package/resources/templates/template-workspace/admin/lib/ui/loader.tsx +30 -0
  167. package/resources/templates/template-workspace/admin/lib/ui/menu.tsx +103 -0
  168. package/resources/templates/template-workspace/admin/lib/ui/overlay.tsx +33 -0
  169. package/resources/templates/template-workspace/admin/lib/ui/popover.tsx +31 -0
  170. package/resources/templates/template-workspace/admin/lib/ui/progress.tsx +25 -0
  171. package/resources/templates/template-workspace/admin/lib/ui/scroll-area.tsx +45 -0
  172. package/resources/templates/template-workspace/admin/lib/ui/sheet.tsx +67 -0
  173. package/resources/templates/template-workspace/admin/lib/ui/sortable.tsx +13 -0
  174. package/resources/templates/template-workspace/admin/lib/ui/switch.tsx +10 -0
  175. package/resources/templates/template-workspace/admin/lib/ui/table.tsx +46 -0
  176. package/resources/templates/template-workspace/admin/lib/ui/textarea.tsx +18 -0
  177. package/resources/templates/template-workspace/admin/lib/ui/toggle-group.tsx +44 -0
  178. package/resources/templates/template-workspace/admin/lib/ui/toggle.tsx +29 -0
  179. package/resources/templates/template-workspace/admin/lib/ui/tooltip.tsx +24 -0
  180. package/resources/templates/template-workspace/admin/lib/upload/dropzone.tsx +21 -0
  181. package/resources/templates/template-workspace/admin/lib/upload/index.ts +3 -0
  182. package/resources/templates/template-workspace/admin/lib/upload/repeater.tsx +12 -0
  183. package/resources/templates/template-workspace/admin/lib/upload/ui.tsx +57 -0
  184. package/resources/templates/template-workspace/admin/lib/upload/upload-progress.tsx +130 -0
  185. package/resources/templates/template-workspace/admin/lib/upload/view.tsx +219 -0
  186. package/resources/templates/template-workspace/admin/lib/utils/cn.ts +4 -0
  187. package/resources/templates/template-workspace/admin/lib/utils/dict-format.tsx +3 -0
  188. package/resources/templates/template-workspace/admin/lib/utils/format-image-resize-url.ts +17 -0
  189. package/resources/templates/template-workspace/admin/lib/utils/formatting.ts +60 -0
  190. package/resources/templates/template-workspace/admin/lib/utils/index.ts +2 -0
  191. package/resources/templates/template-workspace/admin/lib/utils/uic.tsx +79 -0
  192. package/resources/templates/template-workspace/admin/package.json +63 -0
  193. package/resources/templates/template-workspace/admin/postcss.config.js +6 -0
  194. package/resources/templates/template-workspace/admin/public/favicon.png +0 -0
  195. package/resources/templates/template-workspace/admin/tailwind.config.js +73 -0
  196. package/resources/templates/template-workspace/admin/tsconfig.json +23 -0
  197. package/resources/templates/template-workspace/admin/vite-env.d.ts +7 -0
  198. package/resources/templates/template-workspace/admin/vite.config.ts +39 -0
  199. package/resources/templates/template-workspace/api/index.ts +7 -0
  200. package/resources/templates/template-workspace/api/migrations/.gitkeep +1 -0
  201. package/resources/templates/template-workspace/api/model/index.ts +1 -0
  202. package/resources/templates/template-workspace/api/package.json +16 -0
  203. package/resources/templates/template-workspace/api/tsconfig.json +10 -0
  204. package/resources/templates/template-workspace/biome.json +45 -0
  205. package/resources/templates/template-workspace/client/package.json +16 -0
  206. package/resources/templates/template-workspace/client/src/index.ts +1 -0
  207. package/resources/templates/template-workspace/client/tsconfig.json +9 -0
  208. package/resources/templates/template-workspace/contember.template.yaml +7 -0
  209. package/resources/templates/template-workspace/docker-compose.yaml +124 -0
  210. package/resources/templates/template-workspace/package.json +32 -0
  211. package/resources/templates/template-workspace/scripts/generate-client.sh +8 -0
  212. package/resources/templates/template-workspace/tsconfig.json +9 -0
  213. package/resources/templates/template-workspace/tsconfig.settings.json +15 -0
  214. package/src/commands/WorkspaceCreateCommand.ts +15 -6
  215. package/src/lib/FileSystem.ts +24 -0
  216. package/src/lib/PackageDownloader.ts +33 -0
  217. package/src/lib/TemplateInstaller.ts +102 -0
  218. package/src/lib/pathUtils.ts +4 -0
  219. package/src/run.ts +14 -5
  220. package/tsconfig.settings.json +5 -1
  221. package/types/download-tarball/index.d.ts +7 -0
  222. package/types/get-package-json-from-registry/index.d.ts +3 -0
  223. package/types/registry-info/index.d.ts +7 -0
@@ -0,0 +1,324 @@
1
+ import { ChangeMyPasswordFormErrorCode, CreateApiKeyFormErrorCode } from '@contember/interface'
2
+ import { TextFilterArtifactsMatchMode } from '@contember/react-dataview'
3
+ import {
4
+ InviteFormErrorCode,
5
+ LoginFormErrorCode,
6
+ OtpConfirmFormErrorCode,
7
+ OtpPrepareFormErrorCode,
8
+ PasswordResetFormErrorCode,
9
+ PasswordResetRequestFormErrorCode,
10
+ UpdateProjectMemberFormErrorCode,
11
+ } from '@contember/react-identity'
12
+ import { UploaderErrorType } from '@contember/react-uploader'
13
+ import { InviteErrorCodes } from './tenant/hooks/useInvite'
14
+
15
+ export const dict = {
16
+ deleteEntityDialog: {
17
+ title: 'Are you absolutely sure?',
18
+ description: 'This action cannot be undone.',
19
+ confirmButton: 'Delete',
20
+ cancelButton: 'Cancel',
21
+ },
22
+ identityLoader: {
23
+ fail: 'Failed to load identity',
24
+ },
25
+ persist: {
26
+ persistButton: 'Save data',
27
+ invalidInputError: 'Failed to save data',
28
+ invalidResponseError: 'Invalid response',
29
+ invalidResponseErrorDetails: 'The server returned an invalid response. Please try again later.',
30
+ success: 'Successfully saved',
31
+ afterPersistError: 'Something wrong has happened after the data were persisted. Please refresh the page.',
32
+ },
33
+ toast: {
34
+ showDetails: 'Show details',
35
+ },
36
+ datagrid: {
37
+ na: 'N/A',
38
+ dateStart: 'From',
39
+ today: 'Today',
40
+ dateEnd: 'To',
41
+ numberFrom: 'From',
42
+ numberTo: 'To',
43
+ textReset: 'Reset filter',
44
+ textPlaceholder: 'Search',
45
+ textMatchMode: {
46
+ matches: 'contains',
47
+ matchesExactly: 'equals',
48
+ startsWith: 'starts with',
49
+ endsWith: 'ends with',
50
+ doesNotMatch: 'does not contain',
51
+ } satisfies Record<TextFilterArtifactsMatchMode, string>,
52
+ visibleFields: 'Fields',
53
+ columnAsc: 'asc',
54
+ columnDesc: 'desc',
55
+ columnHide: 'Hide',
56
+ empty: 'No results.',
57
+ layout: 'Layout',
58
+ showGrid: 'Grid',
59
+ showTable: 'Table',
60
+ paginationFirstPage: 'First page',
61
+ paginationPreviousPage: 'Previous page',
62
+ paginationNextPage: 'Next page',
63
+ paginationLastPage: 'Last page',
64
+ paginationRowsPerPage: 'Rows per page',
65
+
66
+ pageInfo: 'Page ${page} of ${pagesCount}',
67
+ pageInfoShort: 'Page ${page}',
68
+ pageRowsCount: '${totalCount} rows total',
69
+
70
+ filter: 'Filter',
71
+ filters: 'Filters',
72
+ exclude: 'Exclude',
73
+ export: 'Export',
74
+ },
75
+ select: {
76
+ confirmNew: 'Confirm',
77
+ cancelNew: 'Cancel',
78
+ search: 'Search',
79
+ paginationPreviousPage: 'Previous page',
80
+ paginationNextPage: 'Next page',
81
+ placeholder: 'Select',
82
+ },
83
+ backButton: {
84
+ back: 'Back',
85
+ },
86
+
87
+ errors: {
88
+ unique: 'This value is already taken',
89
+ unknown: 'An unknown error has occurred',
90
+ },
91
+
92
+ boolean: {
93
+ true: 'Yes',
94
+ false: 'No',
95
+ },
96
+ logout: 'Log out',
97
+ inviteErrors: {
98
+ ALREADY_MEMBER: 'This user is already a member of the project',
99
+ INVALID_EMAIL_FORMAT: 'Invalid email format',
100
+ INVALID_MEMBERSHIP: 'Invalid membership',
101
+ PROJECT_NOT_FOUND: 'Project not found',
102
+ ROLE_NOT_FOUND: 'Role not found',
103
+ VARIABLE_EMPTY: 'Variable is empty',
104
+ VARIABLE_NOT_FOUND: 'Variable not found',
105
+ fallback: 'Failed to invite user',
106
+ } satisfies Record<InviteErrorCodes | 'fallback', string>,
107
+ uploader: {
108
+ uploadErrors: {
109
+ httpError: 'HTTP error',
110
+ aborted: 'Upload aborted',
111
+ networkError: 'Network error',
112
+ timeout: 'Upload timeout',
113
+ fileRejected: 'File rejected',
114
+ } satisfies Record<UploaderErrorType, string>,
115
+ uploaderUnknownError: 'Unknown error',
116
+
117
+ browseFiles: 'Browse',
118
+ dropFiles: 'Drop files here',
119
+ or: 'or',
120
+ },
121
+ repeater: {
122
+ empty: 'No items.',
123
+ addItem: 'Add item',
124
+ },
125
+ outdatedApplication: {
126
+ title: 'An updated version is available',
127
+ description: 'To access the latest features and improvements, kindly refresh your browser.',
128
+ warning: 'Any unsaved data will be lost. Please save your work before refreshing.',
129
+ snooze: 'Snooze',
130
+ refreshNow: 'Refresh now',
131
+ },
132
+ tenant: {
133
+ memberList: {
134
+ failedToLoadData: 'Failed to load data',
135
+ noResults: 'No results',
136
+ previous: 'Previous',
137
+ next: 'Next',
138
+ roles: 'Roles',
139
+ action: 'Action',
140
+ },
141
+ apiKeyList: {
142
+ deleted: 'API key deleted',
143
+ deleteFailed: 'Failed to delete API key',
144
+ unnamed: 'Unnamed API key',
145
+ noResults: 'No API keys',
146
+ description: 'Description',
147
+ role: 'Role',
148
+ action: 'Action',
149
+ deleteConfirmation: 'Are you sure you want to delete this API key?',
150
+ deleteCancelAction: 'Cancel',
151
+ deleteConfirmAction: 'Delete',
152
+ },
153
+ createApiKey: {
154
+ description: 'Description',
155
+ roles: 'Roles',
156
+ submit: 'Create API key',
157
+ errorMessages: {
158
+ FIELD_REQUIRED: 'This field is required',
159
+ UNKNOWN_ERROR: 'Something went wrong. Please try again later',
160
+ INVALID_MEMBERSHIP: 'Invalid membership',
161
+ PROJECT_NOT_FOUND: 'Project not found',
162
+ ROLE_NOT_FOUND: 'Role not found',
163
+ VARIABLE_EMPTY: 'Variable empty',
164
+ VARIABLE_NOT_FOUND: 'Variable not found',
165
+ } satisfies Record<CreateApiKeyFormErrorCode, string>,
166
+ },
167
+ invite: {
168
+ email: 'Email',
169
+ name: 'Name',
170
+ roles: 'Roles',
171
+ submit: 'Invite',
172
+ errorMessages: {
173
+ FIELD_REQUIRED: 'This field is required',
174
+ UNKNOWN_ERROR: 'Something went wrong. Please try again later',
175
+ ALREADY_MEMBER: 'This person is already a member',
176
+ INVALID_EMAIL_FORMAT: 'Invalid email format',
177
+ INVALID_MEMBERSHIP: 'Invalid membership',
178
+ PROJECT_NOT_FOUND: 'Project not found',
179
+ ROLE_NOT_FOUND: 'Role not found',
180
+ VARIABLE_EMPTY: 'Variable empty',
181
+ VARIABLE_NOT_FOUND: 'Variable not found',
182
+ } satisfies Record<InviteFormErrorCode, string>,
183
+ },
184
+ changePassword: {
185
+ currentPassword: 'Current password',
186
+ newPassword: 'New password',
187
+ confirmPassword: 'Confirm password',
188
+ submit: 'Change password',
189
+ errorMessages: {
190
+ FIELD_REQUIRED: 'This field is required',
191
+ INVALID_VALUE: 'Invalid value',
192
+ UNKNOWN_ERROR: 'Something went wrong. Please try again later',
193
+ PASSWORD_MISMATCH: 'Passwords do not match',
194
+ TOO_WEAK: 'Password is too weak',
195
+ NO_PASSWORD_SET: 'Your account has no password set',
196
+ INVALID_PASSWORD: 'Invalid password',
197
+ NOT_A_PERSON: 'Invalid user',
198
+ } satisfies Record<ChangeMyPasswordFormErrorCode, string>,
199
+ },
200
+ login: {
201
+ email: 'Email',
202
+ password: 'Password',
203
+ otpToken: 'OTP token',
204
+ forgotPassword: 'Forgot password?',
205
+ login: 'Login',
206
+ errorMessages: {
207
+ FIELD_REQUIRED: 'This field is required',
208
+ INVALID_VALUE: 'Invalid value',
209
+ UNKNOWN_ERROR: 'Something went wrong. Please try again later',
210
+ INVALID_PASSWORD: 'Invalid password',
211
+ INVALID_OTP_TOKEN: 'Invalid OTP token',
212
+ NO_PASSWORD_SET: 'No password set',
213
+ PERSON_DISABLED: 'Person disabled',
214
+ UNKNOWN_EMAIL: 'Unknown email',
215
+ OTP_REQUIRED: undefined,
216
+ } satisfies Record<LoginFormErrorCode, string | undefined>,
217
+ idpInitError: 'Failed to initialize IdP login:',
218
+ idpResponseError: 'Failed to process IdP response:',
219
+ title: 'Login',
220
+ description: 'Enter your email below to login to your account',
221
+ backToLogin: 'Back to login',
222
+ },
223
+ personList: {
224
+ email: 'Email',
225
+ name: 'Name',
226
+ deleted: 'Member deleted',
227
+ deleteFailed: 'Failed to delete member',
228
+ noEmail: 'User has no email',
229
+ noName: 'User has no name',
230
+ role: 'Role',
231
+ action: 'Action',
232
+ noResults: 'No members',
233
+ deleteConfirmation: 'Are you sure you want to delete this member?',
234
+ deleteCancelAction: 'Cancel',
235
+ deleteConfirmAction: 'Delete',
236
+ },
237
+ memberDelete: {
238
+ cancel: 'Cancel',
239
+ confirm: 'Confirm',
240
+ },
241
+ otpSetup: {
242
+ prepareContinue: 'Continue',
243
+ otpConfirmFormErrorMessages: {
244
+ UNKNOWN_ERROR: 'Something went wrong. Please try again later',
245
+ INVALID_OTP_TOKEN: 'Invalid OTP token',
246
+ FIELD_REQUIRED: 'This field is required',
247
+ NOT_PREPARED: 'OTP setup was not initialized',
248
+ } satisfies Record<OtpConfirmFormErrorCode, string>,
249
+ otpPrepareFormErrorMessages: {
250
+ UNKNOWN_ERROR: 'Something went wrong. Please try again later',
251
+ } satisfies Record<OtpPrepareFormErrorCode, string>,
252
+ alreadyHaveOtp: 'You already have two-factor authentication active. By clicking "Continue", the old one will no longer work.',
253
+ nowScanQrCode: 'Now scan the following QR code in your application:',
254
+ writeDownCode: 'After registering to your application, write down a code from the application.',
255
+ twoFactorEnabled: 'Two factor authentication is ENABLED.',
256
+ disableTwoFactor: 'Disable two-factor authentication',
257
+ disableTwoFactorConfirm: 'Are you sure you want to disable two-factor authentication?',
258
+ cancel: 'Cancel',
259
+ disable: 'Disable',
260
+ disabledSuccess: 'Two-factor authentication was disabled.',
261
+ setupAgain: 'Setup again',
262
+ description:
263
+ '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.',
264
+ setupTwoFactor: 'Setup two-factor authentication',
265
+ enabledSuccess: 'Two-factor authentication was enabled.',
266
+ otpToken: 'OTP token',
267
+ label: 'Label',
268
+ confirm: 'Confirm',
269
+ },
270
+
271
+ passwordReset: {
272
+ token: 'Reset code',
273
+ password: 'Password',
274
+ passwordConfirmation: 'Confirm password',
275
+ submit: 'Reset password',
276
+ errorMessages: {
277
+ FIELD_REQUIRED: 'This field is required',
278
+ INVALID_VALUE: 'Invalid value',
279
+ UNKNOWN_ERROR: 'Something went wrong. Please try again later',
280
+ PASSWORD_MISMATCH: 'Passwords do not match',
281
+ PASSWORD_TOO_WEAK: 'Password is too weak',
282
+ TOKEN_EXPIRED: 'Token expired',
283
+ TOKEN_NOT_FOUND: 'Token not found',
284
+ TOKEN_USED: 'Token already used',
285
+ } satisfies Record<PasswordResetFormErrorCode, string>,
286
+ title: 'Reset password',
287
+ description: 'Enter new password below',
288
+ success: 'Password has been reset',
289
+ },
290
+ passwordResetRequest: {
291
+ email: 'Email',
292
+ submit: 'Request reset code',
293
+ errorMessages: {
294
+ FIELD_REQUIRED: 'This field is required',
295
+ INVALID_VALUE: 'Invalid value',
296
+ UNKNOWN_ERROR: 'Something went wrong. Please try again later',
297
+ PERSON_NOT_FOUND: 'Unknown email',
298
+ } satisfies Record<PasswordResetRequestFormErrorCode, string>,
299
+ title: 'Reset password',
300
+ description: 'Enter your email below to reset your password',
301
+ success: 'Password reset link has been sent',
302
+ checkMail: 'Please check your mailbox for instructions on how to reset your password.',
303
+ entryCode: 'Or enter the reset code directly.',
304
+ },
305
+ updateProjectMember: {
306
+ updateSuccess: 'Roles updated',
307
+ roles: 'Roles',
308
+ submit: 'Update role',
309
+ errorMessages: {
310
+ FIELD_REQUIRED: 'This field is required',
311
+ UNKNOWN_ERROR: 'Something went wrong. Please try again later',
312
+ INVALID_MEMBERSHIP: 'Invalid membership',
313
+ PROJECT_NOT_FOUND: 'Project not found',
314
+ ROLE_NOT_FOUND: 'Role not found',
315
+ VARIABLE_EMPTY: 'Variable empty',
316
+ VARIABLE_NOT_FOUND: 'Variable not found',
317
+ NOT_MEMBER: 'Not a member',
318
+ } satisfies Record<UpdateProjectMemberFormErrorCode, string>,
319
+ },
320
+ },
321
+ }
322
+ export const dictFormat = (value: string, replacements: Record<string, string>) => {
323
+ return value.replace(/\${([^}]+)}/g, (_, key) => replacements[key] || '')
324
+ }
@@ -0,0 +1,135 @@
1
+ import {
2
+ Component,
3
+ DimensionLink,
4
+ DimensionRenderer,
5
+ Entity,
6
+ EntityAccessor,
7
+ Field,
8
+ HasOne,
9
+ StaticRender,
10
+ SugaredQualifiedEntityList,
11
+ SugaredRelativeSingleEntity,
12
+ SugaredRelativeSingleField,
13
+ useDimensionState,
14
+ useEntity,
15
+ } from '@contember/interface'
16
+ import { DataView, DataViewEachRow, DataViewLoaderState, DataViewSortingDirections, useDataViewEntityListAccessor } from '@contember/react-dataview'
17
+ import * as React from 'react'
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
+
24
+ export interface DimensionsSwitcherProps {
25
+ options: SugaredQualifiedEntityList['entities']
26
+ orderBy?: DataViewSortingDirections
27
+ dimension: string
28
+ children: ReactNode
29
+ slugField: SugaredRelativeSingleField['field']
30
+ isMulti?: boolean
31
+ }
32
+
33
+ export const DimensionsSwitcher = Component(({ options, dimension, children, slugField, orderBy, isMulti }: DimensionsSwitcherProps) => {
34
+ return (
35
+ <DataView entities={options} initialSorting={orderBy}>
36
+ <DataViewLoaderState initial refreshing>
37
+ <Loader position={'static'} />
38
+ </DataViewLoaderState>
39
+ <DataViewLoaderState loaded>
40
+
41
+ <Popover>
42
+ <PopoverTrigger>
43
+ <Button variant={'outline'} size="sm">
44
+ <DimensionSwitcherCurrentValues dimension={dimension} slugField={slugField}>
45
+ {children}
46
+ </DimensionSwitcherCurrentValues>
47
+ </Button>
48
+ </PopoverTrigger>
49
+ <PopoverContent className="p-2" align="start">
50
+ <div className="flex flex-col gap-1">
51
+ <DataViewEachRow>
52
+ <DimensionSwitcherItem dimension={dimension} slugField={slugField} isMulti={isMulti}>
53
+ {children}
54
+ <StaticRender>
55
+ <Field field={slugField} />
56
+ </StaticRender>
57
+ </DimensionSwitcherItem>
58
+ </DataViewEachRow>
59
+ </div>
60
+ </PopoverContent>
61
+ </Popover>
62
+ </DataViewLoaderState>
63
+ </DataView>
64
+ )
65
+ })
66
+
67
+ const DimensionSwitcherCurrentValues = ({ children, dimension, slugField }: { children: ReactNode, dimension: string, slugField: SugaredRelativeSingleField['field'] }) => {
68
+ const entitiesBySlug = useDimensionEntitiesBySlug(slugField)
69
+
70
+ const currentDimensionValue = useDimensionState({
71
+ dimension,
72
+ defaultValue: Object.keys(entitiesBySlug)[0],
73
+ storage: 'local',
74
+ })
75
+
76
+ const values = useMemo(() => currentDimensionValue.map(it => entitiesBySlug[it]).filter(Boolean), [currentDimensionValue, entitiesBySlug])
77
+
78
+ return (
79
+ <div className="flex gap-1">
80
+ {values.map(it => (
81
+ <Entity key={it.key} accessor={it}>
82
+ <div className={'gap-1 group text-black text-left inline-flex items-center px-1 text-sm border-b'}>
83
+ <span>{children}</span>
84
+ </div>
85
+ </Entity>
86
+ ))}
87
+ </div>
88
+ )
89
+ }
90
+
91
+
92
+ const DimensionSwitcherItem = ({ children, dimension, slugField, isMulti }: { children: ReactNode, dimension: string, slugField: SugaredRelativeSingleField['field'], isMulti?: boolean }) => {
93
+ const entity = useEntity()
94
+ const slugValue = entity.getField<string>(slugField).value
95
+ if (!slugValue) {
96
+ return null
97
+ }
98
+
99
+ return (
100
+ <DimensionLink dimension={dimension} value={slugValue} action={isMulti ? 'toggle' : 'set'}>
101
+ <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'}>
102
+ <CheckIcon className={'w-3 h-3 hidden group-data-[active]:block'} />
103
+ <span className={'w-3 h-3 group-data-[active]:hidden'} />
104
+ <span>{children}</span>
105
+ </a>
106
+ </DimensionLink>
107
+ )
108
+ }
109
+
110
+ export interface SideDimensionsProps {
111
+ dimension: string
112
+ as: string
113
+ field: SugaredRelativeSingleEntity['field']
114
+ children: ReactNode
115
+ }
116
+
117
+ export const SideDimensions = Component<SideDimensionsProps>(({ dimension, children, as, field }) => {
118
+ return (
119
+ <div className="flex mt-4 gap-4">
120
+ <DimensionRenderer dimension={dimension} as={as}>
121
+ <HasOne field={field}>
122
+ <div className="flex-1">
123
+ {children}
124
+ </div>
125
+ </HasOne>
126
+ </DimensionRenderer>
127
+ </div>
128
+ )
129
+ })
130
+
131
+
132
+ const useDimensionEntitiesBySlug = (slugField: SugaredRelativeSingleField['field']): Record<string, EntityAccessor> => {
133
+ const accessor = useDataViewEntityListAccessor()
134
+ return useMemo(() => Object.fromEntries(Array.from(accessor ?? []).map(it => [it.getField<string>(slugField).value, it])), [accessor, slugField])
135
+ }
@@ -0,0 +1 @@
1
+ export * from './dimensions'
@@ -0,0 +1,111 @@
1
+ import { ReactNode, useCallback, useMemo } from 'react'
2
+ import { EditorCanvas } from './common/editor-canvas'
3
+ import { EditorEditableCanvas } from './common/editor-editable-canvas'
4
+ import { BlockEditor, BlockEditorProps, withReferences } from '@contember/react-slate-editor'
5
+ import { Component, SugaredRelativeEntityList, SugaredRelativeSingleField } from '@contember/interface'
6
+ import { SortableContext, verticalListSortingStrategy } from '@dnd-kit/sortable'
7
+ import { useSlate, useSlateStatic } from 'slate-react'
8
+ import { blockEditorPlugins } from './plugins'
9
+ import { closestCenter, DndContext, DragEndEvent, KeyboardSensor, MeasuringStrategy, MouseSensor, TouchSensor, useSensor, useSensors } from '@dnd-kit/core'
10
+ import { Transforms } from 'slate'
11
+
12
+ export type BlockEditorFieldProps =
13
+ & BlockEditorProps
14
+ & {
15
+ referencesField: SugaredRelativeEntityList['field']
16
+ referenceDiscriminationField: SugaredRelativeSingleField['field']
17
+ placeholder?: string
18
+ }
19
+
20
+ export const BlockEditorField = Component<BlockEditorFieldProps>(({ placeholder, children, ...props }) => {
21
+ return (
22
+ <BlockEditor {...props} plugins={[
23
+ ...blockEditorPlugins,
24
+ ...props.plugins ?? [],
25
+ withReferences({
26
+ field: props.referencesField,
27
+ discriminationField: props.referenceDiscriminationField,
28
+ }),
29
+ ]}>
30
+ <SortableBlockEditor>
31
+ <BlockEditorInner placeholder={placeholder}>
32
+ {children}
33
+ </BlockEditorInner>
34
+ </SortableBlockEditor>
35
+ </BlockEditor>
36
+ )
37
+ })
38
+
39
+ const SortableBlockEditor = ({ children }: { children: ReactNode }) => {
40
+ const sensors = useSensors(
41
+ useSensor(MouseSensor),
42
+ useSensor(TouchSensor),
43
+ useSensor(KeyboardSensor),
44
+ )
45
+
46
+ const editor = useSlate()
47
+ const onDragEnd = useCallback(({ active, over }: DragEndEvent) => {
48
+ if (!over) {
49
+ return
50
+ }
51
+ const activeNodeIndex = editor.children.findIndex(it => it.key === active.id)
52
+ const overNodeIndex = editor.children.findIndex(it => it.key === over.id)
53
+
54
+ if (activeNodeIndex === undefined || overNodeIndex === undefined || activeNodeIndex === overNodeIndex) {
55
+ return
56
+ }
57
+ Transforms.moveNodes(editor, {
58
+ at: [activeNodeIndex],
59
+ to: [overNodeIndex],
60
+ })
61
+ }, [editor])
62
+
63
+ const items = useMemo(() => {
64
+ return editor.children.map(it => it.key as string)
65
+ }, [editor.children])
66
+
67
+ return (
68
+ <DndContext
69
+ sensors={sensors}
70
+ measuring={{
71
+ droppable: {
72
+ strategy: MeasuringStrategy.Always,
73
+ },
74
+ }}
75
+ onDragEnd={onDragEnd}
76
+ collisionDetection={closestCenter}
77
+ >
78
+ <SortableContext items={items} strategy={verticalListSortingStrategy}>
79
+ {children}
80
+ </SortableContext>
81
+ </DndContext>
82
+ )
83
+ }
84
+
85
+ export const BlockEditorInner = ({ children, placeholder }: {
86
+ placeholder?: string
87
+ children: ReactNode
88
+ }) => {
89
+ const editor = useSlateStatic()
90
+
91
+ return (
92
+ <EditorCanvas
93
+ underlyingComponent={EditorEditableCanvas}
94
+ componentProps={{
95
+ renderElement: editor.renderElement,
96
+ renderLeaf: editor.renderLeaf,
97
+ onKeyDown: editor.onKeyDown,
98
+ onFocusCapture: editor.onFocus,
99
+ onBlurCapture: editor.onBlur,
100
+ onDOMBeforeInput: editor.onDOMBeforeInput,
101
+ onDrop: (e => {
102
+ e.preventDefault()
103
+ }),
104
+ placeholder: placeholder,
105
+ }}
106
+
107
+ >
108
+ {children}
109
+ </EditorCanvas>
110
+ )
111
+ }
@@ -0,0 +1,66 @@
1
+ import {
2
+ EditorPlugin,
3
+ withAnchors,
4
+ withBold,
5
+ withCode,
6
+ withHeadings,
7
+ withHighlight,
8
+ withHorizontalRules,
9
+ withItalic,
10
+ withLists,
11
+ withNewline,
12
+ withParagraphs,
13
+ withScrollTargets,
14
+ withStrikeThrough,
15
+ withTables,
16
+ withUnderline,
17
+ } from '@contember/react-slate-editor-base'
18
+ import { AnchorRenderer } from './elements/AnchorRenderer'
19
+ import { ParagraphRenderer } from './elements/ParagraphRenderer'
20
+ import { HeadingRenderer } from './elements/HeadingRenderer'
21
+ import { ListItemRenderer } from './elements/ListItemRenderer'
22
+ import { OrderedListRenderer } from './elements/OrderedListRenderer'
23
+ import { UnorderedListRenderer } from './elements/UnorderedListRenderer'
24
+ import { HorizontalRuleRenderer } from './elements/HorizontalRuleRenderer'
25
+ import { ScrollTargetRenderer } from './elements/ScrollTargetRenderer'
26
+ import { TableElementRenderer } from './elements/TableElementRenderer'
27
+ import { TableCellElementRenderer } from './elements/TableCellElementRenderer'
28
+ import { TableRowElementRenderer } from './elements/TableRowElementRenderer'
29
+
30
+ export const baseEditorPlugins = {
31
+ anchor: withAnchors({
32
+ render: AnchorRenderer,
33
+ }),
34
+ paragraph: withParagraphs({
35
+ render: ParagraphRenderer,
36
+ }),
37
+ heading: withHeadings({
38
+ render: HeadingRenderer,
39
+ }),
40
+ list: withLists({
41
+ renderListItem: ListItemRenderer,
42
+ renderOrderedList: OrderedListRenderer,
43
+ renderUnorderedList: UnorderedListRenderer,
44
+ }),
45
+ horizontalRule: withHorizontalRules({
46
+ render: HorizontalRuleRenderer,
47
+ }),
48
+ scrollTarget: withScrollTargets({
49
+ render: ScrollTargetRenderer,
50
+ }),
51
+ table: withTables({
52
+ renderTable: TableElementRenderer,
53
+ renderTableCell: TableCellElementRenderer,
54
+ renderTableRow: TableRowElementRenderer,
55
+ }),
56
+
57
+ bold: withBold(),
58
+ code: withCode(),
59
+ highlight: withHighlight(),
60
+ italic: withItalic(),
61
+ newline: withNewline(),
62
+ strikeThrough: withStrikeThrough(),
63
+ underline: withUnderline(),
64
+ } satisfies Record<string, EditorPlugin>
65
+
66
+