alinea 2.0.0-rc1 → 2.0.0-rc2

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 (252) hide show
  1. package/dist/.init/content/pages/welcome.json +1 -1
  2. package/dist/.mcp/later/dev.json +1 -1
  3. package/dist/.mcp/online/dev.json +1 -1
  4. package/dist/adapter/next/cms.js +29 -22
  5. package/dist/adapter/next/handler.js +1 -0
  6. package/dist/backend/Handler.d.ts +3 -1
  7. package/dist/backend/Handler.js +27 -16
  8. package/dist/backend/api/CreateBackend.js +2 -2
  9. package/dist/backend/api/GithubApi.js +4 -4
  10. package/dist/backend/api/database.js +2 -2
  11. package/dist/backend/store/GeneratedDatabase.js +4 -2
  12. package/dist/bundled.d.ts +507 -124
  13. package/dist/chunks/{chunk-XESQKG2I.js → chunk-4VKHBA57.js} +1 -1
  14. package/dist/cli/Generate.js +7 -2
  15. package/dist/cli/Mcp.js +1 -1
  16. package/dist/cli/Serve.js +1 -1
  17. package/dist/cli/bin.js +1 -1
  18. package/dist/cli/generate/LinkMediaFiles.js +3 -3
  19. package/dist/cli/generate/MediaLocations.js +3 -3
  20. package/dist/cli/serve/mcp/DevMcp.js +1 -1
  21. package/dist/cli/serve/mcp/McpTools.js +51 -28
  22. package/dist/cloud/CloudRemote.js +1 -1
  23. package/dist/components/Alert.js +2 -2
  24. package/dist/components/Breadcrumbs.js +6 -6
  25. package/dist/components/Button.js +2 -2
  26. package/dist/components/Calendar.js +14 -14
  27. package/dist/components/Checkbox.js +6 -6
  28. package/dist/components/Collapsible.js +5 -5
  29. package/dist/components/ComboBox.js +10 -10
  30. package/dist/components/Command.js +11 -11
  31. package/dist/components/ContentCard.js +26 -26
  32. package/dist/components/ContentGrid.js +12 -12
  33. package/dist/components/DataList.js +2 -2
  34. package/dist/components/Dialog.js +5 -5
  35. package/dist/components/DropZone.js +3 -3
  36. package/dist/components/DropdownMenu.js +6 -6
  37. package/dist/components/Empty.js +3 -3
  38. package/dist/components/Field.d.ts +1 -1
  39. package/dist/components/Field.js +5 -4
  40. package/dist/components/List.d.ts +4 -1
  41. package/dist/components/List.js +31 -27
  42. package/dist/components/MediaPreview.js +2 -2
  43. package/dist/components/MultipleSelect.js +17 -17
  44. package/dist/components/NavRail.js +5 -5
  45. package/dist/components/NumberField.js +3 -3
  46. package/dist/components/Page.js +5 -5
  47. package/dist/components/PreviewFrame.js +6 -6
  48. package/dist/components/RadioGroup.js +6 -6
  49. package/dist/components/Resizable.js +3 -3
  50. package/dist/components/SearchField.js +4 -4
  51. package/dist/components/Select.js +9 -9
  52. package/dist/components/Sheet.d.ts +4 -2
  53. package/dist/components/Sheet.js +21 -7
  54. package/dist/components/Sidebar.js +5 -5
  55. package/dist/components/SortableList.js +10 -10
  56. package/dist/components/Spinner.js +3 -3
  57. package/dist/components/Surface.js +1 -1
  58. package/dist/components/Switch.js +4 -4
  59. package/dist/components/Table.d.ts +2 -0
  60. package/dist/components/Table.js +96 -64
  61. package/dist/components/Tabs.js +4 -4
  62. package/dist/components/TagGroup.js +6 -6
  63. package/dist/components/TextField.js +8 -8
  64. package/dist/components/TimeField.js +4 -41
  65. package/dist/components/Toolbar.js +1 -1
  66. package/dist/components/Tooltip.js +3 -3
  67. package/dist/components/Tree.js +28 -28
  68. package/dist/components/internal/DateControl.js +9 -9
  69. package/dist/components/internal/ListBoxGroup.js +2 -2
  70. package/dist/components/internal/ListBoxOption.js +9 -9
  71. package/dist/components/internal/PopoverSurface.js +2 -2
  72. package/dist/components/internal/SelectionCheckbox.js +3 -3
  73. package/dist/components/internal/ToggleButton.js +2 -2
  74. package/dist/config.d.ts +1 -0
  75. package/dist/config.js +10 -0
  76. package/dist/core/Config.d.ts +36 -1
  77. package/dist/core/Config.js +149 -9
  78. package/dist/core/Document.d.ts +5 -3
  79. package/dist/core/Document.js +6 -6
  80. package/dist/core/Field.d.ts +13 -2
  81. package/dist/core/Field.js +6 -2
  82. package/dist/core/Graph.d.ts +6 -0
  83. package/dist/core/Internal.d.ts +3 -0
  84. package/dist/core/Internal.js +4 -0
  85. package/dist/core/Overview.d.ts +8 -2
  86. package/dist/core/Root.d.ts +19 -6
  87. package/dist/core/Root.js +6 -4
  88. package/dist/core/Schema.js +7 -2
  89. package/dist/core/Scope.d.ts +7 -0
  90. package/dist/core/Scope.js +32 -5
  91. package/dist/core/Type.d.ts +22 -14
  92. package/dist/core/Type.js +13 -8
  93. package/dist/core/Validation.d.ts +5 -0
  94. package/dist/core/Validation.js +2 -1
  95. package/dist/core/db/LinkResolver.d.ts +3 -0
  96. package/dist/core/db/LocalStore.d.ts +12 -0
  97. package/dist/core/db/Operation.d.ts +6 -0
  98. package/dist/core/db/Operation.js +68 -14
  99. package/dist/core/db/SyncStats.d.ts +16 -0
  100. package/dist/core/db/SyncStats.js +56 -0
  101. package/dist/core/db/WriteableGraph.d.ts +1 -14
  102. package/dist/core/db/WriteableGraph.js +5 -3
  103. package/dist/core/field/ListField.js +4 -2
  104. package/dist/core/field/RecordField.js +4 -2
  105. package/dist/core/field/RichTextField.js +6 -5
  106. package/dist/core/field/UnionField.js +3 -2
  107. package/dist/core/media/CompressPdf.browser.js +1 -1
  108. package/dist/core/media/CompressPdf.js +1 -1
  109. package/dist/core/media/CreatePreview.browser.js +1 -1
  110. package/dist/core/media/FileAccept.d.ts +7 -0
  111. package/dist/core/media/FileAccept.js +29 -0
  112. package/dist/core/media/MediaRoot.js +2 -4
  113. package/dist/core/media/MediaTypes.d.ts +126 -2
  114. package/dist/core/media/MediaTypes.js +143 -42
  115. package/dist/core/media/Summary.d.ts +9 -9
  116. package/dist/core/media/Summary.js +10 -10
  117. package/dist/dashboard/App.js +3 -3
  118. package/dist/dashboard/app/ActivityStatus.js +12 -12
  119. package/dist/dashboard/app/AuthView.js +4 -4
  120. package/dist/dashboard/app/BlockSheet.js +5 -5
  121. package/dist/dashboard/app/BlockSheetStoryFrame.js +3 -3
  122. package/dist/dashboard/app/BlockTabs.d.ts +12 -0
  123. package/dist/dashboard/app/BlockTabs.js +26 -0
  124. package/dist/dashboard/app/CompactField.js +23 -22
  125. package/dist/dashboard/app/CroppedImage.js +3 -3
  126. package/dist/dashboard/app/DashboardErrorBoundary.js +2 -2
  127. package/dist/dashboard/app/DashboardLayout.js +3 -3
  128. package/dist/dashboard/app/EntryForm.d.ts +6 -0
  129. package/dist/dashboard/app/{SettingsTab.js → EntryForm.js} +9 -8
  130. package/dist/dashboard/app/EntryHeader.js +11 -11
  131. package/dist/dashboard/app/EntryReferences.js +3 -3
  132. package/dist/dashboard/app/EntrySidebar.js +15 -15
  133. package/dist/dashboard/app/EntrySidebarPreview.js +4 -4
  134. package/dist/dashboard/app/EntryStatusIcon.js +3 -3
  135. package/dist/dashboard/app/Explorer.d.ts +4 -3
  136. package/dist/dashboard/app/Explorer.js +68 -303
  137. package/dist/dashboard/app/ExplorerBatchActions.js +2 -2
  138. package/dist/dashboard/app/ExplorerBreadcrumbs.d.ts +13 -0
  139. package/dist/dashboard/app/ExplorerBreadcrumbs.js +119 -0
  140. package/dist/dashboard/app/ExplorerControls.js +5 -5
  141. package/dist/dashboard/app/ExplorerList.js +4 -4
  142. package/dist/dashboard/app/ExplorerModal.js +3 -3
  143. package/dist/dashboard/app/ExplorerScope.d.ts +7 -0
  144. package/dist/dashboard/app/ExplorerScope.js +159 -0
  145. package/dist/dashboard/app/ExplorerTable.js +8 -8
  146. package/dist/dashboard/app/ExplorerTabs.js +2 -2
  147. package/dist/dashboard/app/ImageEditor.js +27 -27
  148. package/dist/dashboard/app/LinkPicker.js +5 -2
  149. package/dist/dashboard/app/LocaleMenu.js +6 -6
  150. package/dist/dashboard/app/MediaPreviewCell.js +4 -4
  151. package/dist/dashboard/app/OverviewCell.js +11 -10
  152. package/dist/dashboard/app/PendingUploadsView.d.ts +1 -0
  153. package/dist/dashboard/app/PendingUploadsView.js +29 -5
  154. package/dist/dashboard/app/RemoveDialog.js +4 -4
  155. package/dist/dashboard/app/RemoveRedirect.js +2 -2
  156. package/dist/dashboard/app/SearchBar.js +1 -1
  157. package/dist/dashboard/app/SidebarTree.js +16 -16
  158. package/dist/dashboard/app/WorkspaceMenu.js +6 -6
  159. package/dist/dashboard/app/WorkspaceRoots.js +10 -10
  160. package/dist/dashboard/app/editor/FileEditor.js +67 -37
  161. package/dist/dashboard/app/editor/FilePreview.d.ts +4 -1
  162. package/dist/dashboard/app/editor/FilePreview.js +2 -4
  163. package/dist/dashboard/app/editor/MediaAltField.view.js +1 -1
  164. package/dist/dashboard/app/modals/CreateEntry.js +3 -3
  165. package/dist/dashboard/app/pages/EntryPage.js +19 -19
  166. package/dist/dashboard/app/pages/SplashPage.js +35 -35
  167. package/dist/dashboard/app/pages/UsersPage.js +7 -7
  168. package/dist/dashboard/app/ui/DashboardModal.js +15 -15
  169. package/dist/dashboard/atoms/config.d.ts +1 -1
  170. package/dist/dashboard/atoms/create.js +13 -8
  171. package/dist/dashboard/atoms/entry.d.ts +1 -1
  172. package/dist/dashboard/atoms/entry.js +15 -10
  173. package/dist/dashboard/atoms/explorer.d.ts +24 -7
  174. package/dist/dashboard/atoms/explorer.js +45 -25
  175. package/dist/dashboard/atoms/move.js +1 -2
  176. package/dist/dashboard/atoms/nav.js +18 -10
  177. package/dist/dashboard/atoms/overview.d.ts +4 -2
  178. package/dist/dashboard/atoms/overview.js +1 -0
  179. package/dist/dashboard/atoms/remove.js +3 -3
  180. package/dist/dashboard/atoms/upload.d.ts +15 -1
  181. package/dist/dashboard/atoms/upload.js +37 -13
  182. package/dist/dashboard/boot/DashboardWorker.js +3 -1
  183. package/dist/dashboard/cms/EntryTable.js +18 -13
  184. package/dist/dashboard/icons.d.ts +1 -0
  185. package/dist/dashboard/icons.js +20 -0
  186. package/dist/database/EntryDatabase.d.ts +5 -0
  187. package/dist/database/EntryDatabase.js +16 -10
  188. package/dist/database/EntryStore.js +31 -9
  189. package/dist/database/EntryTransaction.js +10 -5
  190. package/dist/database/query/EntryQuery.js +39 -2
  191. package/dist/database/query/ResolveQuery.d.ts +1 -1
  192. package/dist/database/query/ResolveQuery.js +9 -2
  193. package/dist/database/sync/Derive.d.ts +2 -1
  194. package/dist/database/sync/Derive.js +2 -1
  195. package/dist/database/sync/EntrySyncer.d.ts +2 -1
  196. package/dist/database/sync/EntrySyncer.js +8 -7
  197. package/dist/database/sync/Ingest.d.ts +2 -2
  198. package/dist/database/sync/Ingest.js +48 -33
  199. package/dist/field/check/CheckField.view.js +1 -0
  200. package/dist/field/code/CodeField.view.js +14 -13
  201. package/dist/field/link/FileLink.d.ts +2 -2
  202. package/dist/field/link/FileLink.js +7 -6
  203. package/dist/field/link/ImageLink.d.ts +9 -9
  204. package/dist/field/link/ImageLink.js +14 -23
  205. package/dist/field/link/LinkField.view.js +29 -21
  206. package/dist/field/list/ListField.d.ts +3 -2
  207. package/dist/field/list/ListField.view.js +32 -15
  208. package/dist/field/localiser/LocalisedField.view.js +23 -3
  209. package/dist/field/localiser/Localiser.d.ts +17 -1
  210. package/dist/field/localiser/Localiser.js +127 -0
  211. package/dist/field/metadata/MetadataField.view.js +18 -18
  212. package/dist/field/number/NumberField.view.js +3 -2
  213. package/dist/field/object/ObjectField.d.ts +3 -1
  214. package/dist/field/object/ObjectField.view.js +34 -13
  215. package/dist/field/richtext/PickTextLink.js +4 -14
  216. package/dist/field/richtext/RichTextBlock.js +3 -3
  217. package/dist/field/richtext/RichTextExtensions.js +26 -26
  218. package/dist/field/richtext/RichTextField.story.d.ts +1 -0
  219. package/dist/field/richtext/RichTextField.view.js +8 -7
  220. package/dist/field/richtext/RichTextInsertMenu.js +17 -3
  221. package/dist/field/tabs/Tabs.d.ts +12 -3
  222. package/dist/field/tabs/Tabs.js +11 -2
  223. package/dist/field.d.ts +1 -1
  224. package/dist/field.js +2 -1
  225. package/dist/index.css +178 -139
  226. package/dist/picker/entry/EntryPicker.d.ts +2 -1
  227. package/dist/picker/entry/EntryPicker.js +1 -1
  228. package/dist/preview/widget.d.ts +3 -0
  229. package/dist/preview/widget.js +26 -8
  230. package/dist/ui/RichText.js +31 -1
  231. package/docs/ai-setup.md +3 -3
  232. package/docs/components/list.md +2 -1
  233. package/docs/fields/list.md +9 -5
  234. package/docs/fields/tabs.md +24 -0
  235. package/docs/fields.md +2 -2
  236. package/docs/instant-publishing.md +14 -2
  237. package/docs/internationalization.md +31 -14
  238. package/docs/overviews.md +2 -1
  239. package/docs/query/structural.md +2 -1
  240. package/docs/quickstart.md +5 -5
  241. package/docs/schema/document.md +1 -1
  242. package/docs/schema/type.md +1 -1
  243. package/docs/upgrading.md +1 -1
  244. package/docs/workspaces/media.md +86 -0
  245. package/llms-full.txt +183 -37
  246. package/package.json +1 -1
  247. package/readme.md +2 -2
  248. package/dist/dashboard/app/BlockSettings.d.ts +0 -9
  249. package/dist/dashboard/app/BlockSettings.js +0 -16
  250. package/dist/dashboard/app/SettingsTab.d.ts +0 -6
  251. package/dist/chunks/{chunk-6FQ5IMNA.js → chunk-4ZA6KZHS.js} +3 -3
  252. /package/dist/chunks/{dist-OU2RRDGP.js → dist-IDG44KDI.js} +0 -0
