alinea 2.0.0-preview.12 → 2.0.0-preview.13

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 (264) 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 +16 -8
  5. package/dist/adapter/next/dashboardUrl.d.ts +6 -0
  6. package/dist/adapter/next/dashboardUrl.js +13 -0
  7. package/dist/adapter/next/syncCheck.d.ts +15 -2
  8. package/dist/adapter/next/syncCheck.js +26 -9
  9. package/dist/backend/Handler.js +5 -1
  10. package/dist/backend/api/BlobStore.d.ts +21 -0
  11. package/dist/backend/api/BlobStore.js +63 -0
  12. package/dist/backend/api/CreateBackend.js +10 -8
  13. package/dist/backend/api/DatabaseApi.d.ts +4 -1
  14. package/dist/backend/api/DatabaseApi.js +88 -4
  15. package/dist/backend/api/GithubApi.js +47 -24
  16. package/dist/backend/api/database.js +6 -6
  17. package/dist/bundled.d.ts +676 -280
  18. package/dist/chunks/{bun-sqlite-5SHXN3AT.js → bun-sqlite-RI6BYU5S.js} +3 -3
  19. package/dist/chunks/{chunk-OHGAVV4G.js → chunk-3QFSGTGF.js} +2 -3
  20. package/dist/chunks/{chunk-QJGGYF6E.js → chunk-4ZA6KZHS.js} +5 -5
  21. package/dist/chunks/{chunk-ASYKC6IE.js → chunk-5H4D5JQL.js} +1 -1
  22. package/dist/chunks/{chunk-ETWOY4AL.js → chunk-A2I6MCCS.js} +1 -1
  23. package/dist/chunks/{chunk-W5AXN7GH.js → chunk-CYVOGRSD.js} +1 -2
  24. package/dist/chunks/{chunk-TIJTT5ZI.js → chunk-G43W7AME.js} +1 -0
  25. package/dist/chunks/{chunk-RE523BQ7.js → chunk-HOETF6HN.js} +5829 -5830
  26. package/dist/chunks/{chunk-AIU6CMVT.js → chunk-PTYZMV5G.js} +1 -1
  27. package/dist/chunks/{chunk-JOF663EG.js → chunk-QHHMKJUO.js} +1 -1
  28. package/dist/chunks/{chunk-66YZ47TY.js → chunk-RAR44T5O.js} +1 -1
  29. package/dist/chunks/{chunk-QSN6RH6X.js → chunk-VA6NC3MI.js} +1 -1
  30. package/dist/chunks/{node-sqlite-XVNTNMCY.js → node-sqlite-C7VJ2NSN.js} +3 -3
  31. package/dist/cli/Mcp.js +1 -1
  32. package/dist/cli/Serve.js +1 -1
  33. package/dist/cli/bin.js +2 -3
  34. package/dist/cli/serve/mcp/DevMcp.js +1 -1
  35. package/dist/cli/serve/mcp/McpTools.js +29 -1
  36. package/dist/cloud/CloudRemote.js +1 -1
  37. package/dist/components/Alert.js +2 -2
  38. package/dist/components/AppShell.js +2 -2
  39. package/dist/components/Badge.d.ts +3 -1
  40. package/dist/components/Badge.js +5 -3
  41. package/dist/components/Breadcrumbs.js +7 -7
  42. package/dist/components/Button.d.ts +6 -1
  43. package/dist/components/Button.js +16 -7
  44. package/dist/components/Calendar.js +20 -20
  45. package/dist/components/Checkbox.js +7 -7
  46. package/dist/components/CheckboxGroup.js +4 -4
  47. package/dist/components/Code.js +2 -2
  48. package/dist/components/Collapsible.js +3 -3
  49. package/dist/components/ColorSwatch.js +2 -2
  50. package/dist/components/ColorSwatchPicker.js +2 -2
  51. package/dist/components/ComboBox.js +7 -7
  52. package/dist/components/Command.js +14 -13
  53. package/dist/components/ContentCard.d.ts +3 -1
  54. package/dist/components/ContentCard.js +46 -24
  55. package/dist/components/ContentGrid.js +17 -17
  56. package/dist/components/DataList.js +2 -2
  57. package/dist/components/DateField.js +2 -2
  58. package/dist/components/DatePicker.js +2 -2
  59. package/dist/components/DateRangePicker.js +2 -2
  60. package/dist/components/Dialog.js +7 -7
  61. package/dist/components/DropZone.js +6 -6
  62. package/dist/components/DropdownMenu.js +9 -9
  63. package/dist/components/Empty.js +5 -5
  64. package/dist/components/Field.js +8 -8
  65. package/dist/components/List.js +27 -27
  66. package/dist/components/MediaPreview.js +5 -5
  67. package/dist/components/MultipleSelect.js +22 -22
  68. package/dist/components/NavRail.js +4 -4
  69. package/dist/components/NumberField.js +4 -4
  70. package/dist/components/Page.js +3 -3
  71. package/dist/components/Popover.js +2 -2
  72. package/dist/components/PreviewFrame.js +9 -9
  73. package/dist/components/RadioGroup.js +9 -9
  74. package/dist/components/Resizable.js +4 -4
  75. package/dist/components/SearchField.d.ts +6 -1
  76. package/dist/components/SearchField.js +5 -3
  77. package/dist/components/Select.js +13 -13
  78. package/dist/components/Sheet.d.ts +50 -0
  79. package/dist/components/Sheet.js +202 -0
  80. package/dist/components/Sidebar.js +4 -4
  81. package/dist/components/SortableList.d.ts +34 -30
  82. package/dist/components/SortableList.js +161 -264
  83. package/dist/components/Spinner.js +2 -2
  84. package/dist/components/Surface.js +2 -2
  85. package/dist/components/Switch.js +8 -8
  86. package/dist/components/Table.d.ts +3 -1
  87. package/dist/components/Table.js +57 -46
  88. package/dist/components/Tabs.js +5 -5
  89. package/dist/components/TagGroup.js +8 -8
  90. package/dist/components/TextField.js +10 -10
  91. package/dist/components/TimeField.js +6 -6
  92. package/dist/components/Timestamp.js +1 -1
  93. package/dist/components/ToggleGroup.js +2 -2
  94. package/dist/components/Toolbar.js +2 -2
  95. package/dist/components/Tooltip.js +5 -5
  96. package/dist/components/Tree.js +24 -24
  97. package/dist/components/internal/DateControl.js +12 -12
  98. package/dist/components/internal/ListBoxOption.js +6 -6
  99. package/dist/components/internal/Locale.js +2 -2
  100. package/dist/components/internal/PopoverSurface.js +4 -4
  101. package/dist/components/internal/SelectionCheckbox.js +5 -5
  102. package/dist/components/internal/Slot.js +1 -1
  103. package/dist/components/internal/ToggleButton.js +3 -3
  104. package/dist/components/internal/Trigger.js +2 -2
  105. package/dist/components/internal/sortableDrag.d.ts +19 -0
  106. package/dist/components/internal/sortableDrag.js +175 -0
  107. package/dist/components/internal/useDragDrop.js +2 -2
  108. package/dist/components.d.ts +1 -0
  109. package/dist/components.js +1 -0
  110. package/dist/core/Config.d.ts +6 -1
  111. package/dist/core/Document.d.ts +9 -1
  112. package/dist/core/Document.js +31 -6
  113. package/dist/core/Overview.d.ts +2 -4
  114. package/dist/core/TextDoc.d.ts +4 -0
  115. package/dist/core/Validation.d.ts +0 -1
  116. package/dist/core/Validation.js +0 -6
  117. package/dist/core/field/RichTextField.js +23 -4
  118. package/dist/core/media/MediaTypes.js +1 -1
  119. package/dist/core/source/GithubSource.d.ts +4 -0
  120. package/dist/core/source/GithubSource.js +127 -25
  121. package/dist/core/source/GithubUsage.d.ts +21 -0
  122. package/dist/core/source/GithubUsage.js +47 -0
  123. package/dist/dashboard/App.d.ts +2 -2
  124. package/dist/dashboard/App.js +5 -3
  125. package/dist/dashboard/ViewKeys.d.ts +1 -0
  126. package/dist/dashboard/ViewKeys.js +1 -0
  127. package/dist/dashboard/app/ActivityStatus.js +7 -7
  128. package/dist/dashboard/app/AuthView.js +5 -5
  129. package/dist/dashboard/app/BlockSheet.d.ts +50 -0
  130. package/dist/dashboard/app/BlockSheet.js +207 -0
  131. package/dist/dashboard/app/BlockSheetStoryFrame.d.ts +6 -0
  132. package/dist/dashboard/app/BlockSheetStoryFrame.js +29 -0
  133. package/dist/dashboard/app/CompactField.js +16 -16
  134. package/dist/dashboard/app/DashboardLayout.js +3 -1
  135. package/dist/dashboard/app/EntryFields.js +2 -2
  136. package/dist/dashboard/app/EntryHeader.js +33 -34
  137. package/dist/dashboard/app/EntryReferences.js +7 -7
  138. package/dist/dashboard/app/EntrySidebar.js +15 -15
  139. package/dist/dashboard/app/EntrySidebarPreview.js +3 -3
  140. package/dist/dashboard/app/EntryStatusIcon.d.ts +23 -0
  141. package/dist/dashboard/app/EntryStatusIcon.js +58 -0
  142. package/dist/dashboard/app/EntryValidationModal.d.ts +6 -5
  143. package/dist/dashboard/app/EntryValidationModal.js +20 -20
  144. package/dist/dashboard/app/Explorer.d.ts +3 -1
  145. package/dist/dashboard/app/Explorer.js +48 -44
  146. package/dist/dashboard/app/ExplorerBatchActions.d.ts +3 -1
  147. package/dist/dashboard/app/ExplorerBatchActions.js +68 -43
  148. package/dist/dashboard/app/ExplorerCards.js +7 -1
  149. package/dist/dashboard/app/ExplorerControls.js +6 -6
  150. package/dist/dashboard/app/ExplorerList.js +5 -5
  151. package/dist/dashboard/app/ExplorerModal.js +2 -2
  152. package/dist/dashboard/app/ExplorerTable.js +11 -8
  153. package/dist/dashboard/app/ImageEditor.js +28 -28
  154. package/dist/dashboard/app/ImagePicker.js +3 -13
  155. package/dist/dashboard/app/LinkPicker.js +28 -26
  156. package/dist/dashboard/app/LocaleMenu.js +4 -4
  157. package/dist/dashboard/app/MediaPreviewCell.js +1 -1
  158. package/dist/dashboard/app/MoveConfirmDialog.d.ts +5 -0
  159. package/dist/dashboard/app/MoveConfirmDialog.js +79 -0
  160. package/dist/dashboard/app/OverviewCell.js +8 -13
  161. package/dist/dashboard/app/PendingUploadsView.js +3 -3
  162. package/dist/dashboard/app/ReadOnlyBadge.d.ts +1 -1
  163. package/dist/dashboard/app/RemoveDialog.d.ts +17 -0
  164. package/dist/dashboard/app/{DeleteDialog.js → RemoveDialog.js} +67 -27
  165. package/dist/dashboard/app/RemoveRedirect.d.ts +7 -0
  166. package/dist/dashboard/app/RemoveRedirect.js +123 -0
  167. package/dist/dashboard/app/SearchBar.d.ts +9 -0
  168. package/dist/dashboard/app/SearchBar.js +31 -0
  169. package/dist/dashboard/app/SidebarTree.js +27 -72
  170. package/dist/dashboard/app/WorkspaceMenu.js +7 -7
  171. package/dist/dashboard/app/WorkspaceRoots.js +12 -12
  172. package/dist/dashboard/app/editor/FileEditor.js +14 -14
  173. package/dist/dashboard/app/modals/CreateEntry.js +3 -3
  174. package/dist/dashboard/app/pages/EntryPage.d.ts +2 -1
  175. package/dist/dashboard/app/pages/EntryPage.js +34 -15
  176. package/dist/dashboard/app/pages/SplashPage.js +37 -37
  177. package/dist/dashboard/app/pages/UsersPage.js +12 -12
  178. package/dist/dashboard/app/ui/DashboardModal.js +15 -14
  179. package/dist/dashboard/atoms/dashboard.js +1 -1
  180. package/dist/dashboard/atoms/entry.js +1 -14
  181. package/dist/dashboard/atoms/entryTable.js +1 -0
  182. package/dist/dashboard/atoms/explorer.d.ts +4 -0
  183. package/dist/dashboard/atoms/explorer.js +19 -7
  184. package/dist/dashboard/atoms/graph.js +1 -1
  185. package/dist/dashboard/atoms/link.js +5 -2
  186. package/dist/dashboard/atoms/move.d.ts +5 -0
  187. package/dist/dashboard/atoms/move.js +29 -3
  188. package/dist/dashboard/atoms/moveConfirmation.d.ts +34 -0
  189. package/dist/dashboard/atoms/moveConfirmation.js +95 -0
  190. package/dist/dashboard/atoms/nav.d.ts +9 -5
  191. package/dist/dashboard/atoms/nav.js +120 -45
  192. package/dist/dashboard/atoms/overview.d.ts +6 -5
  193. package/dist/dashboard/atoms/overview.js +2 -16
  194. package/dist/dashboard/atoms/remove.d.ts +112 -0
  195. package/dist/dashboard/atoms/remove.js +268 -0
  196. package/dist/dashboard/atoms/root.d.ts +2 -2
  197. package/dist/dashboard/atoms/root.js +41 -26
  198. package/dist/dashboard/atoms/user.js +1 -1
  199. package/dist/dashboard/atoms/utils.js +1 -1
  200. package/dist/dashboard/boot/Boot.js +25 -17
  201. package/dist/dashboard/boot/DashboardWorker.d.ts +1 -0
  202. package/dist/dashboard/boot/DashboardWorker.js +10 -46
  203. package/dist/dashboard/boot/LoadWorker.js +17 -10
  204. package/dist/dashboard/cms/EntryTable.js +8 -5
  205. package/dist/database/BrowserEntryStore.d.ts +12 -62
  206. package/dist/database/BrowserEntryStore.js +97 -196
  207. package/dist/database/DatabaseTables.js +2 -2
  208. package/dist/database/EntryDatabase.js +21 -1
  209. package/dist/database/EntryTransaction.js +0 -35
  210. package/dist/database/EntryUrlAliases.d.ts +4 -0
  211. package/dist/database/EntryUrlAliases.js +16 -10
  212. package/dist/database/driver/RuntimeDatabase.js +3 -3
  213. package/dist/database/driver/WasmDatabase.d.ts +5 -18
  214. package/dist/database/driver/WasmDatabase.js +15 -16
  215. package/dist/database/entry/EntryTable.js +2 -2
  216. package/dist/database/query/EntryQuery.js +1 -1
  217. package/dist/database/query/Relation.js +1 -1
  218. package/dist/database/query/Search.js +2 -2
  219. package/dist/field/code/CodeField.view.js +16 -16
  220. package/dist/field/link/EntryLink.d.ts +4 -4
  221. package/dist/field/link/FileLink.d.ts +4 -4
  222. package/dist/field/link/ImageLink.d.ts +4 -4
  223. package/dist/field/link/Link.d.ts +1 -1
  224. package/dist/field/link/LinkField.d.ts +5 -0
  225. package/dist/field/link/LinkField.view.js +244 -370
  226. package/dist/field/link/UrlLink.d.ts +4 -4
  227. package/dist/field/list/ListField.d.ts +2 -0
  228. package/dist/field/list/ListField.view.d.ts +15 -0
  229. package/dist/field/list/ListField.view.js +343 -301
  230. package/dist/field/metadata/MetadataField.d.ts +17 -7
  231. package/dist/field/metadata/MetadataField.js +14 -3
  232. package/dist/field/metadata/MetadataField.view.d.ts +1 -0
  233. package/dist/field/metadata/MetadataField.view.js +25 -21
  234. package/dist/field/richtext/RichTextBlock.d.ts +3 -1
  235. package/dist/field/richtext/RichTextBlock.js +177 -74
  236. package/dist/field/richtext/RichTextBlockHost.js +1 -1
  237. package/dist/field/richtext/RichTextExtensions.js +31 -31
  238. package/dist/field/richtext/RichTextField.view.js +14 -8
  239. package/dist/field/richtext/RichTextInsertMenu.js +43 -27
  240. package/dist/field/views.js +2 -0
  241. package/dist/index.css +490 -309
  242. package/dist/picker/url/UrlPicker.js +1 -0
  243. package/docs/components/badge.md +1 -0
  244. package/docs/components/button.md +1 -0
  245. package/docs/components/content-card.md +1 -0
  246. package/docs/components/search-field.md +1 -0
  247. package/docs/components/sortable-list.md +5 -20
  248. package/docs/components/table.md +1 -0
  249. package/docs/configuration.md +1 -1
  250. package/docs/deploy/self-host.md +1 -1
  251. package/docs/deploy.md +5 -4
  252. package/docs/fields.md +1 -1
  253. package/docs/index.md +1 -1
  254. package/docs/instant-publishing.md +7 -22
  255. package/docs/overviews.md +3 -4
  256. package/docs/upgrading.md +3 -2
  257. package/llms-full.txt +31 -55
  258. package/package.json +2 -3
  259. package/dist/core/db/EntryValidationError.d.ts +0 -13
  260. package/dist/core/db/EntryValidationError.js +0 -23
  261. package/dist/dashboard/app/DeleteDialog.d.ts +0 -11
  262. package/dist/dashboard/atoms/delete.d.ts +0 -68
  263. package/dist/dashboard/atoms/delete.js +0 -143
  264. package/dist/chunks/{chunk-MOWR65LM.js → chunk-PYDOMKJZ.js} +71 -71
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  atomWithStorage
3
- } from "../../chunks/chunk-TIJTT5ZI.js";
3
+ } from "../../chunks/chunk-G43W7AME.js";
4
4
  import {
5
5
  useAtomValueRaw,
6
6
  useSetAtom
@@ -25,28 +25,43 @@ import {
25
25
  SortableList,
26
26
  SortableListItemTitle,
27
27
  SortableListAdd,
28
- SortableListDragPreview,
29
28
  ListError,
30
29
  ListLabel,
31
30
  SortableListItemActions,
32
31
  SortableListItemContent,
33
- SortableListHandle,
34
32
  SortableListItemToggle,
35
33
  SortableListItemHeader,
36
34
  SortableListItemDescription,
37
- SortableListItemSettings,
35
+ SortableListItemInsert,
36
+ SortableListItemTrigger,
38
37
  Popover,
38
+ PopoverAnchor,
39
39
  PopoverContent,
40
40
  PopoverTrigger,
41
- TextField
41
+ SheetBody,
42
+ SheetClose,
43
+ SheetContent,
44
+ SheetFooter,
45
+ SheetHeader,
46
+ SheetSection,
47
+ SheetTitle,
48
+ TextField,
49
+ Tooltip,
50
+ TooltipContent,
51
+ TooltipTrigger
42
52
  } from "alinea/components";
43
53
  import { createId } from "alinea/core/Id";
44
54
  import { getType } from "alinea/core/Internal";
45
55
  import { Type } from "alinea/core/Type";
46
56
  import { slugify } from "alinea/core/util/Slugs";
47
57
  import { Badge } from "alinea/components";
58
+ import {
59
+ BlockSheet,
60
+ useBlockSheet
61
+ } from "alinea/dashboard/app/BlockSheet";
48
62
  import { NodeEditor } from "alinea/dashboard/app/NodeEditor";
49
63
  import {
64
+ useEntry,
50
65
  useFieldError,
51
66
  useFieldNode,
52
67
  useFieldOptions,
@@ -59,46 +74,38 @@ import {
59
74
  IcRoundArrowDownward,
60
75
  IcRoundArrowUpward,
61
76
  IcRoundClose,
77
+ IcRoundDelete,
62
78
  IcRoundFirstPage,
63
79
  IcRoundLastPage,
80
+ IcRoundLink,
64
81
  IcRoundMoreHoriz
65
82
  } from "alinea/dashboard/icons";
66
83
  import { SlugField } from "alinea/field/path/SlugField";
67
- import {
68
- createContext,
69
- memo,
70
- useCallback,
71
- useContext,
72
- useMemo,
73
- useState
74
- } from "react";
84
+ import { memo, useCallback, useMemo, useRef, useState } from "react";
75
85
 
76
86
  // src/field/list/ListField.module.css
77
87
  var ListField_default = {
78
- "ListFieldTypePicker-popover": "alinea-ListFieldTypePicker-popover",
79
- "ListFieldTypePickerPopover": "alinea-ListFieldTypePicker-popover",
88
+ "ListFieldRowSheet-anchor-field": "alinea-ListFieldRowSheet-anchor-field",
89
+ "ListFieldRowSheetAnchorField": "alinea-ListFieldRowSheet-anchor-field",
90
+ "ListFieldRowSheet-anchor": "alinea-ListFieldRowSheet-anchor",
91
+ "ListFieldRowSheetAnchor": "alinea-ListFieldRowSheet-anchor",
80
92
  "ListFieldTypePicker-trigger": "alinea-ListFieldTypePicker-trigger",
81
93
  "ListFieldTypePickerTrigger": "alinea-ListFieldTypePicker-trigger",
82
- "ListFieldRowHeader-separator": "alinea-ListFieldRowHeader-separator",
83
- "ListFieldRowHeaderSeparator": "alinea-ListFieldRowHeader-separator",
84
94
  "ListFieldCreateActions": "alinea-ListFieldCreateActions",
85
- "ListFieldView-insertAction": "alinea-ListFieldView-insertAction",
86
- "ListFieldViewInsertAction": "alinea-ListFieldView-insertAction",
87
95
  "ListFieldCreateActions-button": "alinea-ListFieldCreateActions-button",
88
- "ListFieldCreateActionsButton": "alinea-ListFieldCreateActions-button"
96
+ "ListFieldCreateActionsButton": "alinea-ListFieldCreateActions-button",
97
+ "ListFieldTypePicker-popover": "alinea-ListFieldTypePicker-popover",
98
+ "ListFieldTypePickerPopover": "alinea-ListFieldTypePicker-popover"
89
99
  };
90
100
 
91
101
  // src/field/list/ListField.view.tsx
92
102
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
93
103
  var styles = dist_default(ListField_default);
94
- var ListFieldDepthContext = createContext(0);
95
104
  var copyAtom = atomWithStorage(
96
105
  "@alinea/copypaste",
97
106
  void 0
98
107
  );
99
- var LIST_FIELD_ROW_DRAG_TYPE = "application/x-alinea-list-field-row";
100
108
  function ListFieldView({ field }) {
101
- const depth = useContext(ListFieldDepthContext);
102
109
  const options = useFieldOptions(field);
103
110
  const error = useFieldError(field);
104
111
  const list = useFieldNode(field);
@@ -121,7 +128,6 @@ function ListFieldView({ field }) {
121
128
  const readOnly = Boolean(options.readOnly);
122
129
  const hasRows = nodes.length > 0;
123
130
  const canCreate = options.max === void 0 || nodes.length < options.max;
124
- const [foldedIds, setFoldedIds] = useState(/* @__PURE__ */ new Set());
125
131
  const rowIdsAtom = useMemo(
126
132
  () => atom((get) => {
127
133
  const nodes2 = get(list.nodes);
@@ -130,6 +136,9 @@ function ListFieldView({ field }) {
130
136
  [list]
131
137
  );
132
138
  const rowIds = useAtomValueRaw(rowIdsAtom);
139
+ const [foldedIds, setFoldedIds] = useState(
140
+ () => new Set(options.collapsed ? rowIds : [])
141
+ );
133
142
  const moveRowAtom = useMemo(
134
143
  () => atom(null, (get, set, { keys, target }) => {
135
144
  const nodes2 = get(list.nodes);
@@ -158,7 +167,7 @@ function ListFieldView({ field }) {
158
167
  [list]
159
168
  );
160
169
  const copyRow = useSetAtom(copyRowAtom);
161
- const allExpanded = nodes.length > 0 && foldedIds.size === 0;
170
+ const allExpanded = nodes.length > 0 && rowIds.every((id) => !foldedIds.has(id));
162
171
  function toggleAll() {
163
172
  setFoldedIds(allExpanded ? new Set(rowIds) : /* @__PURE__ */ new Set());
164
173
  }
@@ -177,8 +186,6 @@ function ListFieldView({ field }) {
177
186
  SortableList,
178
187
  {
179
188
  "aria-label": options.label || "List items",
180
- "data-depth": depth % 2 === 0 ? "muted" : "base",
181
- dragType: LIST_FIELD_ROW_DRAG_TYPE,
182
189
  onReorder: readOnly ? void 0 : moveRow,
183
190
  children: [
184
191
  nodes.map((row, index) => /* @__PURE__ */ jsx(
@@ -212,7 +219,7 @@ function ListFieldView({ field }) {
212
219
  ]
213
220
  }
214
221
  );
215
- return /* @__PURE__ */ jsxs(ListFieldDepthContext.Provider, { value: depth + 1, children: [
222
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
216
223
  /* @__PURE__ */ jsx(
217
224
  ListLabel,
218
225
  {
@@ -304,67 +311,6 @@ function ListFieldCreateActions({
304
311
  )
305
312
  ] });
306
313
  }
307
- function ListFieldInsertAction({
308
- icon,
309
- isDisabled,
310
- items,
311
- label,
312
- pasted,
313
- onClose,
314
- onOpenPicker,
315
- onSelect
316
- }) {
317
- const directAddItem = !pasted && items.length === 1 ? items[0] : void 0;
318
- if (directAddItem) {
319
- return /* @__PURE__ */ jsx(
320
- Button,
321
- {
322
- variant: "ghost",
323
- className: styles.ListFieldView.insertAction(),
324
- icon,
325
- disabled: isDisabled,
326
- onClick: () => {
327
- onSelect(directAddItem);
328
- onClose();
329
- },
330
- children: label
331
- }
332
- );
333
- }
334
- return /* @__PURE__ */ jsx(
335
- Button,
336
- {
337
- variant: "ghost",
338
- className: styles.ListFieldView.insertAction(),
339
- disabled: isDisabled,
340
- onClick: () => {
341
- onOpenPicker();
342
- },
343
- icon,
344
- children: label
345
- }
346
- );
347
- }
348
- function ListFieldInsertPanel({
349
- items,
350
- label,
351
- pasted,
352
- pasteLabel,
353
- onPaste,
354
- onSelect
355
- }) {
356
- return /* @__PURE__ */ jsx(
357
- ListFieldTypeCommand,
358
- {
359
- items,
360
- label,
361
- pasted,
362
- pasteLabel,
363
- onPaste,
364
- onSelect
365
- }
366
- );
367
- }
368
314
  var ListFieldRow = memo(function ListFieldRow2({
369
315
  canCreate,
370
316
  index,
@@ -389,13 +335,11 @@ var ListFieldRow = memo(function ListFieldRow2({
389
335
  const setAnchor = useSetAtom(row.field("_anchor"));
390
336
  const moveListRow = useSetAtom(list.move);
391
337
  const removeRow = useSetAtom(list.remove);
338
+ const sheet = useBlockSheet(itemId);
392
339
  const type = schema[typeName];
393
340
  if (!type) return null;
394
341
  const label = Type.label(type);
395
342
  const typeIcon = getType(type).icon;
396
- function moveCurrentRow(direction) {
397
- moveListRow(index, index + direction);
398
- }
399
343
  function deleteRow() {
400
344
  removeRow(index);
401
345
  }
@@ -408,249 +352,346 @@ var ListFieldRow = memo(function ListFieldRow2({
408
352
  function updateAnchor(nextValue) {
409
353
  setAnchor(slugify(nextValue.replace(/^#+/, "")) || void 0);
410
354
  }
411
- return /* @__PURE__ */ jsxs(
412
- SortableListItem,
413
- {
414
- "aria-label": `${label} item ${index + 1}`,
415
- dragPreview: /* @__PURE__ */ jsx(SortableListDragPreview, { icon: typeIcon, label }),
416
- id: itemId,
417
- children: [
418
- /* @__PURE__ */ jsx(
419
- ListFieldRowHeader,
420
- {
421
- canInsert: canCreate,
422
- expanded,
423
- isFirstRow: index === 0,
424
- isLastRow: index === rows - 1,
425
- label,
426
- customLabel,
427
- anchor: anchorValue,
428
- dragLabel: `Drag ${label} item ${index + 1}`,
429
- readOnly,
430
- typeIcon,
431
- insertItems: typeItems,
432
- pasted: pasted && schema[pasted._type] ? pasted : void 0,
433
- onAnchorChange: updateAnchor,
434
- onCustomLabelChange: updateCustomLabel,
435
- onCopy: () => onCopyRow(itemId),
436
- onDelete: deleteRow,
437
- onInsertBefore: (value) => onInsertRow(insertIndex(index, "before"), value),
438
- onInsertAfter: (value) => onInsertRow(insertIndex(index, "after"), value),
439
- onMoveDown: () => moveCurrentRow(1),
440
- onMoveUp: () => moveCurrentRow(-1),
441
- onToggle: () => onToggleRow(itemId)
442
- }
443
- ),
444
- expanded && /* @__PURE__ */ jsx(SortableListItemContent, { children: /* @__PURE__ */ jsx(NodeEditor, { node: row, type }) })
445
- ]
446
- }
447
- );
355
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
356
+ /* @__PURE__ */ jsxs(
357
+ SortableListItem,
358
+ {
359
+ "aria-label": `${label} item ${index + 1}`,
360
+ current: sheet.open,
361
+ id: itemId,
362
+ children: [
363
+ canCreate && !readOnly && /* @__PURE__ */ jsx(
364
+ ListFieldInsertGap,
365
+ {
366
+ items: typeItems,
367
+ label: `Insert before ${label} item ${index + 1}`,
368
+ pasted: pasted && schema[pasted._type] ? pasted : void 0,
369
+ onInsert: (value) => onInsertRow(insertIndex(index, "before"), value)
370
+ }
371
+ ),
372
+ /* @__PURE__ */ jsx(
373
+ ListFieldRowHeader,
374
+ {
375
+ expanded,
376
+ label,
377
+ customLabel,
378
+ anchor: anchorValue,
379
+ readOnly,
380
+ sheet,
381
+ typeIcon,
382
+ onDelete: deleteRow,
383
+ onToggle: () => onToggleRow(itemId)
384
+ }
385
+ ),
386
+ expanded && /* @__PURE__ */ jsx(SortableListItemContent, { children: /* @__PURE__ */ jsx(NodeEditor, { node: row, type }) })
387
+ ]
388
+ }
389
+ ),
390
+ /* @__PURE__ */ jsx(BlockSheet, { id: itemId, children: /* @__PURE__ */ jsx(
391
+ ListFieldRowSheet,
392
+ {
393
+ anchor: anchorValue,
394
+ canInsert: canCreate,
395
+ customLabel,
396
+ isFirstRow: index === 0,
397
+ isLastRow: index === rows - 1,
398
+ items: typeItems,
399
+ label,
400
+ pasted: pasted && schema[pasted._type] ? pasted : void 0,
401
+ readOnly,
402
+ typeIcon,
403
+ onAnchorChange: updateAnchor,
404
+ onClose: () => sheet.setOpen(false),
405
+ onCopy: () => onCopyRow(itemId),
406
+ onCustomLabelChange: updateCustomLabel,
407
+ onDelete: deleteRow,
408
+ onInsertAfter: (value) => onInsertRow(insertIndex(index, "after"), value),
409
+ onInsertBefore: (value) => onInsertRow(insertIndex(index, "before"), value),
410
+ onMoveDown: () => moveListRow(index, index + 1),
411
+ onMoveUp: () => moveListRow(index, index - 1)
412
+ }
413
+ ) })
414
+ ] });
448
415
  });
416
+ function ListFieldInsertGap({
417
+ items,
418
+ label,
419
+ pasted,
420
+ onInsert
421
+ }) {
422
+ const ref = useRef(null);
423
+ const [open, setOpen] = useState(false);
424
+ const direct = !pasted && items.length === 1 ? items[0] : void 0;
425
+ function insert(row) {
426
+ onInsert(row);
427
+ setOpen(false);
428
+ }
429
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
430
+ /* @__PURE__ */ jsx(
431
+ SortableListItemInsert,
432
+ {
433
+ ref,
434
+ "aria-label": label,
435
+ "aria-haspopup": direct ? void 0 : "dialog",
436
+ "aria-expanded": direct ? void 0 : open,
437
+ onClick: () => {
438
+ if (direct) onInsert(createRow(direct.id, direct.type));
439
+ else setOpen(true);
440
+ }
441
+ }
442
+ ),
443
+ !direct && /* @__PURE__ */ jsxs(Popover, { open, onOpenChange: setOpen, children: [
444
+ /* @__PURE__ */ jsx(PopoverAnchor, { virtualRef: ref }),
445
+ /* @__PURE__ */ jsx(
446
+ PopoverContent,
447
+ {
448
+ "aria-label": label,
449
+ align: "start",
450
+ className: styles.ListFieldTypePicker.popover(),
451
+ children: /* @__PURE__ */ jsx(
452
+ ListFieldTypeCommand,
453
+ {
454
+ items,
455
+ label,
456
+ pasted,
457
+ pasteLabel: pasted ? pasteBlockLabel(pasted, items) : void 0,
458
+ onPaste: (row) => insert(cloneRow(row)),
459
+ onSelect: (item) => insert(createRow(item.id, item.type))
460
+ }
461
+ )
462
+ }
463
+ )
464
+ ] })
465
+ ] });
466
+ }
467
+ function rowAnchor(customLabel, anchor) {
468
+ return (anchor ?? slugify(customLabel.trim())).trim();
469
+ }
449
470
  function ListFieldRowHeader({
450
- canInsert,
451
- className,
452
471
  expanded,
453
- isFirstRow,
454
- isLastRow,
455
- isPreview,
456
- insertItems,
457
472
  label,
458
- dragLabel,
459
473
  customLabel,
460
474
  anchor,
461
- pasted,
462
475
  readOnly,
476
+ sheet,
463
477
  typeIcon,
464
- onAnchorChange,
465
- onCustomLabelChange,
466
- onCopy,
467
478
  onDelete,
468
- onInsertBefore,
469
- onInsertAfter,
470
- onMoveDown,
471
- onMoveUp,
472
479
  onToggle
473
480
  }) {
474
481
  const displayLabel = customLabel.trim();
475
- const displayAnchor = (anchor ?? slugify(displayLabel)).trim();
482
+ const displayAnchor = rowAnchor(customLabel, anchor);
476
483
  const showAnchor = Boolean(displayAnchor && !displayLabel);
477
- const [actionsOpen, setActionsOpen] = useState(false);
478
- const [insertPosition, setInsertPosition] = useState(null);
479
- function closeActions() {
480
- setActionsOpen(false);
481
- setInsertPosition(null);
482
- }
483
- return /* @__PURE__ */ jsxs(SortableListItemHeader, { className, children: [
484
- !readOnly && /* @__PURE__ */ jsx(SortableListHandle, { "aria-label": dragLabel }),
484
+ const title = /* @__PURE__ */ jsxs(Fragment, { children: [
485
+ /* @__PURE__ */ jsx(Badge, { icon: typeIcon, size: "sm", color: "primary", children: label }),
486
+ displayLabel && /* @__PURE__ */ jsx(SortableListItemDescription, { children: displayLabel }),
487
+ showAnchor && /* @__PURE__ */ jsxs(Badge, { size: "sm", children: [
488
+ "#",
489
+ displayAnchor
490
+ ] })
491
+ ] });
492
+ return /* @__PURE__ */ jsxs(SortableListItemHeader, { children: [
485
493
  /* @__PURE__ */ jsxs(SortableListItemTitle, { children: [
486
494
  /* @__PURE__ */ jsx(
487
495
  SortableListItemToggle,
488
496
  {
489
497
  "aria-label": expanded ? `Collapse ${label}` : `Expand ${label}`,
490
498
  expanded,
491
- disabled: isPreview,
492
499
  onClick: onToggle
493
500
  }
494
501
  ),
495
- /* @__PURE__ */ jsx(Badge, { icon: typeIcon, size: "sm", children: label }),
496
- displayLabel && /* @__PURE__ */ jsx(SortableListItemDescription, { children: displayLabel }),
497
- showAnchor && /* @__PURE__ */ jsxs(Badge, { size: "sm", children: [
498
- "#",
499
- displayAnchor
500
- ] })
501
- ] }),
502
- /* @__PURE__ */ jsxs(SortableListItemActions, { children: [
503
- /* @__PURE__ */ jsxs(
504
- Popover,
502
+ sheet.available ? /* @__PURE__ */ jsx(
503
+ SortableListItemTrigger,
505
504
  {
506
- open: actionsOpen,
507
- onOpenChange: (open) => {
508
- if (open) setActionsOpen(true);
509
- else closeActions();
505
+ ...sheet.triggerProps,
506
+ "aria-label": `${label} settings`,
507
+ "aria-expanded": sheet.open,
508
+ onClick: () => {
509
+ if (!sheet.open && !expanded) onToggle();
510
+ sheet.toggle();
510
511
  },
511
- children: [
512
+ children: title
513
+ }
514
+ ) : title
515
+ ] }),
516
+ /* @__PURE__ */ jsx(SortableListItemActions, { children: /* @__PURE__ */ jsx(
517
+ Button,
518
+ {
519
+ variant: "ghost",
520
+ "aria-label": `Remove ${label}`,
521
+ icon: IcRoundClose,
522
+ disabled: readOnly,
523
+ onClick: onDelete,
524
+ size: "icon-sm"
525
+ }
526
+ ) })
527
+ ] });
528
+ }
529
+ function ListFieldRowSheet({
530
+ anchor,
531
+ canInsert,
532
+ customLabel,
533
+ isFirstRow,
534
+ isLastRow,
535
+ items,
536
+ label,
537
+ pasted,
538
+ readOnly,
539
+ typeIcon,
540
+ onAnchorChange,
541
+ onClose,
542
+ onCopy,
543
+ onCustomLabelChange,
544
+ onDelete,
545
+ onInsertAfter,
546
+ onInsertBefore,
547
+ onMoveDown,
548
+ onMoveUp
549
+ }) {
550
+ const [insertPosition, setInsertPosition] = useState(
551
+ null
552
+ );
553
+ const entryUrl = useEntry()?.url;
554
+ const displayLabel = customLabel.trim();
555
+ const displayAnchor = rowAnchor(customLabel, anchor);
556
+ const title = displayLabel || displayAnchor && `#${displayAnchor}` || label;
557
+ const link = entryUrl && displayAnchor ? `${entryUrl}#${displayAnchor}` : void 0;
558
+ function insert(position, row) {
559
+ if (position === "after") onInsertAfter(row);
560
+ else onInsertBefore(row);
561
+ onClose();
562
+ }
563
+ function startInsert(position) {
564
+ const only = !pasted && items.length === 1 ? items[0] : void 0;
565
+ if (only) insert(position, createRow(only.id, only.type));
566
+ else setInsertPosition(position);
567
+ }
568
+ function copy() {
569
+ onCopy();
570
+ onClose();
571
+ }
572
+ return /* @__PURE__ */ jsxs(SheetContent, { onClose, children: [
573
+ /* @__PURE__ */ jsxs(SheetHeader, { children: [
574
+ /* @__PURE__ */ jsx(Badge, { icon: typeIcon, size: "sm", color: "primary", children: label }),
575
+ /* @__PURE__ */ jsx(SheetTitle, { children: title }),
576
+ /* @__PURE__ */ jsx(SheetClose, { "aria-label": "Close block settings" })
577
+ ] }),
578
+ insertPosition ? /* @__PURE__ */ jsx(SheetBody, { children: /* @__PURE__ */ jsx(
579
+ ListFieldTypeCommand,
580
+ {
581
+ items,
582
+ label: `Insert ${insertPosition}`,
583
+ pasted,
584
+ pasteLabel: pasted ? pasteBlockLabel(pasted, items) : void 0,
585
+ onPaste: (row) => insert(insertPosition, cloneRow(row)),
586
+ onSelect: (item) => insert(insertPosition, createRow(item.id, item.type))
587
+ }
588
+ ) }) : /* @__PURE__ */ jsxs(Fragment, { children: [
589
+ /* @__PURE__ */ jsx(SheetBody, { children: /* @__PURE__ */ jsxs(SheetSection, { children: [
590
+ /* @__PURE__ */ jsx(
591
+ TextField,
592
+ {
593
+ label: "Label",
594
+ disabled: readOnly,
595
+ onValueChange: onCustomLabelChange,
596
+ value: customLabel
597
+ }
598
+ ),
599
+ /* @__PURE__ */ jsxs("div", { className: styles.ListFieldRowSheet.anchor(), children: [
600
+ /* @__PURE__ */ jsx("div", { className: styles.ListFieldRowSheet.anchor.field(), children: /* @__PURE__ */ jsx(
601
+ SlugField,
602
+ {
603
+ fieldValue: anchor,
604
+ label: "Anchor",
605
+ isDisabled: readOnly,
606
+ onChange: onAnchorChange,
607
+ source: customLabel
608
+ }
609
+ ) }),
610
+ link && /* @__PURE__ */ jsxs(Tooltip, { children: [
512
611
  /* @__PURE__ */ jsx(
513
- PopoverTrigger,
612
+ TooltipTrigger,
514
613
  {
515
614
  variant: "ghost",
516
- "aria-label": `${label} actions`,
517
- icon: IcRoundMoreHoriz,
518
- size: "icon-sm"
615
+ size: "icon",
616
+ icon: IcRoundLink,
617
+ "aria-label": "Copy link to block",
618
+ onClick: () => navigator.clipboard.writeText(link)
519
619
  }
520
620
  ),
521
- /* @__PURE__ */ jsx(
522
- PopoverContent,
523
- {
524
- "aria-label": `${label} actions`,
525
- side: "bottom",
526
- align: "end",
527
- children: insertPosition ? /* @__PURE__ */ jsx(
528
- ListFieldInsertPanel,
529
- {
530
- items: insertItems,
531
- label: `Insert ${insertPosition}`,
532
- pasted,
533
- pasteLabel: pasted ? pasteBlockLabel(pasted, insertItems) : void 0,
534
- onPaste: (row) => {
535
- if (insertPosition === "before") onInsertBefore(cloneRow(row));
536
- else onInsertAfter(cloneRow(row));
537
- closeActions();
538
- },
539
- onSelect: (item) => {
540
- const row = createRow(item.id, item.type);
541
- if (insertPosition === "before") onInsertBefore(row);
542
- else onInsertAfter(row);
543
- closeActions();
544
- }
545
- }
546
- ) : /* @__PURE__ */ jsxs(Fragment, { children: [
547
- /* @__PURE__ */ jsxs(SortableListItemSettings, { children: [
548
- /* @__PURE__ */ jsx(
549
- TextField,
550
- {
551
- label: "Label",
552
- autoFocus: true,
553
- disabled: readOnly || isPreview,
554
- onValueChange: onCustomLabelChange,
555
- value: customLabel
556
- }
557
- ),
558
- /* @__PURE__ */ jsx(
559
- SlugField,
560
- {
561
- fieldValue: anchor,
562
- label: "Anchor",
563
- isDisabled: readOnly || isPreview,
564
- onChange: onAnchorChange,
565
- source: customLabel
566
- }
567
- )
568
- ] }),
569
- /* @__PURE__ */ jsx("hr", { className: styles.ListFieldRowHeader.separator() }),
570
- /* @__PURE__ */ jsx(SortableListItemSettings, { variant: "actions", children: /* @__PURE__ */ jsx(
571
- Button,
572
- {
573
- variant: "ghost",
574
- icon: IcBaselineContentCopy,
575
- onClick: () => {
576
- onCopy?.();
577
- closeActions();
578
- },
579
- children: "Copy"
580
- }
581
- ) }),
582
- /* @__PURE__ */ jsx("hr", { className: styles.ListFieldRowHeader.separator() }),
583
- /* @__PURE__ */ jsxs(SortableListItemSettings, { variant: "actions", children: [
584
- !isFirstRow && /* @__PURE__ */ jsx(
585
- Button,
586
- {
587
- variant: "ghost",
588
- icon: IcRoundArrowUpward,
589
- onClick: () => {
590
- onMoveUp?.();
591
- closeActions();
592
- },
593
- children: "Move up"
594
- }
595
- ),
596
- !isLastRow && /* @__PURE__ */ jsx(
597
- Button,
598
- {
599
- variant: "ghost",
600
- icon: IcRoundArrowDownward,
601
- onClick: () => {
602
- onMoveDown?.();
603
- closeActions();
604
- },
605
- children: "Move down"
606
- }
607
- ),
608
- canInsert && /* @__PURE__ */ jsxs(Fragment, { children: [
609
- /* @__PURE__ */ jsx(
610
- ListFieldInsertAction,
611
- {
612
- icon: IcRoundFirstPage,
613
- isDisabled: Boolean(readOnly || isPreview),
614
- items: insertItems,
615
- label: "Insert before",
616
- pasted,
617
- onClose: closeActions,
618
- onOpenPicker: () => setInsertPosition("before"),
619
- onSelect: (item) => onInsertBefore(createRow(item.id, item.type))
620
- }
621
- ),
622
- /* @__PURE__ */ jsx(
623
- ListFieldInsertAction,
624
- {
625
- icon: IcRoundLastPage,
626
- isDisabled: Boolean(readOnly || isPreview),
627
- items: insertItems,
628
- label: "Insert after",
629
- pasted,
630
- onClose: closeActions,
631
- onOpenPicker: () => setInsertPosition("after"),
632
- onSelect: (item) => onInsertAfter(createRow(item.id, item.type))
633
- }
634
- )
635
- ] })
636
- ] })
637
- ] })
638
- }
639
- )
640
- ]
641
- }
642
- ),
643
- /* @__PURE__ */ jsx(
621
+ /* @__PURE__ */ jsx(TooltipContent, { children: "Copy link to block" })
622
+ ] })
623
+ ] })
624
+ ] }) }),
625
+ /* @__PURE__ */ jsxs(SheetFooter, { children: [
626
+ /* @__PURE__ */ jsx(
627
+ Button,
628
+ {
629
+ variant: "ghost",
630
+ size: "sm",
631
+ icon: IcRoundFirstPage,
632
+ disabled: readOnly || !canInsert,
633
+ onClick: () => startInsert("before"),
634
+ children: "Insert before"
635
+ }
636
+ ),
637
+ /* @__PURE__ */ jsx(
638
+ Button,
639
+ {
640
+ variant: "ghost",
641
+ size: "sm",
642
+ icon: IcRoundLastPage,
643
+ disabled: readOnly || !canInsert,
644
+ onClick: () => startInsert("after"),
645
+ children: "Insert after"
646
+ }
647
+ )
648
+ ] }),
649
+ /* @__PURE__ */ jsxs(SheetFooter, { children: [
650
+ /* @__PURE__ */ jsx(
651
+ Button,
652
+ {
653
+ variant: "ghost",
654
+ size: "sm",
655
+ icon: IcBaselineContentCopy,
656
+ onClick: copy,
657
+ children: "Copy"
658
+ }
659
+ ),
660
+ /* @__PURE__ */ jsx(
661
+ Button,
662
+ {
663
+ variant: "ghost",
664
+ size: "sm",
665
+ icon: IcRoundArrowUpward,
666
+ disabled: readOnly || isFirstRow,
667
+ onClick: onMoveUp,
668
+ children: "Move up"
669
+ }
670
+ ),
671
+ /* @__PURE__ */ jsx(
672
+ Button,
673
+ {
674
+ variant: "ghost",
675
+ size: "sm",
676
+ icon: IcRoundArrowDownward,
677
+ disabled: readOnly || isLastRow,
678
+ onClick: onMoveDown,
679
+ children: "Move down"
680
+ }
681
+ )
682
+ ] }),
683
+ /* @__PURE__ */ jsx(SheetFooter, { children: /* @__PURE__ */ jsx(
644
684
  Button,
645
685
  {
646
686
  variant: "ghost",
647
- "aria-label": `Remove ${label}`,
648
- icon: IcRoundClose,
649
- disabled: readOnly || isPreview,
687
+ size: "sm",
688
+ color: "destructive",
689
+ icon: IcRoundDelete,
690
+ disabled: readOnly,
650
691
  onClick: onDelete,
651
- size: "icon-sm"
692
+ children: "Delete"
652
693
  }
653
- )
694
+ ) })
654
695
  ] })
655
696
  ] });
656
697
  }
@@ -774,6 +815,7 @@ function useListFieldPickerItems(items, pasted, pasteLabel, onPaste) {
774
815
  }, [items, onPaste, pasteLabel, pasted]);
775
816
  }
776
817
  export {
818
+ ListFieldTypeCommand,
777
819
  ListFieldView,
778
820
  insertIndex,
779
821
  reorderIndex