@contember/create 1.4.0-rc.3 → 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,60 @@
1
+ import { dict } from '../dict'
2
+
3
+ export const formatDate = (date: string | null) => {
4
+ if (date === null) {
5
+ return null
6
+ }
7
+ const d = new Date(date)
8
+ return d.toLocaleDateString()
9
+ }
10
+
11
+ export const formatDateTime = (date: string | null) => {
12
+ if (date === null) {
13
+ return null
14
+ }
15
+ const d = new Date(date)
16
+ return d.toLocaleString()
17
+ }
18
+
19
+ export const formatBoolean = (value: boolean | null) => {
20
+ if (value === null) {
21
+ return null
22
+ }
23
+ return value ? dict.boolean.true : dict.boolean.false
24
+ }
25
+
26
+ export const createEnumFormatter = (enumValues: Record<string, string>) => (value: string | null) => {
27
+ if (value === null) {
28
+ return null
29
+ }
30
+ return enumValues[value]
31
+ }
32
+
33
+ export const withFallback = <T>(formatter: (value: T) => string, fallback: string) => (value: T | null) => {
34
+ if (value === null) {
35
+ return fallback
36
+ }
37
+ return formatter(value)
38
+ }
39
+
40
+ export const formatNumber = (value: number | null) => {
41
+ if (value === null) {
42
+ return null
43
+ }
44
+ return value.toLocaleString()
45
+ }
46
+
47
+ export const formatBytes = (bytes: number, decimals = 1) => {
48
+ if (bytes === 0) return '0 Bytes'
49
+ const k = 1024
50
+ const dm = decimals + 1 || 3
51
+ const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']
52
+ const i = Math.floor(Math.log(bytes) / Math.log(k))
53
+ return `${Number.parseFloat((bytes / k ** i).toFixed(dm))} ${sizes[i]}`
54
+ }
55
+
56
+ export const formatDuration = (duration: number) => {
57
+ const minutes = Math.floor(duration / 60)
58
+ const seconds = duration % 60
59
+ return `${minutes}:${seconds.toString().padStart(2, '0')}`
60
+ }
@@ -0,0 +1,2 @@
1
+ export * from './cn'
2
+ export * from './uic'
@@ -0,0 +1,79 @@
1
+ import { ClassValue, clsx } from 'clsx'
2
+ import * as React from 'react'
3
+ import { ComponentType, ReactElement, ReactNode } from 'react'
4
+ import { Slot } from '@radix-ui/react-slot'
5
+ import { cva } from 'class-variance-authority'
6
+ import { twMerge } from 'tailwind-merge'
7
+
8
+ type StringToBoolean<T> = T extends 'true' | 'false' ? boolean : T;
9
+ type ConfigSchema = Record<string, Record<string, ClassValue>>;
10
+
11
+ export type ConfigVariants<T extends ConfigSchema | undefined> = T extends ConfigSchema ? {
12
+ [Variant in keyof T]?: StringToBoolean<keyof T[Variant]> | null | undefined;
13
+ } : {}
14
+
15
+ type ConfigVariantsMulti<T extends ConfigSchema | undefined> = T extends ConfigSchema ? {
16
+ [Variant in keyof T]?: StringToBoolean<keyof T[Variant]> | StringToBoolean<keyof T[Variant]>[] | undefined;
17
+ } : {}
18
+
19
+ type Config<T extends ConfigSchema | undefined, El extends React.ElementType> = {
20
+ baseClass?: ClassValue
21
+ variants?: T;
22
+ passVariantProps?: string[]
23
+ defaultProps?: Partial<React.ComponentProps<El>>
24
+ defaultVariants?: ConfigVariants<T>;
25
+ compoundVariants?: ((ConfigVariants<T> | ConfigVariantsMulti<T>) & { className?: string })[];
26
+ displayName?: string;
27
+ wrapOuter?: ComponentType<{ children?: ReactNode } & ConfigVariants<T>>
28
+ wrapInner?: ComponentType<{ children?: ReactNode } & ConfigVariants<T>>
29
+ beforeChildren?: ReactElement
30
+ afterChildren?: ReactElement
31
+ }
32
+
33
+ export const uiconfig = <T extends ConfigSchema | undefined>(config: Config<T, ComponentType<{}>>) => config
34
+
35
+ export type NoInfer<T> = T & { [K in keyof T]: T[K] }
36
+
37
+ export const uic = <El extends React.ElementType, Variants extends ConfigSchema | undefined = undefined>(Component: El, config: Config<Variants, NoInfer<El>>) => {
38
+ const cls = cva<any>(config?.baseClass, {
39
+ variants: config?.variants,
40
+ defaultVariants: config?.defaultVariants,
41
+ compoundVariants: config?.compoundVariants,
42
+ })
43
+
44
+ const component = React.forwardRef<React.ElementRef<El>, React.ComponentProps<El> & {
45
+ asChild?: boolean
46
+ children?: React.ReactNode
47
+ className?: string
48
+ } & ConfigVariants<Variants>>((props, ref) => {
49
+ const { className: classNameProp, children: childrenBase, ...rest } = props
50
+
51
+ for (const key in config?.variants) {
52
+ if (key in rest && !config?.passVariantProps?.includes(key)) {
53
+ delete (rest as any)[key]
54
+ }
55
+ }
56
+ let Comp: React.ElementType = Component
57
+ if (props.asChild && typeof Component === 'string') {
58
+ Comp = Slot
59
+ delete (rest as any).asChild
60
+ }
61
+ let children = childrenBase
62
+ if (config?.wrapInner) {
63
+ children = React.createElement(config.wrapInner, props, children)
64
+ }
65
+ if (config?.beforeChildren || config?.afterChildren) {
66
+ children = <>
67
+ {config?.beforeChildren}
68
+ {children}
69
+ {config?.afterChildren}
70
+ </>
71
+ }
72
+
73
+ const innerEl = <Comp ref={ref} className={twMerge(clsx(cls(props), classNameProp))} {...(config.defaultProps ?? {})} {...rest}>{children}</Comp>
74
+ return config?.wrapOuter ? React.createElement(config.wrapOuter, props, innerEl) : innerEl
75
+ })
76
+ component.displayName = config?.displayName
77
+
78
+ return component
79
+ }
@@ -0,0 +1,63 @@
1
+ {
2
+ "name": "@app/admin",
3
+ "version": "0.0.0",
4
+ "private": true,
5
+ "scripts": {
6
+ "dev": "vite --port 1480 --host 0.0.0.0",
7
+ "build": "vite build . \"$0\"",
8
+ "test": "echo \"Error: no test specified\" && exit 1"
9
+ },
10
+ "devDependencies": {
11
+ "@contember/vite-plugin": "2.0.0-alpha.5",
12
+ "@types/react": "^18",
13
+ "@types/react-dom": "^18",
14
+ "@vitejs/plugin-react": "^4.2.1",
15
+ "autoprefixer": "^10",
16
+ "postcss": "^8",
17
+ "tailwindcss": "^3",
18
+ "tailwindcss-animate": "^1.0.7",
19
+ "vite": "^5"
20
+ },
21
+ "dependencies": {
22
+ "@contember/client-content": "2.0.0-alpha.5",
23
+ "@contember/graphql-client": "2.0.0-alpha.5",
24
+ "@contember/graphql-client-tenant": "{version}",
25
+ "@contember/interface": "2.0.0-alpha.5",
26
+ "@contember/react-block-repeater": "2.0.0-alpha.5",
27
+ "@contember/react-board": "2.0.0-alpha.5",
28
+ "@contember/react-board-dnd-kit": "2.0.0-alpha.5",
29
+ "@contember/react-dataview": "2.0.0-alpha.5",
30
+ "@contember/react-form": "2.0.0-alpha.5",
31
+ "@contember/react-repeater": "2.0.0-alpha.5",
32
+ "@contember/react-repeater-dnd-kit": "2.0.0-alpha.5",
33
+ "@contember/react-select": "2.0.0-alpha.5",
34
+ "@contember/react-slate-editor": "2.0.0-alpha.5",
35
+ "@contember/react-slate-editor-base": "2.0.0-alpha.5",
36
+ "@contember/react-slots": "2.0.0-alpha.5",
37
+ "@contember/react-uploader": "2.0.0-alpha.5",
38
+ "@contember/react-uploader-dropzone": "2.0.0-alpha.5",
39
+ "@radix-ui/react-alert-dialog": "^1.0.5",
40
+ "@radix-ui/react-checkbox": "^1.0.4",
41
+ "@radix-ui/react-dropdown-menu": "^2.0.6",
42
+ "@radix-ui/react-label": "^2.0.2",
43
+ "@radix-ui/react-popover": "^1.0.7",
44
+ "@radix-ui/react-primitive": "^1.0.3",
45
+ "@radix-ui/react-progress": "^1.0.3",
46
+ "@radix-ui/react-scroll-area": "^1.0.5",
47
+ "@radix-ui/react-select": "^2.0.0",
48
+ "@radix-ui/react-separator": "^1.0.3",
49
+ "@radix-ui/react-slot": "^1.0.2",
50
+ "@radix-ui/react-switch": "^1.0.3",
51
+ "@radix-ui/react-toast": "^1.1.5",
52
+ "@radix-ui/react-toolbar": "^1.0.4",
53
+ "@radix-ui/react-tooltip": "^1.0.7",
54
+ "class-variance-authority": "^0.7.0",
55
+ "lucide-react": "^0.377.0",
56
+ "qrcode-generator": "^1.4.4",
57
+ "react": "^18.2.0",
58
+ "react-dom": "^18.2.0",
59
+ "slate": "^0.103.0",
60
+ "slate-react": "^0.102.0",
61
+ "tailwind-merge": "^2.2.1"
62
+ }
63
+ }
@@ -0,0 +1,6 @@
1
+ module.exports = {
2
+ plugins: {
3
+ tailwindcss: {},
4
+ autoprefixer: {},
5
+ },
6
+ }
@@ -0,0 +1,73 @@
1
+
2
+ /** @type {import('tailwindcss').Config} */
3
+ module.exports = {
4
+ content: ['./{app,lib}/**/*.{html,js,tsx,ts}', '*.{html,js,ts,tsx}'],
5
+ darkMode: ['class'],
6
+ theme: {
7
+ container: {
8
+ center: true,
9
+ padding: '2rem',
10
+ screens: {
11
+ '2xl': '1400px',
12
+ },
13
+ },
14
+ extend: {
15
+ colors: {
16
+ border: 'hsl(var(--border))',
17
+ input: 'hsl(var(--input))',
18
+ ring: 'hsl(var(--ring))',
19
+ background: 'hsl(var(--background))',
20
+ foreground: 'hsl(var(--foreground))',
21
+ primary: {
22
+ DEFAULT: 'hsl(var(--primary))',
23
+ foreground: 'hsl(var(--primary-foreground))',
24
+ },
25
+ secondary: {
26
+ DEFAULT: 'hsl(var(--secondary))',
27
+ foreground: 'hsl(var(--secondary-foreground))',
28
+ },
29
+ destructive: {
30
+ DEFAULT: 'hsl(var(--destructive) / <alpha-value>)',
31
+ foreground: 'hsl(var(--destructive-foreground) / <alpha-value>)',
32
+ },
33
+ muted: {
34
+ DEFAULT: 'hsl(var(--muted))',
35
+ foreground: 'hsl(var(--muted-foreground))',
36
+ },
37
+ accent: {
38
+ DEFAULT: 'hsl(var(--accent))',
39
+ foreground: 'hsl(var(--accent-foreground))',
40
+ },
41
+ popover: {
42
+ DEFAULT: 'hsl(var(--popover))',
43
+ foreground: 'hsl(var(--popover-foreground))',
44
+ },
45
+ card: {
46
+ DEFAULT: 'hsl(var(--card))',
47
+ foreground: 'hsl(var(--card-foreground))',
48
+ },
49
+ },
50
+ borderRadius: {
51
+ xl: `calc(var(--radius) + 4px)`,
52
+ lg: `var(--radius)`,
53
+ md: `calc(var(--radius) - 2px)`,
54
+ sm: 'calc(var(--radius) - 4px)',
55
+ },
56
+ keyframes: {
57
+ 'accordion-down': {
58
+ from: { height: '0' },
59
+ to: { height: 'var(--radix-accordion-content-height)' },
60
+ },
61
+ 'accordion-up': {
62
+ from: { height: 'var(--radix-accordion-content-height)' },
63
+ to: { height: '0' },
64
+ },
65
+ },
66
+ animation: {
67
+ 'accordion-down': 'accordion-down 0.2s ease-out',
68
+ 'accordion-up': 'accordion-up 0.2s ease-out',
69
+ },
70
+ },
71
+ },
72
+ plugins: [require('tailwindcss-animate')],
73
+ }
@@ -0,0 +1,23 @@
1
+ {
2
+ "extends": ["../tsconfig.settings.json"],
3
+ "compilerOptions": {
4
+ "allowSyntheticDefaultImports": true,
5
+ "jsx": "react-jsx",
6
+ "lib": [
7
+ "esnext",
8
+ "dom",
9
+ "dom.iterable",
10
+ ],
11
+ "paths": {
12
+ "@app/components": [
13
+ "./app/components/*"
14
+ ],
15
+ "@app/lib/*": [
16
+ "./lib/*"
17
+ ],
18
+ "@app/lib/plugins/*": [
19
+ "./lib/plugins/*"
20
+ ]
21
+ }
22
+ }
23
+ }
@@ -0,0 +1,7 @@
1
+ /// <reference types="vite/client" />
2
+
3
+ interface ImportMetaEnv {
4
+ VITE_CONTEMBER_ADMIN_API_BASE_URL: string
5
+ VITE_CONTEMBER_ADMIN_SESSION_TOKEN: string
6
+ VITE_CONTEMBER_ADMIN_PROJECT_NAME: string
7
+ }
@@ -0,0 +1,39 @@
1
+ import { resolve } from 'node:path'
2
+ import { contember } from '@contember/vite-plugin'
3
+ import react from '@vitejs/plugin-react'
4
+ import { defineConfig } from 'vite'
5
+ import tsconfigPaths from 'vite-tsconfig-paths'
6
+
7
+ export default defineConfig(() => {
8
+ const dsn = process.argv.find(it => it.includes('contember://'))
9
+ const projectName = dsn ? new URL(dsn).username : null
10
+
11
+ return {
12
+ define: projectName ? { 'import.meta.env.VITE_CONTEMBER_ADMIN_PROJECT_NAME': JSON.stringify(projectName) } : {},
13
+ base: '/',
14
+ plugins: [
15
+ tsconfigPaths(),
16
+ react(),
17
+ contember(),
18
+ {
19
+ name: 'rewrite-middleware',
20
+ configureServer(serve) {
21
+ serve.middlewares.use((req, res, next) => {
22
+ if (req.url === '/app' || (req.url?.startsWith('/app/') && !req.url?.match(/\.\w+($|\?)/))) {
23
+ req.url = '/app/'
24
+ }
25
+ next()
26
+ })
27
+ },
28
+ },
29
+ ],
30
+ build: {
31
+ rollupOptions: {
32
+ input: {
33
+ root: resolve(__dirname, './index.html'),
34
+ app: resolve(__dirname, './app/index.html'),
35
+ },
36
+ },
37
+ },
38
+ }
39
+ })
@@ -0,0 +1,7 @@
1
+ import { createSchema, settingsPresets } from '@contember/schema-definition'
2
+ import * as model from './model'
3
+
4
+ export default createSchema(model, schema => ({
5
+ ...schema,
6
+ settings: settingsPresets['v1.4'],
7
+ }))
@@ -0,0 +1 @@
1
+ // silence is golden
@@ -0,0 +1 @@
1
+ export default null
@@ -0,0 +1,16 @@
1
+ {
2
+ "name": "@app/api",
3
+ "private": true,
4
+ "version": "0.0.0",
5
+ "scripts": {
6
+ "test": "echo \"Error: no test specified\""
7
+ },
8
+ "type": "module",
9
+ "devDependencies": {
10
+ "@contember/schema": "{version}",
11
+ "@contember/schema-definition": "{version}"
12
+ },
13
+ "dependencies": {
14
+ "graphql": "^16.8.1"
15
+ }
16
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "extends": [
3
+ "../tsconfig.settings.json"
4
+ ],
5
+ "compilerOptions": {
6
+ "experimentalDecorators": true,
7
+ "emitDecoratorMetadata": true,
8
+ "moduleResolution": "node",
9
+ }
10
+ }
@@ -0,0 +1,45 @@
1
+ {
2
+ "$schema": "https://biomejs.dev/schemas/1.7.1/schema.json",
3
+ "organizeImports": {
4
+ "enabled": true
5
+ },
6
+ "files": {
7
+ "include": ["**/*.ts", "**/*.tsx"],
8
+ "ignore": ["node_modules/**", "dist/**", "client/src/**"]
9
+ },
10
+ "formatter": {
11
+ "enabled": true,
12
+ "lineWidth": 150
13
+ },
14
+ "javascript": {
15
+ "formatter": {
16
+ "jsxQuoteStyle": "double",
17
+ "quoteStyle": "single",
18
+ "semicolons": "asNeeded",
19
+ "arrowParentheses": "asNeeded"
20
+ }
21
+ },
22
+ "linter": {
23
+ "enabled": true,
24
+ "rules": {
25
+ "recommended": true,
26
+ "correctness": {
27
+ "noChildrenProp": "off"
28
+ },
29
+ "style": {
30
+ "useNodejsImportProtocol": "off",
31
+ "useImportType": "off",
32
+ "noNonNullAssertion": "off"
33
+ },
34
+ "suspicious": {
35
+ "noConsoleLog": "error",
36
+ "noExplicitAny": "off",
37
+ "noConfusingVoidType": "off",
38
+ "noArrayIndexKey": "off"
39
+ },
40
+ "a11y": {
41
+ "all": false
42
+ }
43
+ }
44
+ }
45
+ }
@@ -0,0 +1,16 @@
1
+ {
2
+ "name": "@app/client",
3
+ "version": "0.0.0",
4
+ "typings": "./dist/src/index.d.ts",
5
+ "exports": {
6
+ ".": {
7
+ "types": "./dist/src/index.d.ts",
8
+ "import": "./dist/src/index.js"
9
+ }
10
+ },
11
+ "scripts": {
12
+ "test": "echo \"No test\""
13
+ },
14
+ "private": true,
15
+ "type": "module"
16
+ }
@@ -0,0 +1 @@
1
+ export default {}
@@ -0,0 +1,9 @@
1
+ {
2
+ "extends": "../tsconfig.settings.json",
3
+ "include": [ "./src" ],
4
+ "compilerOptions": {
5
+ "noEmit": false,
6
+ "declaration": true,
7
+ "outDir": "./dist"
8
+ }
9
+ }
@@ -0,0 +1,7 @@
1
+ type: workspace
2
+ replaceVariables:
3
+ - package.json
4
+ - api/package.json
5
+ - admin/package.json
6
+ - client/package.json
7
+ - docker-compose.yaml
@@ -0,0 +1,124 @@
1
+ services:
2
+ contember-engine:
3
+ image: contember/engine:{version}
4
+
5
+ environment:
6
+ NODE_ENV: 'development'
7
+
8
+ CONTEMBER_PORT: '4000'
9
+ CONTEMBER_ROOT_EMAIL: 'contember@localhost'
10
+ CONTEMBER_ROOT_PASSWORD: 'contember'
11
+ CONTEMBER_ROOT_TOKEN: '0000000000000000000000000000000000000000' # openssl rand -hex 20
12
+ CONTEMBER_LOGIN_TOKEN: '1111111111111111111111111111111111111111' # openssl rand -hex 20
13
+ CONTEMBER_ENCRYPTION_KEY: '2222222222222222222222222222222222222222222222222222222222222222' # openssl rand -hex 32
14
+
15
+ DEFAULT_DB_HOST: 'postgres'
16
+ DEFAULT_DB_PORT: '5432'
17
+ DEFAULT_DB_NAME: 'contember'
18
+ DEFAULT_DB_USER: 'contember'
19
+ DEFAULT_DB_PASSWORD: 'contember'
20
+
21
+ DEFAULT_S3_ENDPOINT: 'http://localhost:1483'
22
+ DEFAULT_S3_BUCKET: 'contember'
23
+ DEFAULT_S3_REGION: ''
24
+ DEFAULT_S3_KEY: 'contember'
25
+ DEFAULT_S3_SECRET: 'contember'
26
+ DEFAULT_S3_PROVIDER: 'minio'
27
+
28
+ TENANT_MAILER_HOST: 'mailhog'
29
+ TENANT_MAILER_PORT: '1025'
30
+ TENANT_MAILER_FROM: 'contember@localhost'
31
+
32
+ ports:
33
+ - '1481:4000'
34
+
35
+ healthcheck:
36
+ test: 'curl --fail http://localhost:4000'
37
+ interval: 5s
38
+ timeout: 5s
39
+ retries: 10
40
+
41
+ depends_on:
42
+ postgres:
43
+ condition: service_healthy
44
+
45
+ contember-cli:
46
+ image: contember/cli:{version}
47
+ user: '1000:1000'
48
+
49
+ deploy:
50
+ replicas: 0
51
+
52
+ environment:
53
+ CONTEMBER_API_URL: 'http://contember-engine:4000/'
54
+ CONTEMBER_API_TOKEN: '0000000000000000000000000000000000000000'
55
+ CONTEMBER_PROJECT_NAME: 'app'
56
+
57
+ volumes:
58
+ - ./:/src
59
+
60
+ depends_on:
61
+ contember-engine:
62
+ condition: service_healthy
63
+
64
+ postgres:
65
+ image: postgres:16-alpine
66
+
67
+ environment:
68
+ POSTGRES_USER: 'contember'
69
+ POSTGRES_PASSWORD: 'contember'
70
+ POSTGRES_DB: 'contember'
71
+
72
+ ports:
73
+ - '1482:5432'
74
+
75
+ volumes:
76
+ - pgsql-data:/var/lib/postgresql/data
77
+
78
+ healthcheck:
79
+ test: 'pg_isready --username contember'
80
+ interval: 5s
81
+ timeout: 5s
82
+ retries: 10
83
+
84
+ minio:
85
+ image: bitnami/minio
86
+
87
+ environment:
88
+ MINIO_ROOT_USER: 'contember'
89
+ MINIO_ROOT_PASSWORD: 'contember'
90
+ MINIO_DEFAULT_BUCKETS: 'contember:download'
91
+
92
+ ports:
93
+ - '1483:9000'
94
+
95
+ volumes:
96
+ - minio-data:/bitnami/minio/data
97
+
98
+ mailhog:
99
+ image: mailhog/mailhog
100
+ ports:
101
+ - '1484:8025'
102
+
103
+ adminer:
104
+ image: michalhosna/adminer:4.8.0-en_v1
105
+
106
+ environment:
107
+ ADMINER_DRIVER: 'pgsql'
108
+ ADMINER_SERVER: 'postgres'
109
+ ADMINER_DB: 'contember'
110
+ ADMINER_USERNAME: 'contember'
111
+ ADMINER_PASSWORD: 'contember'
112
+ ADMINER_AUTOLOGIN: '1'
113
+ ADMINER_NAME: 'Contember'
114
+
115
+ ports:
116
+ - '1485:8080'
117
+
118
+ depends_on:
119
+ postgres:
120
+ condition: service_healthy
121
+
122
+ volumes:
123
+ pgsql-data: ~
124
+ minio-data: ~
@@ -0,0 +1,32 @@
1
+ {
2
+ "private": true,
3
+ "scripts": {
4
+ "contember": "docker-compose run --rm contember-cli",
5
+ "start": "yarn run contember:start-engine && yarn run client:generate && yarn contember:start-admin",
6
+ "build": "yarn run ts:build && yarn run contember:build-admin \"$0\" && yarn run contember:build-api",
7
+ "deploy": "yarn run build \"$0\" && docker-compose run --no-deps contember-cli deploy \"$@\" --root",
8
+ "contember:start-engine": "docker-compose up --detach && yarn run contember migrations:execute --yes",
9
+ "contember:start-admin": "yarn workspace @app/admin dev",
10
+ "contember:build-admin": "tsc --project admin && yarn workspace @app/admin build \"$0\"",
11
+ "contember:build-api": "tsc --project api",
12
+ "client:build": "tsc --project client",
13
+ "client:generate": "bash ./scripts/generate-client.sh",
14
+ "ts:build": "tsc --build",
15
+ "ts:clean": "tsc --build --clean",
16
+ "ts:watch": "tsc --build --watch",
17
+ "lint": "biome lint .",
18
+ "lint:fix": "biome lint . --apply"
19
+ },
20
+ "devDependencies": {
21
+ "@biomejs/biome": "^1.7.1",
22
+ "@contember/client-content-generator": "2.0.0-alpha.5",
23
+ "typescript": "^5.0",
24
+ "vite": "^5",
25
+ "vite-tsconfig-paths": "^4.3.1"
26
+ },
27
+ "workspaces": [
28
+ "admin",
29
+ "api",
30
+ "client"
31
+ ]
32
+ }
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+
3
+ docker-compose run --rm --entrypoint="" contember-cli sh -c "
4
+ node /opt/contember/run.js project:print-schema --format=schema > /tmp/contember-schema.json
5
+ yarn run --silent contember-client-generator /tmp/contember-schema.json ./client/src
6
+ rm /tmp/contember-schema.json
7
+ "
8
+
@@ -0,0 +1,9 @@
1
+ {
2
+ "files": [ ],
3
+ "include": [ ],
4
+ "references": [
5
+ { "path": "./admin" },
6
+ { "path": "./api" },
7
+ { "path": "./client" }
8
+ ]
9
+ }