package/dist/bundled.d.ts CHANGED
@@ -719,9 +719,11 @@ declare module 'alinea/backend/Handler' {
719
719
  cms: CMS;
720
720
  db: LocalStore | Promise<LocalStore>;
721
721
  remote?: (context: RequestContext) => RemoteConnection;
722
+ /** Log why and how long each sync took, for a deployed handler */
723
+ logSyncs?: boolean;
722
724
  forwardMutations?(request: Request, context: AuthedContext): Promise<Response | undefined>;
723
725
  }
724
- export function createHandler({ cms, remote, db, forwardMutations, ...hooks }: HandlerOptions): Handler;
726
+ export function createHandler({ cms, remote, db, forwardMutations, logSyncs, ...hooks }: HandlerOptions): Handler;
725
727
 
726
728
  }
727
729
 
@@ -3041,7 +3043,7 @@ declare module 'alinea/components/Field' {
3041
3043
  * inputs in this library render a Field, use it directly to give a custom
3042
3044
  * control the same chrome.
3043
3045
  */
3044
- export function Field({ label, description, error, required, disabled, icon, shared, htmlFor, className, style, children }: FieldProps): import("react").JSX.Element | null;
3046
+ export function Field({ label, description, error, required, disabled, readOnly, icon, shared, htmlFor, className, style, children }: FieldProps): import("react").JSX.Element | null;
3045
3047
  export interface FieldLabelProps extends StyleProps {
3046
3048
  htmlFor?: string;
3047
3049
  required?: boolean;
@@ -3528,11 +3530,14 @@ declare module 'alinea/components/List' {
3528
3530
  shared?: boolean;
3529
3531
  /** Marks the label with an asterisk, like a required field label */
3530
3532
  required?: boolean;
3533
+ /** Fades the label like the label of a read-only field */
3534
+ readOnly?: boolean;
3531
3535
  showFold?: boolean;
3532
3536
  description?: ReactNode;
3537
+ /** Hides the label and with it the fold, which would float alone */
3533
3538
  inline?: boolean;
3534
3539
  }
3535
- export function ListLabel({ children, expanded, hasRows, shared, required, showFold, className, description, inline, ...props }: ListLabelProps): import("react").JSX.Element | null;
3540
+ export function ListLabel({ children, expanded, hasRows, shared, required, readOnly, showFold, className, description, inline, ...props }: ListLabelProps): import("react").JSX.Element | null;
3536
3541
  export interface ListErrorProps extends ComponentPropsWithoutRef<'div'> {
3537
3542
  }
3538
3543
  export function ListError({ className, ...props }: ListErrorProps): import("react").JSX.Element;
@@ -4030,7 +4035,7 @@ declare module 'alinea/components/Select' {
4030
4035
  declare module 'alinea/components/Sheet' {
4031
4036
 
4032
4037
  import { type MouseEvent, type ReactNode } from 'react';
4033
- import type { AriaProps, DataProps, StyleProps } from 'alinea/components/types';
4038
+ import type { AriaProps, DataProps, IconType, StyleProps } from 'alinea/components/types';
4034
4039
  export interface SheetContentProps extends StyleProps, AriaProps, DataProps {
4035
4040
  /** Called on Escape while focus is inside the sheet, and by `SheetClose` */
4036
4041
  onClose?: () => void;
@@ -4064,8 +4069,10 @@ declare module 'alinea/components/Sheet' {
4064
4069
  export function SheetBody({ className, ...props }: SheetBodyProps): import("react").JSX.Element;
4065
4070
  export interface SheetSectionProps extends SheetPartProps {
4066
4071
  title?: ReactNode;
4072
+ /** Shown before the title */
4073
+ icon?: IconType;
4067
4074
  }
4068
- export function SheetSection({ title, className, children, ...props }: SheetSectionProps): import("react").JSX.Element;
4075
+ export function SheetSection({ title, icon, className, children, ...props }: SheetSectionProps): import("react").JSX.Element;
4069
4076
  export interface SheetFooterProps extends SheetPartProps {
4070
4077
  }
4071
4078
  /**
@@ -4318,6 +4325,8 @@ declare module 'alinea/components/Table' {
4318
4325
  export interface TableColumn {
4319
4326
  id: Key;
4320
4327
  header: ReactNode;
4328
+ /** Explains the column in a popover, opened from a button by the header */
4329
+ info?: ReactNode;
4321
4330
  /** A fixed width in pixels or a fraction of the remaining space */
4322
4331
  width?: number | `${number}fr`;
4323
4332
  /** Minimum width in pixels of a fractional column */
@@ -4919,6 +4928,7 @@ declare module 'alinea/components/types' {
4919
4928
  declare module 'alinea/config' {
4920
4929
 
4921
4930
  export { createMediaRoot as media } from 'alinea/core/media/MediaRoot';
4931
+ export { file, mediaFile, mediaLibrary, mediaOverview } from 'alinea/core/media/MediaTypes';
4922
4932
  export { createConfig as create } from 'alinea/core/Config';
4923
4933
  export { document } from 'alinea/core/Document';
4924
4934
  export { column } from 'alinea/core/Overview';
@@ -5044,10 +5054,11 @@ declare module 'alinea/core/CMS' {
5044
5054
  declare module 'alinea/core/Config' {
5045
5055
 
5046
5056
  import type { ImageResizeOptions } from 'alinea/core/media/ImageTransform';
5057
+ import { type FileFields } from 'alinea/core/media/MediaTypes';
5047
5058
  import type { Preview } from 'alinea/core/Preview';
5048
5059
  import type { Auth } from 'alinea/core/Auth';
5049
5060
  import { type Role } from 'alinea/core/Role';
5050
- import { Root } from 'alinea/core/Root';
5061
+ import { Root, type RootI18n } from 'alinea/core/Root';
5051
5062
  import { Schema } from 'alinea/core/Schema';
5052
5063
  import type { Tracer } from 'alinea/core/Trace';
5053
5064
  import { Type } from 'alinea/core/Type';
@@ -5119,11 +5130,45 @@ declare module 'alinea/core/Config' {
5119
5130
  * always hold files.
5120
5131
  */
5121
5132
  function rootContains(config: Config, root: Root, childType: Type): boolean;
5133
+ /** The file types of the schema, see `Config.file` */
5134
+ function fileTypes(config: Config): Array<Type<FileFields>>;
5135
+ /**
5136
+ * The condition of uploaded files: entries of a file type, or only those
5137
+ * holding an image
5138
+ */
5139
+ function fileCondition(config: Config, files: 'file' | 'image'): Record<string, unknown>;
5140
+ /**
5141
+ * The file types an upload to a location can become, in order: those the
5142
+ * parent entry's type contains, or else those the root contains. Media
5143
+ * roots and their folders also take media files, after their own types.
5144
+ */
5145
+ function uploadTypes(config: Config, location: {
5146
+ workspace: string;
5147
+ root: string;
5148
+ parentType?: string;
5149
+ }): Array<string>;
5150
+ /**
5151
+ * The file types an upload to a location can become. A location without
5152
+ * file types takes media files, as uploads did before file types existed.
5153
+ */
5154
+ function uploadCandidates(config: Config, location: {
5155
+ workspace: string;
5156
+ root: string;
5157
+ parentType?: string;
5158
+ }): Array<string>;
5159
+ /** The upload candidates of a location that accept a file */
5160
+ function acceptingTypes(config: Config, location: {
5161
+ workspace: string;
5162
+ root: string;
5163
+ parentType?: string;
5164
+ }, fileName: string, mimeType?: string): Array<string>;
5122
5165
  function typeContains(config: Config, parentType: Type, childType: Type): boolean;
5123
5166
  function hasAuth(config: Config): boolean;
5124
5167
  function multipleWorkspaces(config: Config): boolean;
5125
5168
  function contentDir(config: Config): string;
5126
5169
  function filePath(config: Config, workspace: string, root: string, locale: string | null, ...rest: Array<string>): string;
5170
+ /** The locales of the `Field.localised` fields of a root, if it has them */
5171
+ function fieldI18n(config: Config, workspace: string, root: string): RootI18n | undefined;
5127
5172
  function validate(config: Config): void;
5128
5173
  function referencedViews(config: Config): Array<string>;
5129
5174
  }
@@ -5414,6 +5459,7 @@ declare module 'alinea/core/db/LinkResolver' {
5414
5459
 
5415
5460
  import type { InferProjection, Projection } from 'alinea/core/Graph';
5416
5461
  import type { Config } from 'alinea/core/Config';
5462
+ import type { RootI18n } from 'alinea/core/Root';
5417
5463
  export interface LinkTarget {
5418
5464
  entryId: string;
5419
5465
  locale?: string;
@@ -5422,6 +5468,8 @@ declare module 'alinea/core/db/LinkResolver' {
5422
5468
  export interface LinkResolver {
5423
5469
  config: Config;
5424
5470
  locale: string | null;
5471
+ /** The locales of the root of the entry being read, if it translates fields */
5472
+ fieldI18n?: RootI18n;
5425
5473
  includedAtBuild(filePath: string): boolean | Promise<boolean>;
5426
5474
  resolveLinks<P extends Projection>(projection: P, entryIds: ReadonlyArray<string>, locale?: string | null): Promise<Array<InferProjection<P>>>;
5427
5475
  resolveTargets<P extends Projection & {
@@ -5443,12 +5491,24 @@ declare module 'alinea/core/db/LocalStore' {
5443
5491
  validate?: boolean;
5444
5492
  /** Called as files arrive from the remote, once there are files to fetch. */
5445
5493
  onProgress?(progress: SyncProgress): void;
5494
+ /** Filled in with where the sync spent its time, see `loggedSync`. */
5495
+ stats?: SyncStats;
5446
5496
  }
5447
5497
  /** Files fetched from the remote during a sync. */
5448
5498
  export interface SyncProgress {
5449
5499
  loaded: number;
5450
5500
  total: number;
5451
5501
  }
5502
+ export type SyncStep = 'tree' | 'blobs' | 'parse' | 'write' | 'derive' | 'analyze';
5503
+ /** Where a sync spent its time and how much it changed. */
5504
+ export interface SyncStats {
5505
+ /** Milliseconds per step: tree and blobs wait for the remote. */
5506
+ steps: Partial<Record<SyncStep, number>>;
5507
+ /** Files fetched from the remote */
5508
+ files: number;
5509
+ /** Entry versions derived again */
5510
+ versions: number;
5511
+ }
5452
5512
  /**
5453
5513
  * A locally available entry store: a writeable graph backed by a source that
5454
5514
  * can be synced against a remote and committed to. Implemented by the SQLite
@@ -5629,6 +5689,12 @@ declare module 'alinea/core/db/Operation' {
5629
5689
  workspace?: string;
5630
5690
  root?: string;
5631
5691
  parentId?: string | null;
5692
+ /**
5693
+ * The file type the upload becomes, one of those the location contains.
5694
+ * Defaults to the first of them that accepts the file, a replaced file
5695
+ * keeps its type.
5696
+ */
5697
+ type?: string;
5632
5698
  createPreview?(blob: Blob): Promise<ImagePreviewDetails | undefined>;
5633
5699
  /** Rotate and crop the image before it is uploaded */
5634
5700
  edit?: ImageEdit;
@@ -5668,6 +5734,27 @@ declare module 'alinea/core/db/Operation' {
5668
5734
 
5669
5735
  }
5670
5736
 
5737
+ declare module 'alinea/core/db/SyncStats' {
5738
+
5739
+ import type { RemoteSource } from 'alinea/core/source/Source';
5740
+ import type { LocalStore, SyncOptions, SyncStats, SyncStep } from 'alinea/core/db/LocalStore';
5741
+ export const syncSteps: Array<SyncStep>;
5742
+ export function syncStats(): SyncStats;
5743
+ /** Add the time `run` takes to a step, when the sync is measured. */
5744
+ export function timeStep<T>(stats: SyncStats | undefined, step: SyncStep, run: () => T | Promise<T>): Promise<T>;
5745
+ /**
5746
+ * Sync and log why, between which revisions and where the time went, also
5747
+ * when it fails: slow syncs are found in the server logs.
5748
+ */
5749
+ export function loggedSync(store: Pick<LocalStore, 'sha' | 'syncWith'>, remote: RemoteSource, reason: string, options?: SyncOptions): Promise<string>;
5750
+ /**
5751
+ * Such as `Alinea synced 1a2b3c4 → 5d6e7f8 (interval) in 812 ms: tree 80 ms,
5752
+ * blobs 410 ms, …, 1 file, 4 versions derived`.
5753
+ */
5754
+ export function describeSync(reason: string, from: string, to: string | undefined, durationMs: number, stats: SyncStats): string;
5755
+
5756
+ }
5757
+
5671
5758
  declare module 'alinea/core/db/WriteableGraph' {
5672
5759
 
5673
5760
  import type { Infer } from 'alinea';
@@ -5698,20 +5785,7 @@ declare module 'alinea/core/db/WriteableGraph' {
5698
5785
  index: string;
5699
5786
  }>;
5700
5787
  discard(query: DiscardQuery): Promise<void>;
5701
- upload(query: UploadQuery): Promise<{
5702
- _id: string;
5703
- _type: string;
5704
- _index: string;
5705
- _workspace: string;
5706
- _root: string;
5707
- _status: import("alinea/core/Entry").EntryStatus;
5708
- _parentId: string | null;
5709
- _locale: string | null;
5710
- _path: string;
5711
- _url: string;
5712
- _createdAt: number | null;
5713
- _updatedAt: number | null;
5714
- _active: boolean;
5788
+ upload(query: UploadQuery): Promise<EntryFields & {
5715
5789
  title: string;
5716
5790
  path: string;
5717
5791
  metadata: {
@@ -5749,19 +5823,21 @@ declare module 'alinea/core/Document' {
5749
5823
  import { type MetadataField } from 'alinea/field/metadata';
5750
5824
  import { type PathField } from 'alinea/field/path';
5751
5825
  import { type TextField } from 'alinea/field/text';
5752
- import { type ContainerTypeConfig, type FieldsDefinition, type Type, type TypeConfig } from 'alinea/core/Type';
5826
+ import { type ContainerTypeConfig, type FieldsDefinition, type TabFields, Type, type TypeConfig } from 'alinea/core/Type';
5753
5827
  export type Document = {
5754
5828
  title: TextField;
5755
5829
  path: PathField;
5756
5830
  metadata: MetadataField;
5757
5831
  };
5758
- export type DocumentConfig<Fields, Seo, Details, Settings = {}> = (TypeConfig<Fields, Settings> | ContainerTypeConfig<Fields, Settings>) & {
5832
+ export type DocumentConfig<Fields, Seo, Details, Tabs = {}> = (TypeConfig<Fields> | ContainerTypeConfig<Fields>) & {
5833
+ /** Tabs after the Details tab, eg. an Analytics tab with a view */
5834
+ tabs?: Tabs;
5759
5835
  /** Fields shown in the SEO tab, above the previews */
5760
5836
  seo?: Seo;
5761
5837
  /** Fields shown in the Details tab, above the created and updated details */
5762
5838
  details?: Details;
5763
5839
  };
5764
- export function document<Fields extends FieldsDefinition = {}, Seo extends FieldsDefinition = {}, Details extends FieldsDefinition = {}, Settings extends FieldsDefinition = {}>(label: string, { fields, seo, details, settings, ...config }: DocumentConfig<Fields, Seo, Details, Settings>): Type<Document & Fields & Seo & Details & Settings>;
5840
+ export function document<Fields extends FieldsDefinition = {}, Seo extends FieldsDefinition = {}, Details extends FieldsDefinition = {}, Tabs extends Record<string, Type> = {}>(label: string, { fields, seo, details, tabs: extraTabs, ...config }: DocumentConfig<Fields, Seo, Details, Tabs>): Type<Document & Fields & Seo & Details & TabFields<Tabs>>;
5765
5841
  /** Whether `type` was created with `Config.document` */
5766
5842
  export function isDocument(type: Type): boolean;
5767
5843
 
@@ -6036,6 +6112,8 @@ declare module 'alinea/core/Field' {
6036
6112
  import type { EntryReferenceTarget, FieldReferenceContext } from 'alinea/core/db/EntryReference';
6037
6113
  import type { LinkResolver } from 'alinea/core/db/LinkResolver';
6038
6114
  import { Expr } from 'alinea/core/Expr';
6115
+ import type { RootI18n } from 'alinea/core/Root';
6116
+ import type { Type } from 'alinea/core/Type';
6039
6117
  import { type HasField, internalField } from 'alinea/core/Internal';
6040
6118
  import type { User } from 'alinea/core/User';
6041
6119
  import type { FieldValidationContext, FieldValidationError } from 'alinea/core/Validation';
@@ -6076,6 +6154,11 @@ declare module 'alinea/core/Field' {
6076
6154
  export interface FieldAnchorContext {
6077
6155
  anchors: Set<string>;
6078
6156
  }
6157
+ /** Where a value is edited or created, for fields that depend on its root */
6158
+ export interface FieldInitialContext {
6159
+ /** The locales of a root that translates fields, see `Field.localised` */
6160
+ fieldI18n?: RootI18n;
6161
+ }
6079
6162
  export interface FieldLocalizeContext {
6080
6163
  locale: string;
6081
6164
  entryIds: Set<string>;
@@ -6107,8 +6190,10 @@ declare module 'alinea/core/Field' {
6107
6190
  }
6108
6191
  export interface FieldData<StoredValue, QueryValue, Mutator, Options> extends FieldMeta<StoredValue, QueryValue, Mutator, Options> {
6109
6192
  referencedViews?: Array<string>;
6193
+ /** The types of the values nested in this field: list rows, blocks, ... */
6194
+ nestedTypes?: Array<Type>;
6110
6195
  defaultValue?: () => StoredValue;
6111
- withInitialValue?: (value: StoredValue) => StoredValue;
6196
+ withInitialValue?: (value: StoredValue, context?: FieldInitialContext) => StoredValue;
6112
6197
  applyLinks?: (value: StoredValue, loader: LinkResolver) => Promise<void>;
6113
6198
  searchableText?: (value: StoredValue) => string;
6114
6199
  /** Whether the value counts as missing for the `required` option */
@@ -6135,7 +6220,9 @@ declare module 'alinea/core/Field' {
6135
6220
  function ref(field: HasField): symbol;
6136
6221
  function label(field: HasField): string;
6137
6222
  function initialValue(field: HasField): unknown;
6138
- function withInitialValue<StoredValue>(field: HasField, value: StoredValue): StoredValue;
6223
+ function withInitialValue<StoredValue>(field: HasField, value: StoredValue, context?: FieldInitialContext): StoredValue;
6224
+ /** The types of the values nested in a field, such as list rows */
6225
+ function nestedTypes(field: HasField): Array<Type>;
6139
6226
  function view<StoredValue, QueryValue, Mutator, Options extends FieldOptions<StoredValue>>(field: Field<StoredValue, QueryValue, Mutator, Options>): View<{
6140
6227
  field: Field<StoredValue, QueryValue, Mutator, Options>;
6141
6228
  }>;
@@ -6520,6 +6607,12 @@ declare module 'alinea/core/Graph' {
6520
6607
  | 'preferDraft'
6521
6608
  /** Prefer published, then archived, then drafts */
6522
6609
  | 'preferPublished'
6610
+ /**
6611
+ * Like `preferDraft` without archived entries: what a preview shows. The
6612
+ * previewed entry shows as published, also when it is archived. Draft mode
6613
+ * queries with this status.
6614
+ */
6615
+ | 'preview'
6523
6616
  /** All statuses */
6524
6617
  | 'all';
6525
6618
  export class QuerySettings {
@@ -6765,6 +6858,9 @@ declare module 'alinea/core/Internal' {
6765
6858
  };
6766
6859
  export const hasExpr: (obj: object) => obj is HasExpr;
6767
6860
  export const getExpr: (obj: HasExpr) => ExprInternal;
6861
+ /** A type standing in for a built-in type, see `Config.mediaFile` */
6862
+ export const internalReplaces: unique symbol;
6863
+ export const getReplaced: (obj: object) => HasType | undefined;
6768
6864
 
6769
6865
  }
6770
6866
 
@@ -6848,6 +6944,18 @@ declare module 'alinea/core/media/CreatePreview' {
6848
6944
 
6849
6945
  }
6850
6946
 
6947
+ declare module 'alinea/core/media/FileAccept' {
6948
+
6949
+ /**
6950
+ * Whether a file matches an `accept` list, like the accept attribute of a
6951
+ * file input: extensions (`.pdf`), media types (`application/pdf`) and media
6952
+ * type groups (`image/*`). A file matches everything without a list. Without
6953
+ * the media type of the file, groups match by the extensions of their kind.
6954
+ */
6955
+ export function fileAccepts(accept: string | undefined, fileName: string, mimeType?: string): boolean;
6956
+
6957
+ }
6958
+
6851
6959
  declare module 'alinea/core/media/FileKinds' {
6852
6960
 
6853
6961
  /** Groups of file extensions in the media library */
@@ -7021,9 +7129,98 @@ declare module 'alinea/core/media/MediaRoot' {
7021
7129
 
7022
7130
  declare module 'alinea/core/media/MediaTypes' {
7023
7131
 
7132
+ import { Expr } from 'alinea/core/Expr';
7024
7133
  import { type OverviewOptions } from 'alinea/core/Overview';
7025
- import { type Type } from 'alinea/core/Type';
7134
+ import { type FieldsDefinition, type TabFields, type Type, type TypeConfig } from 'alinea/core/Type';
7135
+ import { type MediaAltValue } from 'alinea/core/media/MediaAltField';
7136
+ export interface FileTypeConfig<Fields> extends Omit<TypeConfig<Fields>, 'fields'> {
7137
+ fields?: Fields;
7138
+ /**
7139
+ * The files of this type, like the accept attribute of a file input:
7140
+ * extensions (`.pdf,.docx`), media types (`application/pdf`) or groups of
7141
+ * them (`image/*`). Without, the type takes every file.
7142
+ */
7143
+ accept?: string;
7144
+ }
7145
+ /** The data alinea keeps of every uploaded file */
7146
+ function fileFields(): {
7147
+ title: import("alinea/field/text/TextField").TextField;
7148
+ path: import("alinea/field/path/PathField").PathField;
7149
+ metadata: import("alinea/field/object").ObjectField<import("alinea/field/metadata/MetadataAudit").MetadataDetailsFields> & import("alinea/field/metadata/MetadataAudit").MetadataDetailsFields;
7150
+ location: import("alinea/field/hidden/HiddenField").HiddenField<string>;
7151
+ previewUrl: import("alinea/field/hidden/HiddenField").HiddenField<string>;
7152
+ extension: import("alinea/field/hidden/HiddenField").HiddenField<string>;
7153
+ size: import("alinea/field/hidden/HiddenField").HiddenField<number>;
7154
+ hash: import("alinea/field/hidden/HiddenField").HiddenField<string>;
7155
+ /** The hash of the file as uploaded, before it was scaled down */
7156
+ sourceHash: import("alinea/field/hidden/HiddenField").HiddenField<string>;
7157
+ width: import("alinea/field/hidden/HiddenField").HiddenField<number>;
7158
+ height: import("alinea/field/hidden/HiddenField").HiddenField<number>;
7159
+ preview: import("alinea/field/hidden/HiddenField").HiddenField<string>;
7160
+ averageColor: import("alinea/field/hidden/HiddenField").HiddenField<string>;
7161
+ focus: import("alinea/field/hidden/HiddenField").HiddenField<{
7162
+ x: number;
7163
+ y: number;
7164
+ }>;
7165
+ thumbHash: import("alinea/field/hidden/HiddenField").HiddenField<string>;
7166
+ };
7167
+ export type FileFields = ReturnType<typeof fileFields>;
7168
+ /** The keys of the fields every file type has */
7169
+ export const fileFieldKeys: ReadonlySet<string>;
7170
+ /**
7171
+ * A type of uploaded file. Its entries keep the data of the file next to the
7172
+ * fields of the type. An upload becomes the first file type the location
7173
+ * contains that accepts the file.
7174
+ */
7175
+ export function file<Fields extends FieldsDefinition = {}, Tabs extends Record<string, Type> = {}>(label: string, { fields, ...config }?: FileTypeConfig<Fields> & {
7176
+ tabs?: Tabs;
7177
+ }): Type<FileFields & Fields & TabFields<Tabs>>;
7178
+ /** Whether `type` was created with `Config.file` */
7179
+ export function isFileType(type: Type | undefined): boolean;
7180
+ /** Whether a file type takes a file */
7181
+ export function fileTypeAccepts(type: Type, fileName: string, mimeType?: string): boolean;
7182
+ /** The data of uploaded files, of whichever file type */
7183
+ export const FileData: {
7184
+ location: Expr<string>;
7185
+ previewUrl: Expr<string>;
7186
+ extension: Expr<string>;
7187
+ size: Expr<number>;
7188
+ hash: Expr<string>;
7189
+ sourceHash: Expr<string>;
7190
+ alt: Expr<MediaAltValue>;
7191
+ width: Expr<number>;
7192
+ height: Expr<number>;
7193
+ preview: Expr<string>;
7194
+ averageColor: Expr<string>;
7195
+ focus: Expr<{
7196
+ x: number;
7197
+ y: number;
7198
+ }>;
7199
+ thumbHash: Expr<string>;
7200
+ };
7026
7201
  export type MediaFile = Type.Infer<typeof MediaFile>;
7202
+ const mediaFileFields: {
7203
+ title: import("alinea/field/text/TextField").TextField;
7204
+ path: import("alinea/field/path/PathField").PathField;
7205
+ metadata: import("alinea/field/object").ObjectField<import("alinea/field/metadata/MetadataAudit").MetadataDetailsFields> & import("alinea/field/metadata/MetadataAudit").MetadataDetailsFields;
7206
+ location: import("alinea/field/hidden/HiddenField").HiddenField<string>;
7207
+ previewUrl: import("alinea/field/hidden/HiddenField").HiddenField<string>;
7208
+ extension: import("alinea/field/hidden/HiddenField").HiddenField<string>;
7209
+ size: import("alinea/field/hidden/HiddenField").HiddenField<number>;
7210
+ hash: import("alinea/field/hidden/HiddenField").HiddenField<string>;
7211
+ /** The hash of the file as uploaded, before it was scaled down */
7212
+ sourceHash: import("alinea/field/hidden/HiddenField").HiddenField<string>;
7213
+ alt: import("alinea/core/media/MediaAltField").MediaAltField;
7214
+ width: import("alinea/field/hidden/HiddenField").HiddenField<number>;
7215
+ height: import("alinea/field/hidden/HiddenField").HiddenField<number>;
7216
+ preview: import("alinea/field/hidden/HiddenField").HiddenField<string>;
7217
+ averageColor: import("alinea/field/hidden/HiddenField").HiddenField<string>;
7218
+ focus: import("alinea/field/hidden/HiddenField").HiddenField<{
7219
+ x: number;
7220
+ y: number;
7221
+ }>;
7222
+ thumbHash: import("alinea/field/hidden/HiddenField").HiddenField<string>;
7223
+ };
7027
7224
  export const MediaFile: Type<{
7028
7225
  title: import("alinea/field/text/TextField").TextField;
7029
7226
  path: import("alinea/field/path/PathField").PathField;
@@ -7046,16 +7243,51 @@ declare module 'alinea/core/media/MediaTypes' {
7046
7243
  }>;
7047
7244
  thumbHash: import("alinea/field/hidden/HiddenField").HiddenField<string>;
7048
7245
  }>;
7246
+ export interface MediaFileConfig<Fields, Tabs> {
7247
+ /** Fields next to the title and path of the file */
7248
+ fields?: Fields;
7249
+ tabs?: Tabs;
7250
+ }
7251
+ /**
7252
+ * Media files with tabs or fields of your own, as the `MediaFile` of the
7253
+ * schema: `schema: {MediaFile: Config.mediaFile({tabs: {...}})}`. Files
7254
+ * uploaded before have them too, and queries naming `MediaFile` find it.
7255
+ */
7256
+ export function mediaFile<Fields extends FieldsDefinition = {}, Tabs extends Record<string, Type> = {}>({ fields, tabs }?: MediaFileConfig<Fields, Tabs>): Type<typeof mediaFileFields & Fields & TabFields<Tabs>>;
7049
7257
  export type MediaLibrary = Type.Infer<typeof MediaLibrary>;
7258
+ const mediaLibraryFields: {
7259
+ title: import("alinea/field/text/TextField").TextField;
7260
+ path: import("alinea/field/path/PathField").PathField;
7261
+ };
7050
7262
  export const MediaLibrary: Type<{
7051
7263
  title: import("alinea/field/text/TextField").TextField;
7052
7264
  path: import("alinea/field/path/PathField").PathField;
7053
- }>;
7265
+ } & object>;
7266
+ export interface MediaLibraryConfig<Fields, Tabs> {
7267
+ /** Fields next to the title and path of the folder */
7268
+ fields?: Fields;
7269
+ tabs?: Tabs;
7270
+ /**
7271
+ * How folders list their contents, in place of the built-in
7272
+ * `Config.mediaOverview()`
7273
+ */
7274
+ overview?: OverviewOptions;
7275
+ }
7276
+ /**
7277
+ * Media folders with an overview, tabs or fields of your own, as the
7278
+ * `MediaLibrary` of the schema:
7279
+ * `schema: {MediaLibrary: Config.mediaLibrary({overview: {...}})}`. Queries
7280
+ * naming `MediaLibrary` find it.
7281
+ */
7282
+ export function mediaLibrary<Fields extends FieldsDefinition = {}, Tabs extends Record<string, Type> = {}>({ fields, ...config }?: MediaLibraryConfig<Fields, Tabs>): Type<typeof mediaLibraryFields & Fields & TabFields<Tabs>>;
7283
+ /** Whether `type` is `MediaLibrary`, or the type standing in for it */
7284
+ export function isMediaLibrary(type: Type | undefined): boolean;
7054
7285
  /**
7055
7286
  * The overview of the media library: a preview, the dimensions, size and type
7056
7287
  * of each file, orders and filters on those
7057
7288
  */
7058
7289
  export function mediaOverview(): OverviewOptions;
7290
+ export {};
7059
7291
 
7060
7292
  }
7061
7293
 
@@ -7082,7 +7314,7 @@ declare module 'alinea/core/media/Pdf' {
7082
7314
  declare module 'alinea/core/media/Summary' {
7083
7315
 
7084
7316
  import type { Schema } from 'alinea/core/Schema';
7085
- export function summarySelection(schema: Schema): {
7317
+ export function summarySelection(_schema: Schema): {
7086
7318
  id: import("alinea/core/Expr").Expr<string>;
7087
7319
  locale: import("alinea/core/Expr").Expr<string | null>;
7088
7320
  type: import("alinea/core/Expr").Expr<string>;
@@ -7091,17 +7323,17 @@ declare module 'alinea/core/media/Summary' {
7091
7323
  title: import("alinea/core/Expr").Expr<string>;
7092
7324
  path: import("alinea/core/Expr").Expr<string>;
7093
7325
  url: import("alinea/core/Expr").Expr<string>;
7094
- extension: import("alinea/field/hidden").HiddenField<string>;
7095
- size: import("alinea/field/hidden").HiddenField<number>;
7096
- preview: import("alinea/field/hidden").HiddenField<string>;
7097
- thumbHash: import("alinea/field/hidden").HiddenField<string>;
7098
- averageColor: import("alinea/field/hidden").HiddenField<string>;
7099
- focus: import("alinea/field/hidden").HiddenField<{
7326
+ extension: import("alinea/core/Expr").Expr<string>;
7327
+ size: import("alinea/core/Expr").Expr<number>;
7328
+ preview: import("alinea/core/Expr").Expr<string>;
7329
+ thumbHash: import("alinea/core/Expr").Expr<string>;
7330
+ averageColor: import("alinea/core/Expr").Expr<string>;
7331
+ focus: import("alinea/core/Expr").Expr<{
7100
7332
  x: number;
7101
7333
  y: number;
7102
7334
  }>;
7103
- width: import("alinea/field/hidden").HiddenField<number>;
7104
- height: import("alinea/field/hidden").HiddenField<number>;
7335
+ width: import("alinea/core/Expr").Expr<number>;
7336
+ height: import("alinea/core/Expr").Expr<number>;
7105
7337
  parents: {
7106
7338
  edge: 'parents';
7107
7339
  select: {
@@ -7198,6 +7430,7 @@ declare module 'alinea/core/Outcome' {
7198
7430
 
7199
7431
  declare module 'alinea/core/Overview' {
7200
7432
 
7433
+ import type { ReactNode } from 'react';
7201
7434
  import type { EntryStatus } from 'alinea/core/Entry';
7202
7435
  import type { EntryFilterFields } from 'alinea/core/EntryFields';
7203
7436
  import { Expr } from 'alinea/core/Expr';
@@ -7387,8 +7620,13 @@ declare module 'alinea/core/Overview' {
7387
7620
  query: GraphQuery<undefined, Type | Array<Type> | undefined, undefined>;
7388
7621
  }
7389
7622
  interface OverviewColumnBase<Value> {
7390
- /** The column header */
7391
- header: string;
7623
+ /** The column header: text or a React element */
7624
+ header: ReactNode;
7625
+ /**
7626
+ * Explains the column in a popover, opened from an info button next to the
7627
+ * header
7628
+ */
7629
+ info?: ReactNode;
7392
7630
  /**
7393
7631
  * Order by this value when the column is sorted. Needed to sort columns
7394
7632
  * that select linked entries, which are not sortable otherwise.
@@ -7816,11 +8054,16 @@ declare module 'alinea/core/Root' {
7816
8054
  /** The locales entries in this root are translated into, the first is the default */
7817
8055
  locales: ReadonlyArray<string>;
7818
8056
  /**
7819
- * Locales to try, in order, when a per-locale value is empty for the
7820
- * requested locale. Used by `Config.media({i18n})` to pick the alt text of
7821
- * images. It does not affect which entry version a query returns: content
7822
- * roots store a separate entry per locale and a query for a locale without
7823
- * a translation returns nothing.
8057
+ * How content is translated: `entries` (the default) keeps an entry per
8058
+ * locale, `fields` keeps a single entry whose `Field.localised` fields hold
8059
+ * a value per locale
8060
+ */
8061
+ translate?: 'entries' | 'fields';
8062
+ /**
8063
+ * Locales to try, in order, when a `Field.localised` value is empty for
8064
+ * the requested locale. It does not affect which entry version a query
8065
+ * returns: a root that translates entries stores a separate entry per
8066
+ * locale and a query for a locale without a translation returns nothing.
7824
8067
  */
7825
8068
  fallback?: (requested: string) => ReadonlyArray<string>;
7826
8069
  }
@@ -7850,13 +8093,20 @@ declare module 'alinea/core/Root' {
7850
8093
  }
7851
8094
  export interface RootData extends RootMeta {
7852
8095
  label: string;
8096
+ /**
8097
+ * The i18n of a root that translates fields. Such a root keeps a single
8098
+ * entry per item, so its `i18n` is left out for everything that keeps an
8099
+ * entry per locale.
8100
+ */
8101
+ fieldI18n?: RootI18n;
7853
8102
  }
7854
8103
  export type Root<Children extends ChildrenDefinition = ChildrenDefinition> = Children & HasRoot;
7855
8104
  export namespace Root {
7856
8105
  function label(root: Root): Label;
7857
8106
  function contains(root: Root): Array<string | Type>;
7858
8107
  function data(root: Root): RootData;
7859
- function mediaI18n(root: RootData): RootI18n | undefined;
8108
+ /** The locales the `Field.localised` fields of a root hold a value in */
8109
+ function fieldI18n(root: RootData): RootI18n | undefined;
7860
8110
  function preview(root: Root): Preview | undefined;
7861
8111
  function defaultLocale(root: Root): string | undefined;
7862
8112
  /** The default order of children: `overview.sort`, or `orderChildrenBy` */
@@ -7871,6 +8121,7 @@ declare module 'alinea/core/Root' {
7871
8121
  }
7872
8122
  export interface RootInternal extends RootOptions<ChildrenDefinition> {
7873
8123
  label: string;
8124
+ fieldI18n?: RootI18n;
7874
8125
  }
7875
8126
  export function root<Entries extends ChildrenDefinition>(label: string, config?: RootOptions<Entries>): Root<Entries>;
7876
8127
 
@@ -7935,6 +8186,13 @@ declare module 'alinea/core/Scope' {
7935
8186
  locales(locale: string): Array<string>;
7936
8187
  stringify(input: any): string;
7937
8188
  parse<Result>(input: string): Result;
8189
+ /**
8190
+ * Recognize the entities of a previous build of this config by their key.
8191
+ * The dev server replaces the config of its database when the schema
8192
+ * changes, while the handler of the previous config still answers queries
8193
+ * that name its own types and fields.
8194
+ */
8195
+ adopt(previous: Scope): void;
7938
8196
  }
7939
8197
  export function getScope(config: Config): Scope;
7940
8198
 
@@ -8631,7 +8889,7 @@ declare module 'alinea/core/Type' {
8631
8889
  import type { Config } from 'alinea/core/Config';
8632
8890
  import type { EntryStatus } from 'alinea/core/Entry';
8633
8891
  import type { Expr } from 'alinea/core/Expr';
8634
- import { Field, type EntryAnchorTarget, type FieldAnchorContext, type FieldLocalizeContext, type FieldBeforeSaveContext } from 'alinea/core/Field';
8892
+ import { Field, type EntryAnchorTarget, type FieldAnchorContext, type FieldInitialContext, type FieldLocalizeContext, type FieldBeforeSaveContext } from 'alinea/core/Field';
8635
8893
  import { type HasType } from 'alinea/core/Internal';
8636
8894
  import type { Label } from 'alinea/core/Label';
8637
8895
  import type { OrderBy } from 'alinea/core/OrderBy';
@@ -8641,7 +8899,7 @@ declare module 'alinea/core/Type' {
8641
8899
  import type { View } from 'alinea/core/View';
8642
8900
  import type { EntryReferenceTarget } from 'alinea/core/db/EntryReference';
8643
8901
  import type { SummaryProps } from 'alinea/core/media/Summary';
8644
- import type { Expand } from 'alinea/core/util/Types';
8902
+ import type { Expand, UnionToIntersection } from 'alinea/core/util/Types';
8645
8903
  export interface EntryUrlInput {
8646
8904
  config: Config;
8647
8905
  data: Record<string, unknown>;
@@ -8676,14 +8934,14 @@ declare module 'alinea/core/Type' {
8676
8934
  function references(type: Type, value: Record<string, unknown>, path?: Array<string>, labels?: Array<string>): Array<EntryReferenceTarget>;
8677
8935
  function fields(type: Type): Record<string, Field>;
8678
8936
  function sections(type: Type): Section[];
8679
- /** Fields edited in the settings of a block, or a Settings tab of an entry */
8680
- function settings(type: Type): FieldsDefinition | undefined;
8937
+ /** The tabs of the type, see `TypeConfig.tabs` */
8938
+ function tabs(type: Type): Record<string, Type> | undefined;
8681
8939
  function isContainer(type: Type): boolean;
8682
8940
  function field(type: Type, name: string): Field | undefined;
8683
8941
  function isType(type: any): type is Type;
8684
8942
  function sharedData(type: Type, entryData: Record<string, unknown>): Record<string, unknown> | undefined;
8685
8943
  function initialValue(type: Type): Record<string, unknown>;
8686
- function withInitialValue(type: Type, value: Record<string, unknown>): Record<string, unknown>;
8944
+ function withInitialValue(type: Type, value: Record<string, unknown>, context?: FieldInitialContext): Record<string, unknown>;
8687
8945
  function normalizeAnchors(type: Type, value: Record<string, unknown>, context?: FieldAnchorContext): Record<string, unknown>;
8688
8946
  function localizeLinks(type: Type, value: Record<string, unknown>, context: FieldLocalizeContext): Record<string, unknown>;
8689
8947
  function beforeSave(type: Type, value: Record<string, unknown>, context: Omit<FieldBeforeSaveContext<unknown>, 'value'>): Record<string, unknown>;
@@ -8696,14 +8954,16 @@ declare module 'alinea/core/Type' {
8696
8954
  export interface FieldsDefinition {
8697
8955
  [key: string]: Field;
8698
8956
  }
8699
- export interface TypeConfig<Definition, Settings = {}> {
8957
+ export interface TypeConfig<Definition> {
8700
8958
  fields: Definition;
8701
8959
  /**
8702
- * Fields shown in the settings sheet of a block, below its label and
8703
- * anchor. Entries of the type show them in a Settings tab. They are stored
8704
- * and queried like the other fields.
8960
+ * Tabs next to the fields, eg.
8961
+ * `{analytics: Field.tab('Analytics', {view: '@/views/Analytics'})}`.
8962
+ * Entries show them in the entry editor, list rows and rich text blocks in
8963
+ * their settings sheet. The fields of a tab are stored and queried like the
8964
+ * other fields.
8705
8965
  */
8706
- settings?: Settings;
8966
+ tabs?: Record<string, Type>;
8707
8967
  /** Accepts entries of these types as children */
8708
8968
  contains?: Array<string | Type>;
8709
8969
  /** How the dashboard lists the children of entries of this type */
@@ -8759,19 +9019,25 @@ declare module 'alinea/core/Type' {
8759
9019
  preview?: Preview;
8760
9020
  }
8761
9021
  /** Types that only hold children can leave out their fields */
8762
- export interface ContainerTypeConfig<Definition, Settings = {}> extends Omit<TypeConfig<Definition, Settings>, 'fields' | 'contains'> {
9022
+ export interface ContainerTypeConfig<Definition> extends Omit<TypeConfig<Definition>, 'fields' | 'contains'> {
8763
9023
  fields?: Definition;
8764
9024
  /** Accepts entries of these types as children */
8765
9025
  contains: Array<string | Type>;
8766
9026
  }
8767
- export interface TypeInternal extends TypeConfig<FieldsDefinition, FieldsDefinition> {
9027
+ export interface TypeInternal extends TypeConfig<FieldsDefinition> {
8768
9028
  label: string;
8769
9029
  allFields: Record<string, Field>;
8770
9030
  sections: Array<Section>;
8771
9031
  }
9032
+ /** The fields of the tabs of a type, see `TypeConfig.tabs` */
9033
+ export type TabFields<Tabs> = [keyof Tabs] extends [never] ? {} : UnionToIntersection<{
9034
+ [K in keyof Tabs]: Tabs[K] extends Type<infer F> ? F : never;
9035
+ }[keyof Tabs]>;
8772
9036
  /** Create a new type */
8773
- export function type<Fields extends FieldsDefinition = {}, Settings extends FieldsDefinition = {}>(label: string, config: TypeConfig<Fields, Settings> | ContainerTypeConfig<Fields, Settings>): Type<Fields & Settings>;
8774
- export function createType<Fields extends FieldsDefinition = {}, Settings extends FieldsDefinition = {}>(label: string, { fields: definition, ...config }: TypeConfig<Fields, Settings> | ContainerTypeConfig<Fields, Settings>): Type<Fields & Settings>;
9037
+ export function type<Fields extends FieldsDefinition = {}, Tabs extends Record<string, Type> = {}>(label: string, config: (TypeConfig<Fields> | ContainerTypeConfig<Fields>) & {
9038
+ tabs?: Tabs;
9039
+ }): Type<Fields & TabFields<Tabs>>;
9040
+ export function createType<Fields extends FieldsDefinition = {}>(label: string, { fields: definition, ...config }: TypeConfig<Fields> | ContainerTypeConfig<Fields>): Type<Fields>;
8775
9041
  export {};
8776
9042
 
8777
9043
  }
@@ -9478,6 +9744,7 @@ declare module 'alinea/core/Validation' {
9478
9744
 
9479
9745
  import type { Config } from 'alinea/core/Config';
9480
9746
  import { Field, type FieldOptions } from 'alinea/core/Field';
9747
+ import type { RootI18n } from 'alinea/core/Root';
9481
9748
  import type { Policy, Resource } from 'alinea/core/Role';
9482
9749
  import { type FieldGetter } from 'alinea/core/Tracker';
9483
9750
  import { Type } from 'alinea/core/Type';
@@ -9503,11 +9770,15 @@ declare module 'alinea/core/Validation' {
9503
9770
  /** The records enclosing the field, outermost first, to resolve trackers */
9504
9771
  scopes: Array<ValidationScope>;
9505
9772
  fieldOptions?: FieldOptionsResolver;
9773
+ /** The locales of a root that translates fields, see `Field.localised` */
9774
+ fieldI18n?: RootI18n;
9506
9775
  }
9507
9776
  export interface ValidateEntryOptions {
9508
9777
  /** @deprecated Unused, validation does not depend on the locale */
9509
9778
  locale?: string | null;
9510
9779
  fieldOptions?: FieldOptionsResolver;
9780
+ /** The locales of the entry's root, if it translates fields */
9781
+ fieldI18n?: RootI18n;
9511
9782
  }
9512
9783
  /**
9513
9784
  * The error message for a single field value, or undefined if it is valid.
@@ -9718,20 +9989,6 @@ declare module 'alinea/dashboard/app/AuthView' {
9718
9989
 
9719
9990
  }
9720
9991
 
9721
- declare module 'alinea/dashboard/app/BlockSettings' {
9722
-
9723
- import { Type } from 'alinea/core/Type';
9724
- import type { EditorNode } from 'alinea/dashboard/atoms/editor';
9725
- export interface BlockSettingsProps {
9726
- node: EditorNode;
9727
- type: Type;
9728
- readOnly?: boolean;
9729
- }
9730
- /** The settings fields of a block's type, for its settings sheet */
9731
- export function BlockSettings({ node, type, readOnly }: BlockSettingsProps): import("react").JSX.Element | null;
9732
-
9733
- }
9734
-
9735
9992
  declare module 'alinea/dashboard/app/BlockSheet' {
9736
9993
 
9737
9994
  import type { StyleProps } from 'alinea/components';
@@ -9798,6 +10055,23 @@ declare module 'alinea/dashboard/app/BlockSheetStoryFrame' {
9798
10055
 
9799
10056
  }
9800
10057
 
10058
+ declare module 'alinea/dashboard/app/BlockTabs' {
10059
+
10060
+ import { Type } from 'alinea/core/Type';
10061
+ import type { EditorNode } from 'alinea/dashboard/atoms/editor';
10062
+ export interface BlockTabsProps {
10063
+ node: EditorNode;
10064
+ type: Type;
10065
+ readOnly?: boolean;
10066
+ }
10067
+ /**
10068
+ * The tabs of a block's type, as sections of its settings sheet. They are
10069
+ * edited with the whole block, so their fields can track its other fields.
10070
+ */
10071
+ export function BlockTabs({ node, type, readOnly }: BlockTabsProps): import("react").JSX.Element | null;
10072
+
10073
+ }
10074
+
9801
10075
  declare module 'alinea/dashboard/app/CompactField' {
9802
10076
 
9803
10077
  import { Field } from 'alinea/core/Field';
@@ -9910,8 +10184,11 @@ declare module 'alinea/dashboard/app/editor/FileEditor' {
9910
10184
  declare module 'alinea/dashboard/app/editor/FilePreview' {
9911
10185
 
9912
10186
  import { type FocusPoint } from 'alinea/components';
10187
+ import type { FileFields } from 'alinea/core/media/MediaTypes';
9913
10188
  export type { FocusPoint };
9914
10189
  export interface FilePreviewProps {
10190
+ /** The focus point field of the file's type */
10191
+ focus: FileFields['focus'];
9915
10192
  liveUrl?: string;
9916
10193
  preview: string;
9917
10194
  /** Thumbhash data url shown behind the image */
@@ -9920,7 +10197,7 @@ declare module 'alinea/dashboard/app/editor/FilePreview' {
9920
10197
  height?: number;
9921
10198
  onHoverPointChange?: (focusPoint: FocusPoint | null) => void;
9922
10199
  }
9923
- export function FilePreview({ liveUrl, preview, placeholder, width, height, onHoverPointChange }: FilePreviewProps): import("react").JSX.Element;
10200
+ export function FilePreview({ focus, liveUrl, preview, placeholder, width, height, onHoverPointChange }: FilePreviewProps): import("react").JSX.Element;
9924
10201
 
9925
10202
  }
9926
10203
 
@@ -9991,6 +10268,17 @@ declare module 'alinea/dashboard/app/EntryFields' {
9991
10268
 
9992
10269
  }
9993
10270
 
10271
+ declare module 'alinea/dashboard/app/EntryForm' {
10272
+
10273
+ import { Type } from 'alinea/core/Type';
10274
+ /**
10275
+ * The type an entry's form renders: a type that is not a document (documents
10276
+ * add their own tabs) shows its fields in a Content tab, followed by its tabs.
10277
+ */
10278
+ export function entryForm(entryType: Type): Type;
10279
+
10280
+ }
10281
+
9994
10282
  declare module 'alinea/dashboard/app/EntryHeader' {
9995
10283
 
9996
10284
  import type { Entry } from 'alinea/core/Entry';
@@ -10246,7 +10534,6 @@ declare module 'alinea/dashboard/app/Explorer' {
10246
10534
  onBack(): void;
10247
10535
  }
10248
10536
  export interface ExplorerHeaderProps {
10249
- canBrowse?: boolean;
10250
10537
  autoFocusSearch?: boolean;
10251
10538
  /** Called when escape is pressed in the search field */
10252
10539
  onSearchEscape?: () => void;
@@ -10272,13 +10559,15 @@ declare module 'alinea/dashboard/app/Explorer' {
10272
10559
  }
10273
10560
  interface ExplorerSearchProps {
10274
10561
  autoFocus?: boolean;
10562
+ /** A search field of its own, instead of the header row of the results */
10563
+ boxed?: boolean;
10275
10564
  explorer: DashboardExplorer;
10276
10565
  onEntryAction?: (entry: DashboardEntry) => void;
10277
10566
  onEscape?: () => void;
10278
10567
  page: ExplorerReadyPage;
10279
10568
  }
10280
- export function ExplorerSearch({ autoFocus, explorer, onEntryAction, onEscape, page }: ExplorerSearchProps): import("react").JSX.Element;
10281
- export function ExplorerHeader({ canBrowse, autoFocusSearch, onSearchEscape, controls, explorer, headerEntry, navigate, page, readOnly, titleControls }: ExplorerHeaderProps): import("react").JSX.Element;
10569
+ export function ExplorerSearch({ autoFocus, boxed, explorer, onEntryAction, onEscape, page }: ExplorerSearchProps): import("react").JSX.Element;
10570
+ export function ExplorerHeader({ autoFocusSearch, onSearchEscape, controls, explorer, headerEntry, navigate, page, readOnly, titleControls }: ExplorerHeaderProps): import("react").JSX.Element;
10282
10571
  export function ExplorerBody({ compactTable, explorer, onPick, page, children }: ExplorerBodyProps): import("react").JSX.Element;
10283
10572
  export function Explorer({ controls, explorer, headerEntry, page: loadedPage, readOnly, titleControls }: ExplorerProps): import("react").JSX.Element;
10284
10573
  export {};
@@ -10309,6 +10598,24 @@ declare module 'alinea/dashboard/app/ExplorerBatchActions' {
10309
10598
 
10310
10599
  }
10311
10600
 
10601
+ declare module 'alinea/dashboard/app/ExplorerBreadcrumbs' {
10602
+
10603
+ import type { DashboardExplorer, ExplorerParent, ExplorerReadyPage } from 'alinea/dashboard/atoms/explorer';
10604
+ export interface ExplorerParentBackProps {
10605
+ explorer: DashboardExplorer;
10606
+ parent: ExplorerParent;
10607
+ }
10608
+ /** Lists the children of the parent of the listed entries, or the root */
10609
+ export function ExplorerParentBack({ explorer, parent }: ExplorerParentBackProps): import("react").JSX.Element;
10610
+ export interface ExplorerBreadcrumbsProps {
10611
+ explorer: DashboardExplorer;
10612
+ page: ExplorerReadyPage;
10613
+ }
10614
+ /** The path from the root to the listed entries, each step opens its level */
10615
+ export function ExplorerBreadcrumbs({ explorer, page }: ExplorerBreadcrumbsProps): import("react").JSX.Element | null;
10616
+
10617
+ }
10618
+
10312
10619
  declare module 'alinea/dashboard/app/ExplorerCards' {
10313
10620
 
10314
10621
  import { type DragDropProps } from 'alinea/components';
@@ -10436,6 +10743,18 @@ declare module 'alinea/dashboard/app/ExplorerPickerContent' {
10436
10743
 
10437
10744
  }
10438
10745
 
10746
+ declare module 'alinea/dashboard/app/ExplorerScope' {
10747
+
10748
+ import type { DashboardExplorer, ExplorerReadyPage } from 'alinea/dashboard/atoms/explorer';
10749
+ export interface ExplorerScopeProps {
10750
+ explorer: DashboardExplorer;
10751
+ page: ExplorerReadyPage;
10752
+ }
10753
+ /** Picks the workspace and root the explorer lists, or all of them */
10754
+ export function ExplorerScope({ explorer, page }: ExplorerScopeProps): import("react").JSX.Element | null;
10755
+
10756
+ }
10757
+
10439
10758
  declare module 'alinea/dashboard/app/ExplorerTable' {
10440
10759
 
10441
10760
  import { type DragDropProps } from 'alinea/components';
@@ -10792,6 +11111,7 @@ declare module 'alinea/dashboard/app/PendingUploadsView' {
10792
11111
  action?: PendingUploadAction;
10793
11112
  edit?: ImageEdit;
10794
11113
  compress?: boolean;
11114
+ type?: string;
10795
11115
  }
10796
11116
  export interface PendingUploadsViewProps {
10797
11117
  pending: PendingUploads;
@@ -10865,17 +11185,6 @@ declare module 'alinea/dashboard/app/SearchBar' {
10865
11185
 
10866
11186
  }
10867
11187
 
10868
- declare module 'alinea/dashboard/app/SettingsTab' {
10869
-
10870
- import { Type } from 'alinea/core/Type';
10871
- /**
10872
- * The type an entry's form renders: the settings of a type that is not a
10873
- * document (documents add their own tab) move to a Settings tab.
10874
- */
10875
- export function withSettingsTab(entryType: Type): Type;
10876
-
10877
- }
10878
-
10879
11188
  declare module 'alinea/dashboard/app/SidebarLayout' {
10880
11189
 
10881
11190
  import type { ReactNode } from 'react';
@@ -11143,7 +11452,7 @@ declare module 'alinea/dashboard/atoms/config' {
11143
11452
  export const viewAtoms: (key: string) => import("jotai").Atom<ComponentType | undefined>;
11144
11453
  export const typeAtoms: (typeName: string) => import("jotai").Atom<{
11145
11454
  fields: import("alinea/core/Type").FieldsDefinition;
11146
- settings?: import("alinea/core/Type").FieldsDefinition | undefined;
11455
+ tabs?: Record<string, import("alinea/types").Type>;
11147
11456
  contains?: Array<string | import("alinea/types").Type>;
11148
11457
  overview?: import("alinea/types").OverviewOptions;
11149
11458
  actions?: Array<import("alinea/core/View").View<import("alinea/types").EntryActionProps>>;
@@ -11555,7 +11864,7 @@ declare module 'alinea/dashboard/atoms/entry' {
11555
11864
  hasChildren: Atom<boolean>;
11556
11865
  canPublishParents: Atom<boolean>;
11557
11866
  parentUnpublished: Atom<boolean>;
11558
- mediaI18n: Atom<import("alinea/core/Root").RootI18n | undefined>;
11867
+ fieldI18n: Atom<import("alinea/core/Root").RootI18n | undefined>;
11559
11868
  preview: Atom<import("alinea/core/Preview").Preview | undefined>;
11560
11869
  translationSourceLocales: Atom<string[]>;
11561
11870
  view: import("jotai").WritableAtom<EntryDefaultView, [next: EntryDefaultView], void>;
@@ -11644,7 +11953,7 @@ declare module 'alinea/dashboard/atoms/entryTable' {
11644
11953
  declare module 'alinea/dashboard/atoms/explorer' {
11645
11954
 
11646
11955
  import type { DragTypes, DropTarget, Key } from 'alinea/components';
11647
- import type { Config } from 'alinea/core/Config';
11956
+ import { Config } from 'alinea/core/Config';
11648
11957
  import { type EntryStatus } from 'alinea/core/Entry';
11649
11958
  import type { EntryFields } from 'alinea/core/EntryFields';
11650
11959
  import { type OpenFilter } from 'alinea/core/Filter';
@@ -11655,11 +11964,13 @@ declare module 'alinea/dashboard/atoms/explorer' {
11655
11964
  import type { RootData } from 'alinea/core/Root';
11656
11965
  import { Type } from 'alinea/core/Type';
11657
11966
  import { type Atom, type Getter, type PrimitiveAtom, type WritableAtom } from 'jotai';
11658
- import type { ComponentType, SetStateAction } from 'react';
11967
+ import type { ComponentType, ReactNode, SetStateAction } from 'react';
11659
11968
  import { type OverviewFilterSelection, type OverviewFilterState, type OverviewState } from 'alinea/dashboard/atoms/overview';
11660
11969
  /** The best ranked matches a search loads into the explorer. */
11661
11970
  export const searchResultLimit = 100;
11662
11971
  export type ExplorerView = 'card' | 'row';
11972
+ /** Where results are listed from: the root, its workspace or all workspaces */
11973
+ export type ExplorerScope = 'root' | 'workspace' | 'everything';
11663
11974
  export interface ExplorerLocation {
11664
11975
  workspace: string;
11665
11976
  root?: string;
@@ -11681,7 +11992,7 @@ declare module 'alinea/dashboard/atoms/explorer' {
11681
11992
  enableNavigation?: boolean;
11682
11993
  initialView?: ExplorerView;
11683
11994
  initialResultMode?: ExplorerResultMode;
11684
- initialSearchScope?: 'workspace' | 'everything';
11995
+ initialSearchScope?: ExplorerScope;
11685
11996
  location?: ExplorerLocation;
11686
11997
  limitLocations?: Array<ExplorerLimitLocation>;
11687
11998
  /** Lists only the media roots, for pickers of files and images */
@@ -11743,6 +12054,8 @@ declare module 'alinea/dashboard/atoms/explorer' {
11743
12054
  }
11744
12055
  /** The entry whose children are listed */
11745
12056
  export interface ExplorerParent extends ExplorerPathEntry {
12057
+ /** Its type, which decides what can be uploaded into it */
12058
+ type: string;
11746
12059
  /** The ids of its parents, from the root down */
11747
12060
  parents: Array<string>;
11748
12061
  /** Its parents the editor can see, from the root down */
@@ -11755,7 +12068,7 @@ declare module 'alinea/dashboard/atoms/explorer' {
11755
12068
  /** The column the editor sorted by */
11756
12069
  requested?: OverviewSort;
11757
12070
  /** The label of the order the editor picked */
11758
- label?: string;
12071
+ label?: ReactNode;
11759
12072
  /** The column shown as sorted, also for the parent's default order */
11760
12073
  column?: OverviewSort;
11761
12074
  /** Entries are listed in their stored order and can be reordered */
@@ -11763,6 +12076,11 @@ declare module 'alinea/dashboard/atoms/explorer' {
11763
12076
  }
11764
12077
  export interface ExplorerReadyPage {
11765
12078
  canUpload: boolean;
12079
+ /**
12080
+ * The file types an upload to the location can become. Media roots take
12081
+ * uploads everywhere, see `Config.uploadCandidates`.
12082
+ */
12083
+ uploadTypes: Array<string>;
11766
12084
  /**
11767
12085
  * The condition of the selected tab and the picked filters, undefined when
11768
12086
  * none applies
@@ -11782,7 +12100,10 @@ declare module 'alinea/dashboard/atoms/explorer' {
11782
12100
  root: ExplorerRootData;
11783
12101
  resultMode: ExplorerResultMode;
11784
12102
  search: string;
11785
- searchScope: 'workspace' | 'everything';
12103
+ /** The scope the editor picked */
12104
+ searchScope: ExplorerScope;
12105
+ /** The scope the results are listed from */
12106
+ scope: ExplorerScope;
11786
12107
  searchesEverything: boolean;
11787
12108
  sort: ExplorerSortState;
11788
12109
  /** The key of the tab shown, undefined when the overview has no tabs */
@@ -11938,7 +12259,8 @@ declare module 'alinea/dashboard/atoms/explorer' {
11938
12259
  readonly showSelectionControls: boolean;
11939
12260
  readonly breadcrumbs: boolean;
11940
12261
  readonly autoSelectFirstItem: boolean;
11941
- readonly rootScope: 'current' | 'workspace';
12262
+ /** The scope results are listed from unless the editor picks a wider one */
12263
+ readonly rootScope: 'root' | 'workspace';
11942
12264
  readonly hasRowAction: boolean;
11943
12265
  readonly mode: 'browse' | 'search';
11944
12266
  readonly hasSelection: boolean;
@@ -11946,14 +12268,18 @@ declare module 'alinea/dashboard/atoms/explorer' {
11946
12268
  readonly searchDepth: "all" | "current";
11947
12269
  readonly supportsInlineExpansion: boolean;
11948
12270
  readonly pickChildren: boolean;
12271
+ /** Whether folders can be browsed, besides listing filtered matches */
12272
+ readonly canBrowse: boolean;
11949
12273
  readonly hasCondition: boolean;
11950
12274
  readonly permission: Permission;
11951
12275
  readonly canSearchEverything: Atom<boolean>;
12276
+ /** The scope the results are listed from */
12277
+ readonly scope: Atom<ExplorerScope>;
11952
12278
  readonly searchesEverything: Atom<boolean>;
11953
12279
  search: PrimitiveAtom<string> & {
11954
12280
  init: string;
11955
12281
  };
11956
- searchScope: PrimitiveAtom<'workspace' | 'everything'>;
12282
+ searchScope: PrimitiveAtom<ExplorerScope>;
11957
12283
  resultMode: WritableAtom<ExplorerResultMode, [ExplorerResultMode], void>;
11958
12284
  selection: PrimitiveAtom<'all' | Set<Key>>;
11959
12285
  expandedKeys: PrimitiveAtom<Set<Key>> & {
@@ -12309,6 +12635,7 @@ declare module 'alinea/dashboard/atoms/overview' {
12309
12635
  import { type RootData } from 'alinea/core/Root';
12310
12636
  import { Type } from 'alinea/core/Type';
12311
12637
  import type { View } from 'alinea/core/View';
12638
+ import type { ReactNode } from 'react';
12312
12639
  /** The columns every overview can show next to its configured columns */
12313
12640
  export type OverviewBuiltinColumn = 'type' | 'updated' | 'author';
12314
12641
  /** The number of `overview: true` fields shown when a parent has no columns */
@@ -12327,7 +12654,8 @@ declare module 'alinea/dashboard/atoms/overview' {
12327
12654
  /** A column of an overview, resolved against the schema */
12328
12655
  export interface OverviewColumnState {
12329
12656
  key: string;
12330
- header: string;
12657
+ header: ReactNode;
12658
+ info?: ReactNode;
12331
12659
  builtin?: OverviewBuiltinColumn;
12332
12660
  width: OverviewColumnWidth;
12333
12661
  minWidth?: number;
@@ -12347,7 +12675,7 @@ declare module 'alinea/dashboard/atoms/overview' {
12347
12675
  /** An order editors can pick, resolved against the schema */
12348
12676
  export interface OverviewSortState {
12349
12677
  key: string;
12350
- label: string;
12678
+ label: ReactNode;
12351
12679
  /** The values to order by, in order */
12352
12680
  by: Array<Expr<any>>;
12353
12681
  /** The direction the order is first picked in */
@@ -12836,6 +13164,8 @@ declare module 'alinea/dashboard/atoms/upload' {
12836
13164
  }
12837
13165
  export interface UploadItem {
12838
13166
  file: File;
13167
+ /** The file type the upload becomes, see `UploadQuery.type` */
13168
+ type?: string;
12839
13169
  edit?: ImageEdit;
12840
13170
  /** The media entry whose file this upload replaces */
12841
13171
  replaceId?: string;
@@ -12867,9 +13197,21 @@ declare module 'alinea/dashboard/atoms/upload' {
12867
13197
  * same name
12868
13198
  */
12869
13199
  export type PendingUploadAction = 'upload' | 'existing' | 'replace';
13200
+ /** A file type an upload can become */
13201
+ export interface UploadType {
13202
+ name: string;
13203
+ label: string;
13204
+ }
12870
13205
  export interface PendingUpload {
12871
13206
  id: string;
12872
13207
  file: File;
13208
+ /**
13209
+ * The file types of the location that accept the file, in order. Empty
13210
+ * when none does, the file is not uploaded then.
13211
+ */
13212
+ types: Array<UploadType>;
13213
+ /** The file type picked from `types`, the first by default */
13214
+ type?: string;
12873
13215
  /** An object url of images the browser can show */
12874
13216
  previewUrl?: string;
12875
13217
  /**
@@ -12912,7 +13254,7 @@ declare module 'alinea/dashboard/atoms/upload' {
12912
13254
  export const requestUploadsAtom: import("jotai").WritableAtom<null, [request: UploadsRequest], Promise<string[]>> & {
12913
13255
  init: null;
12914
13256
  };
12915
- export const updatePendingUploadAtom: import("jotai").WritableAtom<null, [id: string, update: Partial<Pick<PendingUpload, "action" | "compress" | "edit">>], void> & {
13257
+ export const updatePendingUploadAtom: import("jotai").WritableAtom<null, [id: string, update: Partial<Pick<PendingUpload, "action" | "compress" | "edit" | "type">>], void> & {
12916
13258
  init: null;
12917
13259
  };
12918
13260
  export const removePendingUploadAtom: import("jotai").WritableAtom<null, [id: string], void> & {
@@ -13909,6 +14251,7 @@ declare module 'alinea/dashboard/icons' {
13909
14251
  export function IcOutlineViewList(props: SVGProps<SVGSVGElement>): import("react").JSX.Element;
13910
14252
  export function IcRoundDescription(props: SVGProps<SVGSVGElement>): import("react").JSX.Element;
13911
14253
  export function IcRoundBolt(props: SVGProps<SVGSVGElement>): import("react").JSX.Element;
14254
+ export function IcOutlineInfo(props: SVGProps<SVGSVGElement>): import("react").JSX.Element;
13912
14255
  export function IcRoundInfo(props: SVGProps<SVGSVGElement>): import("react").JSX.Element;
13913
14256
  export function IcTwotoneDescription(props: SVGProps<SVGSVGElement>): import("react").JSX.Element;
13914
14257
  export function IcTwotoneFolder(props: SVGProps<SVGSVGElement>): import("react").JSX.Element;
@@ -14553,6 +14896,11 @@ declare module 'alinea/database/EntryDatabase' {
14553
14896
  * reopened and synced from it. An overlay keeps its tree in memory.
14554
14897
  */
14555
14898
  recordsTree?: boolean;
14899
+ /**
14900
+ * Whether syncs that change entries refresh the query planner statistics.
14901
+ * A database that keeps the statistics it was built with skips the cost.
14902
+ */
14903
+ analyzes?: boolean;
14556
14904
  }
14557
14905
  export interface EntryApplyOptions {
14558
14906
  source: Source;
@@ -14906,7 +15254,7 @@ declare module 'alinea/database/query/Relation' {
14906
15254
 
14907
15255
  declare module 'alinea/database/query/ResolveQuery' {
14908
15256
 
14909
- import type { Config } from 'alinea/core/Config';
15257
+ import { Config } from 'alinea/core/Config';
14910
15258
  import type { GraphQuery } from 'alinea/core/Graph';
14911
15259
  import { type Database } from 'rado';
14912
15260
  import type { SearchQuery } from 'alinea/database/query/Search';
@@ -14976,13 +15324,14 @@ declare module 'alinea/database/query/Search' {
14976
15324
  declare module 'alinea/database/sync/Derive' {
14977
15325
 
14978
15326
  import type { Config } from 'alinea/core/Config';
15327
+ import type { SyncStats } from 'alinea/core/db/LocalStore';
14979
15328
  import { type SyncChanges } from 'alinea/database/sync/Ingest';
14980
15329
  import type { SyncQueries } from 'alinea/database/sync/SyncQueries';
14981
15330
  /**
14982
15331
  * Derive parents, statuses and urls for what a merge changed, and for what
14983
15332
  * inherits from it. Resolves to the sorted ids of every entry that changed.
14984
15333
  */
14985
- export function deriveEntries(config: Config, queries: SyncQueries, changes: SyncChanges, validate: boolean): Promise<Array<string>>;
15334
+ export function deriveEntries(config: Config, queries: SyncQueries, changes: SyncChanges, validate: boolean, stats?: SyncStats): Promise<Array<string>>;
14986
15335
 
14987
15336
  }
14988
15337
 
@@ -15002,7 +15351,7 @@ declare module 'alinea/database/sync/EntryParser' {
15002
15351
  declare module 'alinea/database/sync/EntrySyncer' {
15003
15352
 
15004
15353
  import type { Config } from 'alinea/core/Config';
15005
- import type { SyncProgress } from 'alinea/core/db/LocalStore';
15354
+ import type { SyncProgress, SyncStats } from 'alinea/core/db/LocalStore';
15006
15355
  import type { RemoteSource } from 'alinea/core/source/Source';
15007
15356
  import { ReadonlyTree } from 'alinea/core/source/Tree';
15008
15357
  import type { Database } from 'rado';
@@ -15017,6 +15366,7 @@ declare module 'alinea/database/sync/EntrySyncer' {
15017
15366
  */
15018
15367
  recordsTree?: boolean;
15019
15368
  onProgress?(progress: SyncProgress): void;
15369
+ stats?: SyncStats;
15020
15370
  }
15021
15371
  /** Prepared, serialized source synchronization for one database connection. */
15022
15372
  export class EntrySyncer {
@@ -15034,7 +15384,7 @@ declare module 'alinea/database/sync/EntrySyncer' {
15034
15384
  declare module 'alinea/database/sync/Ingest' {
15035
15385
 
15036
15386
  import type { Config } from 'alinea/core/Config';
15037
- import type { SyncProgress } from 'alinea/core/db/LocalStore';
15387
+ import type { SyncOptions } from 'alinea/core/db/LocalStore';
15038
15388
  import type { RemoteSource } from 'alinea/core/source/Source';
15039
15389
  import { ReadonlyTree } from 'alinea/core/source/Tree';
15040
15390
  import { type SyncQueries } from 'alinea/database/sync/SyncQueries';
@@ -15054,7 +15404,7 @@ declare module 'alinea/database/sync/Ingest' {
15054
15404
  /** Whether a directory hash stands for a directory with files. */
15055
15405
  export function hasChildren(childrenSha: string | null): boolean;
15056
15406
  /** Write the files that differ between two source trees to the entry table. */
15057
- export function mergeTrees(config: Config, source: RemoteSource, previousTree: ReadonlyTree, tree: ReadonlyTree, queries: SyncQueries, onProgress?: (progress: SyncProgress) => void): Promise<SyncChanges>;
15407
+ export function mergeTrees(config: Config, source: RemoteSource, previousTree: ReadonlyTree, tree: ReadonlyTree, queries: SyncQueries, { onProgress, stats }?: SyncOptions): Promise<SyncChanges>;
15058
15408
 
15059
15409
  }
15060
15410
 
@@ -15262,7 +15612,7 @@ declare module 'alinea/field' {
15262
15612
  export { code } from 'alinea/field/code';
15263
15613
  export { date } from 'alinea/field/date';
15264
15614
  export { json } from 'alinea/field/json';
15265
- export { localiser } from 'alinea/field/localiser';
15615
+ export { localised, localiser } from 'alinea/field/localiser';
15266
15616
  export { entry } from 'alinea/field/link/EntryLink';
15267
15617
  export { file } from 'alinea/field/link/FileLink';
15268
15618
  export { image } from 'alinea/field/link/ImageLink';
@@ -15619,8 +15969,8 @@ declare module 'alinea/field/link/FileLink' {
15619
15969
  const title: import("alinea/core/Expr").Expr<string>;
15620
15970
  const url: import("alinea/core/Expr").Expr<string>;
15621
15971
  const href: import("alinea/core/Expr").Expr<string>;
15622
- const extension: import("alinea/field/hidden").HiddenField<string>;
15623
- const size: import("alinea/field/hidden").HiddenField<number>;
15972
+ const extension: import("alinea/core/Expr").Expr<string>;
15973
+ const size: import("alinea/core/Expr").Expr<number>;
15624
15974
  }
15625
15975
  export function filePicker<Fields>(multiple: boolean, options: Omit<EntryPickerOptions<Fields>, 'selection'>): import("alinea/core/Picker").Picker<EntryReference, EntryPickerOptions<Fields>>;
15626
15976
  export interface FileOptions<Fields> extends LinkFieldOptions<EntryReference & InferStoredValue<Fields>>, Omit<EntryPickerOptions<Fields>, 'label' | 'selection'> {
@@ -15664,16 +16014,16 @@ declare module 'alinea/field/link/ImageLink' {
15664
16014
  }
15665
16015
  export namespace ImageLink {
15666
16016
  const title: import("alinea/core/Expr").Expr<string>;
15667
- const alt: import("alinea/core/media/MediaAltField").MediaAltField;
16017
+ const alt: import("alinea/core/Expr").Expr<import("alinea/core/media/MediaAltField").MediaAltValue>;
15668
16018
  const src: import("alinea/core/Expr").Expr<string>;
15669
- const extension: import("alinea/field/hidden").HiddenField<string>;
15670
- const size: import("alinea/field/hidden").HiddenField<number>;
15671
- const hash: import("alinea/field/hidden").HiddenField<string>;
15672
- const width: import("alinea/field/hidden").HiddenField<number>;
15673
- const height: import("alinea/field/hidden").HiddenField<number>;
15674
- const averageColor: import("alinea/field/hidden").HiddenField<string>;
15675
- const thumbHash: import("alinea/field/hidden").HiddenField<string>;
15676
- const focus: import("alinea/field/hidden").HiddenField<{
16019
+ const extension: import("alinea/core/Expr").Expr<string>;
16020
+ const size: import("alinea/core/Expr").Expr<number>;
16021
+ const hash: import("alinea/core/Expr").Expr<string>;
16022
+ const width: import("alinea/core/Expr").Expr<number>;
16023
+ const height: import("alinea/core/Expr").Expr<number>;
16024
+ const averageColor: import("alinea/core/Expr").Expr<string>;
16025
+ const thumbHash: import("alinea/core/Expr").Expr<string>;
16026
+ const focus: import("alinea/core/Expr").Expr<{
15677
16027
  x: number;
15678
16028
  y: number;
15679
16029
  }>;
@@ -15873,9 +16223,10 @@ declare module 'alinea/field/list/ListField' {
15873
16223
  width?: number;
15874
16224
  /** Add instructional text to a field */
15875
16225
  help?: ReactNode;
15876
- /** Display a minimal version */
16226
+ /** Display a minimal version, without label and fold */
15877
16227
  inline?: boolean;
15878
- /** Show the rows folded when the entry opens, added rows start open */
16228
+ /** Show the rows folded when the entry opens, added rows start open.
16229
+ * Ignored for inline lists, which can not be folded */
15879
16230
  collapsed?: boolean;
15880
16231
  /** Hide this list field */
15881
16232
  hidden?: boolean;
@@ -15978,7 +16329,11 @@ declare module 'alinea/field/localiser/Localiser' {
15978
16329
  import { Field } from 'alinea/core/Field';
15979
16330
  export type LocalisedValue<Locale extends string, Value> = Record<Locale, Value>;
15980
16331
  export interface Localisation<Locale extends string = string, Value = unknown> {
15981
- locales: ReadonlyArray<Locale>;
16332
+ /**
16333
+ * The locales of the value, undefined for a field that uses the locales of
16334
+ * the root of its entry
16335
+ */
16336
+ locales?: ReadonlyArray<Locale>;
15982
16337
  fallback?: (requested: Locale) => ReadonlyArray<Locale>;
15983
16338
  inner: Field<Value, unknown, unknown, FieldOptions<Value>>;
15984
16339
  }
@@ -15997,8 +16352,20 @@ declare module 'alinea/field/localiser/Localiser' {
15997
16352
  fallback?: (requested: Locale) => ReadonlyArray<Locale>;
15998
16353
  defaultValue?: Value;
15999
16354
  }
16355
+ /** @deprecated Use `Field.localised(field, {locales})` */
16000
16356
  export function localiser<const Locale extends string>({ locales, fallback }: LocaliserOptions<Locale>): <StoredValue, QueryValue, Mutator, Options>(field: Field<StoredValue, QueryValue, Mutator, Options>) => LocalisedField<Locale, StoredValue, QueryValue, Options>;
16001
16357
  export function selectLocalisedValue<Locale extends string, Value>({ value, locale, locales, fallback, defaultValue }: SelectLocalisedValueOptions<Locale, Value>): Value;
16358
+ /**
16359
+ * Holds a value of `field` per locale. With `locales` the value always has
16360
+ * those locales. Without, it uses the locales of the root of its entry: in a
16361
+ * root that translates fields (`i18n: {translate: 'fields'}`) it holds a
16362
+ * value per locale, in a root without `i18n` the plain value. Roots that
16363
+ * translate entries throw, their entries are a translation already.
16364
+ */
16365
+ export function localised<StoredValue, QueryValue, Mutator, Options>(field: Field<StoredValue, QueryValue, Mutator, Options>): LocalisedField<string, StoredValue, QueryValue, Options>;
16366
+ export function localised<const Locale extends string, StoredValue, QueryValue, Mutator, Options>(field: Field<StoredValue, QueryValue, Mutator, Options>, options: LocaliserOptions<Locale>): LocalisedField<Locale, StoredValue, QueryValue, Options>;
16367
+ /** Whether a field takes its locales from the root of its entry */
16368
+ export function inheritsLocales(field: Field): boolean;
16002
16369
 
16003
16370
  }
16004
16371
 
@@ -16250,8 +16617,10 @@ declare module 'alinea/field/object/ObjectField' {
16250
16617
  width?: number;
16251
16618
  /** Add instructional text to a field */
16252
16619
  help?: ReactNode;
16253
- /** Display a minimal version */
16620
+ /** Display a minimal version, without label and fold */
16254
16621
  inline?: boolean;
16622
+ /** Show the fields folded when the entry opens, ignored for inline objects */
16623
+ collapsed?: boolean;
16255
16624
  }
16256
16625
  export class ObjectField<Definition> extends RecordField<Type.Infer<Definition>, ObjectOptions<Definition> & {
16257
16626
  fields: Type<Definition>;
@@ -16717,6 +17086,7 @@ declare module 'alinea/field/richtext/RichTextField.story' {
16717
17086
  export function RichTextLegacyEmptyStory(): import("react").JSX.Element;
16718
17087
  export function RichTextReadOnlyStory(): import("react").JSX.Element;
16719
17088
  export function RichTextInlineStory(): import("react").JSX.Element;
17089
+ export function RichTextInlineBlocksStory(): import("react").JSX.Element;
16720
17090
 
16721
17091
  }
16722
17092
 
@@ -17095,7 +17465,8 @@ declare module 'alinea/field/tabs/Tabs' {
17095
17465
 
17096
17466
  import { Field } from 'alinea/core/Field';
17097
17467
  import { type Section, type SectionData, type SectionDefinition } from 'alinea/core/Section';
17098
- import { Type, type } from 'alinea/core/Type';
17468
+ import { type FieldsDefinition, Type, type TypeConfig } from 'alinea/core/Type';
17469
+ import type { ReactNode } from 'react';
17099
17470
  export class TabsSection implements SectionData {
17100
17471
  types: Array<Type>;
17101
17472
  view: string;
@@ -17108,8 +17479,16 @@ declare module 'alinea/field/tabs/Tabs' {
17108
17479
  type FoldIntoIntersection<T extends readonly {}[], Acc extends {} = {}> = T extends readonly [infer H, ...infer HS] ? FoldIntoIntersection<Cast<HS, readonly {}[]>, Acc & H> : Acc;
17109
17480
  /** Create tabs */
17110
17481
  export function tabs<const Types extends Array<Type>>(...types: Types): FoldIntoIntersection<Types>;
17111
- /** Create a tab */
17112
- export const tab: typeof type;
17482
+ export interface TabOptions<Fields> extends Omit<TypeConfig<Fields>, 'fields' | 'contains' | 'settings' | 'tabs' | 'view'> {
17483
+ fields?: Fields;
17484
+ /**
17485
+ * A view shown in the tab, after its fields: the path of a component, as
17486
+ * with `Field.view`, or an element
17487
+ */
17488
+ view?: string | ReactNode;
17489
+ }
17490
+ /** Create a tab, with fields or a view or both */
17491
+ export function tab<Fields extends FieldsDefinition = {}>(label: string, { fields, view: tabView, ...config }: TabOptions<Fields>): Type<Fields>;
17113
17492
  export {};
17114
17493
 
17115
17494
  }
@@ -17342,7 +17721,8 @@ declare module 'alinea/picker/entry/EntryPicker' {
17342
17721
  export interface EntryPickerOptions<Definition = {}> extends EntryPickerConditions {
17343
17722
  selection: Projection;
17344
17723
  defaultView?: 'row' | 'thumb';
17345
- showMedia?: boolean;
17724
+ /** @internal Picks uploaded files: any of them, or images */
17725
+ files?: 'file' | 'image';
17346
17726
  max?: number;
17347
17727
  label?: string;
17348
17728
  title?: Label;
@@ -17499,6 +17879,7 @@ declare module 'alinea/preview/RegisterPreview' {
17499
17879
 
17500
17880
  declare module 'alinea/preview/widget' {
17501
17881
 
17882
+ import type { SyncStats } from 'alinea/core/db/LocalStore';
17502
17883
  import type { DOMAttributes } from 'react';
17503
17884
  export interface PreviewStat {
17504
17885
  kind: 'query' | 'sync';
@@ -17514,6 +17895,8 @@ declare module 'alinea/preview/widget' {
17514
17895
  /** SQL statements this row's work ran, such as a preview's sync. */
17515
17896
  statements?: number;
17516
17897
  sqlMs?: number;
17898
+ /** Where a sync spent its time */
17899
+ sync?: SyncStats;
17517
17900
  }
17518
17901
  /** One of the slowest SQL statements of a render. */
17519
17902
  export interface PreviewStatement {