@formicoidea/labre-core 0.47.1 → 0.49.0

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 (239) hide show
  1. package/dist/_pkgs/affine-block-data-view/configs/slash-menu.js +3 -1
  2. package/dist/_pkgs/affine-block-data-view/view.d.ts +17 -1
  3. package/dist/_pkgs/affine-block-data-view/view.js +21 -2
  4. package/dist/_pkgs/affine-block-database/commands.d.ts +2 -2
  5. package/dist/_pkgs/affine-block-database/commands.js +3 -3
  6. package/dist/_pkgs/affine-block-database/components/values-banner.d.ts +28 -0
  7. package/dist/_pkgs/affine-block-database/components/values-banner.js +199 -0
  8. package/dist/_pkgs/affine-block-database/configs/slash-menu.d.ts +6 -1
  9. package/dist/_pkgs/affine-block-database/configs/slash-menu.js +57 -70
  10. package/dist/_pkgs/affine-block-database/data-source.d.ts +9 -5
  11. package/dist/_pkgs/affine-block-database/data-source.js +11 -7
  12. package/dist/_pkgs/affine-block-database/database-block-styles.d.ts +2 -0
  13. package/dist/_pkgs/affine-block-database/database-block-styles.js +15 -0
  14. package/dist/_pkgs/affine-block-database/database-block.d.ts +23 -0
  15. package/dist/_pkgs/affine-block-database/database-block.js +141 -19
  16. package/dist/_pkgs/affine-block-database/effects.js +2 -0
  17. package/dist/_pkgs/affine-block-database/external-data-source.d.ts +69 -2
  18. package/dist/_pkgs/affine-block-database/external-data-source.js +88 -16
  19. package/dist/_pkgs/affine-block-database/index.d.ts +2 -0
  20. package/dist/_pkgs/affine-block-database/index.js +2 -0
  21. package/dist/_pkgs/affine-block-database/linked-view.d.ts +38 -0
  22. package/dist/_pkgs/affine-block-database/linked-view.js +109 -0
  23. package/dist/_pkgs/affine-block-database/properties/index.d.ts +2 -0
  24. package/dist/_pkgs/affine-block-database/properties/index.js +2 -0
  25. package/dist/_pkgs/affine-block-database/properties/text/hosted.d.ts +15 -0
  26. package/dist/_pkgs/affine-block-database/properties/text/hosted.js +24 -0
  27. package/dist/_pkgs/affine-block-database/properties/title/hosted.d.ts +16 -0
  28. package/dist/_pkgs/affine-block-database/properties/title/hosted.js +42 -0
  29. package/dist/_pkgs/affine-block-database/service/index.d.ts +3 -0
  30. package/dist/_pkgs/affine-block-database/service/index.js +3 -0
  31. package/dist/_pkgs/affine-block-database/service/new-row-menu.d.ts +49 -0
  32. package/dist/_pkgs/affine-block-database/service/new-row-menu.js +21 -0
  33. package/dist/_pkgs/affine-block-database/service/open-row.d.ts +77 -0
  34. package/dist/_pkgs/affine-block-database/service/open-row.js +62 -0
  35. package/dist/_pkgs/affine-block-database/service/properties-panel.d.ts +23 -0
  36. package/dist/_pkgs/affine-block-database/service/properties-panel.js +33 -0
  37. package/dist/_pkgs/affine-block-database/translations.d.ts +10 -0
  38. package/dist/_pkgs/affine-block-database/translations.js +35 -0
  39. package/dist/_pkgs/affine-block-database/view-creation.d.ts +10 -0
  40. package/dist/_pkgs/affine-block-database/view-creation.js +14 -0
  41. package/dist/_pkgs/affine-block-database/view.d.ts +31 -1
  42. package/dist/_pkgs/affine-block-database/view.js +48 -4
  43. package/dist/_pkgs/affine-block-database/views/index.d.ts +30 -3
  44. package/dist/_pkgs/affine-block-database/views/index.js +44 -3
  45. package/dist/_pkgs/affine-block-embed-doc/embed-linked-doc-block/configs/new-doc.d.ts +25 -0
  46. package/dist/_pkgs/affine-block-embed-doc/embed-linked-doc-block/configs/new-doc.js +71 -0
  47. package/dist/_pkgs/affine-block-embed-doc/embed-linked-doc-block/configs/slash-menu.js +3 -11
  48. package/dist/_pkgs/affine-components/date-picker/date-picker.d.ts +20 -0
  49. package/dist/_pkgs/affine-components/date-picker/date-picker.js +60 -26
  50. package/dist/_pkgs/affine-components/date-picker/style.js +1 -0
  51. package/dist/_pkgs/affine-components/translations.d.ts +4 -0
  52. package/dist/_pkgs/affine-components/translations.js +26 -0
  53. package/dist/_pkgs/affine-fragment-doc-title/doc-title.d.ts +18 -0
  54. package/dist/_pkgs/affine-fragment-doc-title/doc-title.js +41 -2
  55. package/dist/_pkgs/affine-fragment-doc-title/index.d.ts +1 -1
  56. package/dist/_pkgs/affine-fragment-doc-title/index.js +1 -1
  57. package/dist/_pkgs/affine-fragment-doc-title/title-band/band-cell.d.ts +30 -0
  58. package/dist/_pkgs/affine-fragment-doc-title/title-band/band-cell.js +137 -0
  59. package/dist/_pkgs/affine-fragment-doc-title/title-band/format.d.ts +7 -19
  60. package/dist/_pkgs/affine-fragment-doc-title/title-band/format.js +0 -38
  61. package/dist/_pkgs/affine-fragment-doc-title/title-band/show-here.d.ts +19 -0
  62. package/dist/_pkgs/affine-fragment-doc-title/title-band/show-here.js +61 -0
  63. package/dist/_pkgs/affine-fragment-doc-title/title-band/title-band.d.ts +33 -18
  64. package/dist/_pkgs/affine-fragment-doc-title/title-band/title-band.js +263 -205
  65. package/dist/_pkgs/affine-fragment-doc-title/translations.d.ts +7 -4
  66. package/dist/_pkgs/affine-fragment-doc-title/translations.js +12 -9
  67. package/dist/_pkgs/affine-model/blocks/database/types.d.ts +16 -0
  68. package/dist/_pkgs/affine-model/blocks/database/types.js +5 -1
  69. package/dist/_pkgs/affine-shared/services/data-source-picker-service.d.ts +139 -0
  70. package/dist/_pkgs/affine-shared/services/data-source-picker-service.js +22 -0
  71. package/dist/_pkgs/affine-shared/services/index.d.ts +1 -0
  72. package/dist/_pkgs/affine-shared/services/index.js +1 -0
  73. package/dist/_pkgs/affine-shared/services/linked-doc-creation-service.d.ts +15 -6
  74. package/dist/_pkgs/affine-shared/services/telemetry-service/database.d.ts +59 -0
  75. package/dist/_pkgs/affine-shared/services/title-band-service.d.ts +34 -7
  76. package/dist/_pkgs/affine-shared/utils/model/doc.d.ts +10 -2
  77. package/dist/_pkgs/affine-shared/utils/model/doc.js +17 -7
  78. package/dist/_pkgs/data-view/core/component/cell-status/cell-status-css.d.ts +2 -0
  79. package/dist/_pkgs/data-view/core/component/cell-status/cell-status-css.js +16 -0
  80. package/dist/_pkgs/data-view/core/component/cell-status/cell-status.d.ts +10 -0
  81. package/dist/_pkgs/data-view/core/component/cell-status/cell-status.js +23 -0
  82. package/dist/_pkgs/data-view/core/component/index.d.ts +1 -0
  83. package/dist/_pkgs/data-view/core/component/index.js +1 -0
  84. package/dist/_pkgs/data-view/core/component/overflow/fit.d.ts +26 -0
  85. package/dist/_pkgs/data-view/core/component/overflow/fit.js +48 -0
  86. package/dist/_pkgs/data-view/core/component/overflow/overflow.d.ts +26 -3
  87. package/dist/_pkgs/data-view/core/component/overflow/overflow.js +84 -31
  88. package/dist/_pkgs/data-view/core/component/tags/colors.d.ts +7 -0
  89. package/dist/_pkgs/data-view/core/component/tags/colors.js +22 -10
  90. package/dist/_pkgs/data-view/core/component/tags/multi-tag-select.d.ts +25 -2
  91. package/dist/_pkgs/data-view/core/component/tags/multi-tag-select.js +81 -32
  92. package/dist/_pkgs/data-view/core/data-source/base.d.ts +5 -1
  93. package/dist/_pkgs/data-view/core/data-source/base.js +7 -1
  94. package/dist/_pkgs/data-view/core/data-source/hydration.d.ts +44 -0
  95. package/dist/_pkgs/data-view/core/data-source/hydration.js +31 -0
  96. package/dist/_pkgs/data-view/core/data-source/index.d.ts +1 -0
  97. package/dist/_pkgs/data-view/core/data-source/index.js +1 -0
  98. package/dist/_pkgs/data-view/core/data-view.d.ts +22 -2
  99. package/dist/_pkgs/data-view/core/data-view.js +14 -0
  100. package/dist/_pkgs/data-view/core/effect.js +4 -0
  101. package/dist/_pkgs/data-view/core/group-by/collapsed-state.d.ts +3 -0
  102. package/dist/_pkgs/data-view/core/group-by/collapsed-state.js +59 -0
  103. package/dist/_pkgs/data-view/core/group-by/group-properties.d.ts +21 -0
  104. package/dist/_pkgs/data-view/core/group-by/group-properties.js +38 -0
  105. package/dist/_pkgs/data-view/core/group-by/group-title.js +4 -0
  106. package/dist/_pkgs/data-view/core/group-by/group-visibility.d.ts +40 -0
  107. package/dist/_pkgs/data-view/core/group-by/group-visibility.js +291 -0
  108. package/dist/_pkgs/data-view/core/group-by/setting.d.ts +11 -3
  109. package/dist/_pkgs/data-view/core/group-by/setting.js +81 -8
  110. package/dist/_pkgs/data-view/core/group-by/trait.d.ts +22 -0
  111. package/dist/_pkgs/data-view/core/group-by/trait.js +62 -1
  112. package/dist/_pkgs/data-view/core/index.d.ts +3 -0
  113. package/dist/_pkgs/data-view/core/index.js +3 -0
  114. package/dist/_pkgs/data-view/core/property/base-cell.d.ts +15 -1
  115. package/dist/_pkgs/data-view/core/property/base-cell.js +28 -3
  116. package/dist/_pkgs/data-view/core/property/index.d.ts +1 -0
  117. package/dist/_pkgs/data-view/core/property/index.js +1 -0
  118. package/dist/_pkgs/data-view/core/property/standalone-cell.d.ts +109 -0
  119. package/dist/_pkgs/data-view/core/property/standalone-cell.js +324 -0
  120. package/dist/_pkgs/data-view/core/telemetry.d.ts +16 -0
  121. package/dist/_pkgs/data-view/core/telemetry.js +22 -0
  122. package/dist/_pkgs/data-view/core/utils/new-tab-click.d.ts +2 -0
  123. package/dist/_pkgs/data-view/core/utils/new-tab-click.js +4 -0
  124. package/dist/_pkgs/data-view/core/utils/wording.d.ts +11 -0
  125. package/dist/_pkgs/data-view/core/utils/wording.js +9 -0
  126. package/dist/_pkgs/data-view/core/view/data-view.d.ts +7 -0
  127. package/dist/_pkgs/data-view/core/view/default-name.d.ts +10 -0
  128. package/dist/_pkgs/data-view/core/view/default-name.js +14 -0
  129. package/dist/_pkgs/data-view/core/view/index.d.ts +2 -0
  130. package/dist/_pkgs/data-view/core/view/index.js +2 -0
  131. package/dist/_pkgs/data-view/core/view/open-in.d.ts +27 -0
  132. package/dist/_pkgs/data-view/core/view/open-in.js +39 -0
  133. package/dist/_pkgs/data-view/core/view-manager/cell.d.ts +5 -0
  134. package/dist/_pkgs/data-view/core/view-manager/cell.js +11 -0
  135. package/dist/_pkgs/data-view/core/view-manager/index.d.ts +3 -0
  136. package/dist/_pkgs/data-view/core/view-manager/index.js +3 -0
  137. package/dist/_pkgs/data-view/core/view-manager/new-row-menu-opener.d.ts +18 -0
  138. package/dist/_pkgs/data-view/core/view-manager/new-row-menu-opener.js +2 -0
  139. package/dist/_pkgs/data-view/core/view-manager/properties-panel-opener.d.ts +8 -0
  140. package/dist/_pkgs/data-view/core/view-manager/properties-panel-opener.js +9 -0
  141. package/dist/_pkgs/data-view/core/view-manager/property.d.ts +14 -0
  142. package/dist/_pkgs/data-view/core/view-manager/single-view.d.ts +28 -1
  143. package/dist/_pkgs/data-view/core/view-manager/single-view.js +45 -1
  144. package/dist/_pkgs/data-view/core/view-manager/view-creation.d.ts +49 -0
  145. package/dist/_pkgs/data-view/core/view-manager/view-creation.js +40 -0
  146. package/dist/_pkgs/data-view/core/view-manager/view-manager.d.ts +6 -2
  147. package/dist/_pkgs/data-view/core/view-manager/view-manager.js +2 -2
  148. package/dist/_pkgs/data-view/property-presets/date/cell-renderer.d.ts +2 -0
  149. package/dist/_pkgs/data-view/property-presets/date/cell-renderer.js +11 -2
  150. package/dist/_pkgs/data-view/property-presets/multi-select/cell-renderer.js +3 -1
  151. package/dist/_pkgs/data-view/property-presets/select/cell-renderer.js +3 -1
  152. package/dist/_pkgs/data-view/property-presets/text/cell-renderer.js +3 -1
  153. package/dist/_pkgs/data-view/translations.d.ts +55 -0
  154. package/dist/_pkgs/data-view/translations.js +181 -0
  155. package/dist/_pkgs/data-view/view-presets/calendar/define.js +3 -1
  156. package/dist/_pkgs/data-view/view-presets/convert.js +2 -0
  157. package/dist/_pkgs/data-view/view-presets/effect.js +4 -0
  158. package/dist/_pkgs/data-view/view-presets/flat/flat-converts.d.ts +2 -0
  159. package/dist/_pkgs/data-view/view-presets/flat/flat-converts.js +35 -0
  160. package/dist/_pkgs/data-view/view-presets/flat/flat-view-manager.d.ts +79 -0
  161. package/dist/_pkgs/data-view/view-presets/flat/flat-view-manager.js +194 -0
  162. package/dist/_pkgs/data-view/view-presets/flat/flat-view-ui.d.ts +56 -0
  163. package/dist/_pkgs/data-view/view-presets/flat/flat-view-ui.js +266 -0
  164. package/dist/_pkgs/data-view/view-presets/gallery/define.d.ts +14 -0
  165. package/dist/_pkgs/data-view/view-presets/gallery/define.js +15 -0
  166. package/dist/_pkgs/data-view/view-presets/gallery/effect.d.ts +1 -0
  167. package/dist/_pkgs/data-view/view-presets/gallery/effect.js +4 -0
  168. package/dist/_pkgs/data-view/view-presets/gallery/gallery-view.d.ts +27 -0
  169. package/dist/_pkgs/data-view/view-presets/gallery/gallery-view.js +179 -0
  170. package/dist/_pkgs/data-view/view-presets/gallery/index.d.ts +2 -0
  171. package/dist/_pkgs/data-view/view-presets/gallery/index.js +2 -0
  172. package/dist/_pkgs/data-view/view-presets/gallery/renderer.d.ts +1 -0
  173. package/dist/_pkgs/data-view/view-presets/gallery/renderer.js +11 -0
  174. package/dist/_pkgs/data-view/view-presets/index.d.ts +5 -0
  175. package/dist/_pkgs/data-view/view-presets/index.js +7 -0
  176. package/dist/_pkgs/data-view/view-presets/kanban/define.js +3 -1
  177. package/dist/_pkgs/data-view/view-presets/kanban/kanban-view-manager.js +5 -53
  178. package/dist/_pkgs/data-view/view-presets/kanban/mobile/card.js +8 -1
  179. package/dist/_pkgs/data-view/view-presets/kanban/mobile/cell.js +6 -1
  180. package/dist/_pkgs/data-view/view-presets/kanban/mobile/group.d.ts +4 -2
  181. package/dist/_pkgs/data-view/view-presets/kanban/mobile/group.js +52 -6
  182. package/dist/_pkgs/data-view/view-presets/kanban/mobile/kanban-view-ui-logic.js +5 -1
  183. package/dist/_pkgs/data-view/view-presets/kanban/pc/card.js +2 -0
  184. package/dist/_pkgs/data-view/view-presets/kanban/pc/cell.js +4 -0
  185. package/dist/_pkgs/data-view/view-presets/kanban/pc/group.d.ts +4 -2
  186. package/dist/_pkgs/data-view/view-presets/kanban/pc/group.js +51 -6
  187. package/dist/_pkgs/data-view/view-presets/kanban/pc/kanban-view-ui-logic.js +5 -1
  188. package/dist/_pkgs/data-view/view-presets/list/define.d.ts +14 -0
  189. package/dist/_pkgs/data-view/view-presets/list/define.js +15 -0
  190. package/dist/_pkgs/data-view/view-presets/list/effect.d.ts +1 -0
  191. package/dist/_pkgs/data-view/view-presets/list/effect.js +4 -0
  192. package/dist/_pkgs/data-view/view-presets/list/index.d.ts +2 -0
  193. package/dist/_pkgs/data-view/view-presets/list/index.js +2 -0
  194. package/dist/_pkgs/data-view/view-presets/list/list-view.d.ts +24 -0
  195. package/dist/_pkgs/data-view/view-presets/list/list-view.js +194 -0
  196. package/dist/_pkgs/data-view/view-presets/list/renderer.d.ts +1 -0
  197. package/dist/_pkgs/data-view/view-presets/list/renderer.js +11 -0
  198. package/dist/_pkgs/data-view/view-presets/table/collapsed-state.d.ts +3 -14
  199. package/dist/_pkgs/data-view/view-presets/table/collapsed-state.js +6 -30
  200. package/dist/_pkgs/data-view/view-presets/table/consts.d.ts +2 -0
  201. package/dist/_pkgs/data-view/view-presets/table/consts.js +2 -0
  202. package/dist/_pkgs/data-view/view-presets/table/define.js +3 -1
  203. package/dist/_pkgs/data-view/view-presets/table/mobile/cell.js +4 -1
  204. package/dist/_pkgs/data-view/view-presets/table/mobile/column-header.js +2 -2
  205. package/dist/_pkgs/data-view/view-presets/table/mobile/group.d.ts +3 -1
  206. package/dist/_pkgs/data-view/view-presets/table/mobile/group.js +20 -5
  207. package/dist/_pkgs/data-view/view-presets/table/mobile/row.js +10 -2
  208. package/dist/_pkgs/data-view/view-presets/table/mobile/table-view-ui-logic.js +4 -1
  209. package/dist/_pkgs/data-view/view-presets/table/pc/cell.js +4 -1
  210. package/dist/_pkgs/data-view/view-presets/table/pc/controller/hotkeys.js +1 -1
  211. package/dist/_pkgs/data-view/view-presets/table/pc/group.d.ts +3 -1
  212. package/dist/_pkgs/data-view/view-presets/table/pc/group.js +20 -5
  213. package/dist/_pkgs/data-view/view-presets/table/pc/menu.d.ts +1 -1
  214. package/dist/_pkgs/data-view/view-presets/table/pc/menu.js +2 -1
  215. package/dist/_pkgs/data-view/view-presets/table/pc/row/row.js +3 -2
  216. package/dist/_pkgs/data-view/view-presets/table/pc/table-view-ui-logic.js +4 -1
  217. package/dist/_pkgs/data-view/view-presets/table/pc-virtual/controller/hotkeys.js +1 -1
  218. package/dist/_pkgs/data-view/view-presets/table/pc-virtual/group/bottom/stats/column-stats-column.js +5 -1
  219. package/dist/_pkgs/data-view/view-presets/table/pc-virtual/group/top/group-title.js +22 -19
  220. package/dist/_pkgs/data-view/view-presets/table/pc-virtual/row/cell.js +4 -1
  221. package/dist/_pkgs/data-view/view-presets/table/pc-virtual/table-view-ui-logic.js +7 -2
  222. package/dist/_pkgs/data-view/view-presets/table/stats/column-stats-column.js +5 -1
  223. package/dist/_pkgs/data-view/view-presets/table/table-view-manager.js +5 -53
  224. package/dist/_pkgs/data-view/widget-presets/tools/presets/table-add-row/add-row.d.ts +1 -0
  225. package/dist/_pkgs/data-view/widget-presets/tools/presets/table-add-row/add-row.js +60 -2
  226. package/dist/_pkgs/data-view/widget-presets/tools/presets/view-options/view-options.d.ts +18 -1
  227. package/dist/_pkgs/data-view/widget-presets/tools/presets/view-options/view-options.js +121 -124
  228. package/dist/_pkgs/data-view/widget-presets/tools/presets/view-options/view-settings.d.ts +43 -0
  229. package/dist/_pkgs/data-view/widget-presets/tools/presets/view-options/view-settings.js +187 -0
  230. package/dist/_pkgs/data-view/widget-presets/views-bar/views-view.d.ts +36 -3
  231. package/dist/_pkgs/data-view/widget-presets/views-bar/views-view.js +187 -59
  232. package/dist/extensions/view.d.ts +2 -2
  233. package/dist/extensions/view.js +10 -3
  234. package/dist/flags.d.ts +8 -4
  235. package/dist/flags.js +8 -4
  236. package/dist/frameworks.d.ts +27 -0
  237. package/dist/frameworks.js +28 -0
  238. package/dist/translations.js +13 -1
  239. package/package.json +5 -1
@@ -0,0 +1,109 @@
1
+ import { TelemetryProvider, } from '../affine-shared/services/index.js';
2
+ import { nanoid, Text } from '../store/index.js';
3
+ import { DatabaseDataSourceProvider } from './service/index.js';
4
+ /**
5
+ * A view of a host database inserted into a document (ADR 0035 §5, §9c,
6
+ * issue B12): an `affine:database` block whose `externalSourceId` is the
7
+ * database the host listed and whose one view reads the chosen source
8
+ * (`sourceId`). No new prop, no new flavour: the shape every hosted database
9
+ * already has (labre ADR-0046 §3).
10
+ *
11
+ * The view's preset data comes from the preset's own `defaultData`, computed
12
+ * over the host's data source with the new view current, so a board groups by
13
+ * a property of the source it reads. One gesture, one undo step: the block
14
+ * and its view are written without a `captureSync` between them.
15
+ *
16
+ * Returns the new block's id, or `null` when nothing was written (read-only
17
+ * document, the anchor gone, no host data source).
18
+ */
19
+ export function insertLinkedDatabaseView(std, options) {
20
+ const { store } = std;
21
+ if (store.readonly)
22
+ return null;
23
+ const { after, database, sourceId, viewType } = options;
24
+ if (!store.getBlock(after.id))
25
+ return null;
26
+ const provider = std.getOptional(DatabaseDataSourceProvider);
27
+ if (!provider)
28
+ return null;
29
+ store.captureSync();
30
+ const viewId = nanoid();
31
+ const [blockId] = store.addSiblingBlocks(after, [
32
+ {
33
+ flavour: 'affine:database',
34
+ externalSourceId: database.id,
35
+ title: new Text(database.title),
36
+ views: [{ id: viewId, name: '', mode: viewType, sourceId }],
37
+ },
38
+ ], 'after');
39
+ const model = blockId
40
+ ? store.getBlock(blockId)?.model
41
+ : undefined;
42
+ if (!blockId || !model)
43
+ return null;
44
+ const dataSource = provider.createDataSource(model);
45
+ try {
46
+ dataSource.viewManager.setCurrentView(viewId);
47
+ const view = {
48
+ ...defaultViewData(dataSource, viewType),
49
+ id: viewId,
50
+ sourceId,
51
+ };
52
+ store.transact(() => {
53
+ model.props.views = [view];
54
+ });
55
+ }
56
+ finally {
57
+ dataSource.dispose();
58
+ }
59
+ if (options.removeEmptyLine && after.text?.length === 0) {
60
+ store.deleteBlock(after);
61
+ }
62
+ std.getOptional(TelemetryProvider)?.track('BlockCreated', {
63
+ blockType: 'affine:database',
64
+ });
65
+ return blockId;
66
+ }
67
+ /**
68
+ * A preset's default view data over `dataSource`, named and typed. A preset
69
+ * that cannot build one over this source (a board with no property to group
70
+ * by, the case of every freshly created host database) gives a table: the
71
+ * view still lands and the user turns it into a board once a property exists.
72
+ */
73
+ function defaultViewData(dataSource, viewType) {
74
+ for (const type of [viewType, 'table']) {
75
+ try {
76
+ const meta = dataSource.viewMetaGet(type);
77
+ return {
78
+ ...meta.model.defaultData(dataSource.viewManager),
79
+ name: meta.model.defaultName,
80
+ mode: type,
81
+ };
82
+ }
83
+ catch {
84
+ continue;
85
+ }
86
+ }
87
+ return { name: '', mode: 'table' };
88
+ }
89
+ /**
90
+ * The creating slash entries once the host fills the picker (ADR 0035 §5):
91
+ * ask the host for a new database, then insert a view of its first source
92
+ * after `after`. Nothing is written until the host answers; `null`, or a
93
+ * database with no source, writes nothing.
94
+ */
95
+ export function createHostedDatabaseView(std, picker, options) {
96
+ const create = picker.createDatabase;
97
+ if (!create || std.store.readonly)
98
+ return Promise.resolve(null);
99
+ return create.call(picker).then(database => {
100
+ const source = database?.sources[0];
101
+ if (!database || !source)
102
+ return null;
103
+ return insertLinkedDatabaseView(std, {
104
+ ...options,
105
+ database,
106
+ sourceId: source.id,
107
+ });
108
+ });
109
+ }
@@ -1,4 +1,6 @@
1
1
  export * from './converts.js';
2
+ export { hostedTextColumnConfig } from './text/hosted.js';
3
+ export { hostedTitleColumnConfig } from './title/hosted.js';
2
4
  export declare const databaseBlockProperties: {
3
5
  checkboxColumnConfig: import("../index.js").PropertyMetaConfig<"checkbox", {}, boolean, boolean>;
4
6
  dateColumnConfig: import("../index.js").PropertyMetaConfig<"date", {}, number | null, number | null>;
@@ -4,6 +4,8 @@ import { linkColumnConfig } from './link/cell-renderer.js';
4
4
  import { richTextColumnConfig } from './rich-text/cell-renderer.js';
5
5
  import { titleColumnConfig } from './title/cell-renderer.js';
6
6
  export * from './converts.js';
7
+ export { hostedTextColumnConfig } from './text/hosted.js';
8
+ export { hostedTitleColumnConfig } from './title/hosted.js';
7
9
  const { checkboxPropertyConfig, datePropertyConfig, multiSelectPropertyConfig, numberPropertyConfig, progressPropertyConfig, selectPropertyConfig, } = propertyPresets;
8
10
  export const databaseBlockProperties = {
9
11
  checkboxColumnConfig: checkboxPropertyConfig,
@@ -0,0 +1,15 @@
1
+ import type { PropertyMetaConfig } from '../../../data-view/index.js';
2
+ /**
3
+ * The text column of a hosted source whose values are plain JSON (ADR 0035
4
+ * amendment of 2026-10-14): data-view's plain-text preset, type `text`, value
5
+ * a string, drawn and edited by the table's plain-text cell (no second
6
+ * drawing), offered by "+ property" and "Type".
7
+ *
8
+ * The preset itself stays `hide: true` and out of `databaseBlockProperties`:
9
+ * the inline database's Text is `rich-text` (a `Text` per cell), and offering
10
+ * both would put two "Text" types in its menus and let it store a column type
11
+ * a 0.48 client does not draw. Only a source that lists this meta in its
12
+ * `getPropertyMetas` and answers it from `propertyMetaGet('text')` offers it.
13
+ * Named as the inline Text column: one wording for one notion.
14
+ */
15
+ export declare const hostedTextColumnConfig: PropertyMetaConfig;
@@ -0,0 +1,24 @@
1
+ import { propertyPresets } from '../../../data-view/property-presets/index.js';
2
+ import { richTextPropertyModelConfig } from '../rich-text/define.js';
3
+ const { textPropertyConfig } = propertyPresets;
4
+ /**
5
+ * The text column of a hosted source whose values are plain JSON (ADR 0035
6
+ * amendment of 2026-10-14): data-view's plain-text preset, type `text`, value
7
+ * a string, drawn and edited by the table's plain-text cell (no second
8
+ * drawing), offered by "+ property" and "Type".
9
+ *
10
+ * The preset itself stays `hide: true` and out of `databaseBlockProperties`:
11
+ * the inline database's Text is `rich-text` (a `Text` per cell), and offering
12
+ * both would put two "Text" types in its menus and let it store a column type
13
+ * a 0.48 client does not draw. Only a source that lists this meta in its
14
+ * `getPropertyMetas` and answers it from `propertyMetaGet('text')` offers it.
15
+ * Named as the inline Text column: one wording for one notion.
16
+ */
17
+ export const hostedTextColumnConfig = {
18
+ ...textPropertyConfig,
19
+ config: {
20
+ ...textPropertyConfig.config,
21
+ name: richTextPropertyModelConfig.config.name,
22
+ hide: false,
23
+ },
24
+ };
@@ -0,0 +1,16 @@
1
+ import { type PropertyMetaConfig } from '../../../data-view/index.js';
2
+ /**
3
+ * The title column of a hosted source whose rows are documents (ADR 0035
4
+ * §9f, issue B15): the row's title as a plain string from the source's own
5
+ * store, so drawing a base never loads a row's document.
6
+ *
7
+ * The same `title` type as the inline title column, so a stored column, a
8
+ * view's `header.titleColumn` and the fixed-property rules read it unchanged;
9
+ * only its value is a string instead of the row block's `Text`. Drawn and
10
+ * edited by data-view's plain-text cell, the table's own (no second drawing);
11
+ * a committed edit reaches the source's `cellValueChange` as a string, and the
12
+ * source writes it to its store. A source answers it from `propertyMetaGet`
13
+ * when `rowsAreDocuments` (`HostedDataSourceBase`).
14
+ */
15
+ export declare const hostedTitlePropertyModelConfig: import("../../index.js").PropertyModel<"title", {}, string, string>;
16
+ export declare const hostedTitleColumnConfig: PropertyMetaConfig;
@@ -0,0 +1,42 @@
1
+ import { createIcon, t } from '../../../data-view/index.js';
2
+ import { propertyPresets } from '../../../data-view/property-presets/index.js';
3
+ import zod from 'zod';
4
+ import { titleColumnType, titlePropertyModelConfig } from './define.js';
5
+ /**
6
+ * The title column of a hosted source whose rows are documents (ADR 0035
7
+ * §9f, issue B15): the row's title as a plain string from the source's own
8
+ * store, so drawing a base never loads a row's document.
9
+ *
10
+ * The same `title` type as the inline title column, so a stored column, a
11
+ * view's `header.titleColumn` and the fixed-property rules read it unchanged;
12
+ * only its value is a string instead of the row block's `Text`. Drawn and
13
+ * edited by data-view's plain-text cell, the table's own (no second drawing);
14
+ * a committed edit reaches the source's `cellValueChange` as a string, and the
15
+ * source writes it to its store. A source answers it from `propertyMetaGet`
16
+ * when `rowsAreDocuments` (`HostedDataSourceBase`).
17
+ */
18
+ export const hostedTitlePropertyModelConfig = titleColumnType.modelConfig({
19
+ // One wording and one data shape with the inline title column.
20
+ name: titlePropertyModelConfig.config.name,
21
+ propertyData: titlePropertyModelConfig.config.propertyData,
22
+ jsonValue: {
23
+ schema: zod.string(),
24
+ type: () => t.string.instance(),
25
+ isEmpty: ({ value }) => !value,
26
+ },
27
+ rawValue: {
28
+ schema: zod.string(),
29
+ default: () => '',
30
+ toString: ({ value }) => value ?? '',
31
+ fromString: ({ value }) => ({ value }),
32
+ toJson: ({ value }) => value ?? '',
33
+ fromJson: ({ value }) => value,
34
+ },
35
+ fixed: titlePropertyModelConfig.config.fixed,
36
+ });
37
+ // Typed as the meta a source's `propertyMetaGet` returns, so a host returns
38
+ // it as is.
39
+ export const hostedTitleColumnConfig = hostedTitlePropertyModelConfig.createPropertyMeta({
40
+ icon: createIcon('TitleIcon'),
41
+ cellRenderer: propertyPresets.textPropertyConfig.renderer.cellRenderer,
42
+ });
@@ -14,3 +14,6 @@ export interface DatabaseDataSourceProvider {
14
14
  createDataSource(model: DatabaseBlockModel, init?: (ds: DataSourceBase) => void): DataSourceBase;
15
15
  }
16
16
  export declare const DatabaseDataSourceProvider: import("../../global/di/types.js").ServiceIdentifier<DatabaseDataSourceProvider> & (<U extends DatabaseDataSourceProvider = DatabaseDataSourceProvider>(variant: import("../../global/di/types.js").ServiceVariant) => import("../../global/di/types.js").ServiceIdentifier<U>);
17
+ export * from './open-row.js';
18
+ export * from './properties-panel.js';
19
+ export * from './new-row-menu.js';
@@ -1,3 +1,6 @@
1
1
  import { createIdentifier } from '../../global/di/index.js';
2
2
  export const DatabaseBlockConfigService = createIdentifier('AffineDatabaseBlockConfigService');
3
3
  export const DatabaseDataSourceProvider = createIdentifier('affine:database-data-source-provider');
4
+ export * from './open-row.js';
5
+ export * from './properties-panel.js';
6
+ export * from './new-row-menu.js';
@@ -0,0 +1,49 @@
1
+ import type { ExtensionType } from '../../store/index.js';
2
+ /**
3
+ * What a database asks the host to open beside its "New" button (ADR 0035
4
+ * amendment of 2026-10-14, labre PRD REQ-DB-6, 14 and 15):
5
+ *
6
+ * - `anchor`: the chevron the menu hangs from;
7
+ * - `blockId`: the `affine:database` block that hosts the view, so the host
8
+ * can tell a base's own page from an inline view of it;
9
+ * - `viewId`: the view the gesture came from.
10
+ *
11
+ * Only widens: a new field is optional.
12
+ */
13
+ export interface DatabaseNewRowMenuRequest {
14
+ anchor: HTMLElement;
15
+ blockId: string;
16
+ viewId: string;
17
+ }
18
+ /**
19
+ * The host's menu of ways to add a row (its templates, a default to pick):
20
+ * the library draws the chevron and asks, the host draws the menu and does
21
+ * the work. The main part of "New" never reaches it: it adds a row through
22
+ * the source's `rowAdd`, as without the seam, which is where a host applies
23
+ * its default template.
24
+ */
25
+ export interface DatabaseNewRowMenuService {
26
+ open(request: DatabaseNewRowMenuRequest): void;
27
+ /**
28
+ * Whether this block and view have a menu to open (a base's own page
29
+ * does, an inline table of it may not). Asked each time "New" renders, so
30
+ * the answer may change; answer from what you already hold, it runs on
31
+ * every render. Absent, every view has one, as in the first release of
32
+ * the seam. `false` draws the single "New" of 0.48.
33
+ */
34
+ canOpen?(request: DatabaseNewRowMenuTarget): boolean;
35
+ }
36
+ /** Which "New" asks: the request without its anchor, not drawn yet. */
37
+ export type DatabaseNewRowMenuTarget = Omit<DatabaseNewRowMenuRequest, 'anchor'>;
38
+ export declare const DatabaseNewRowMenuProvider: import("../../global/di/types.js").ServiceIdentifier<DatabaseNewRowMenuService> & (<U extends DatabaseNewRowMenuService = DatabaseNewRowMenuService>(variant: import("../../global/di/types.js").ServiceVariant) => import("../../global/di/types.js").ServiceIdentifier<U>);
39
+ /**
40
+ * Host seam: the host opens a menu beside every view's "New", or `null` to
41
+ * say it does not.
42
+ *
43
+ * Absent or `null`, "New" is the single button of 0.48 in every view (table,
44
+ * kanban, gallery, list, calendar) and on the full page: no chevron.
45
+ *
46
+ * `di.override`, so a later registration wins and registering twice never
47
+ * throws at boot.
48
+ */
49
+ export declare function DatabaseNewRowMenuExtension(service: DatabaseNewRowMenuService | null): ExtensionType;
@@ -0,0 +1,21 @@
1
+ import { createIdentifier } from '../../global/di/index.js';
2
+ export const DatabaseNewRowMenuProvider = createIdentifier('LabreDatabaseNewRowMenu');
3
+ /**
4
+ * Host seam: the host opens a menu beside every view's "New", or `null` to
5
+ * say it does not.
6
+ *
7
+ * Absent or `null`, "New" is the single button of 0.48 in every view (table,
8
+ * kanban, gallery, list, calendar) and on the full page: no chevron.
9
+ *
10
+ * `di.override`, so a later registration wins and registering twice never
11
+ * throws at boot.
12
+ */
13
+ export function DatabaseNewRowMenuExtension(service) {
14
+ return {
15
+ setup: di => {
16
+ // `null` rides through on purpose: `getOptional` then reports no menu
17
+ // and "New" draws no chevron.
18
+ di.override(DatabaseNewRowMenuProvider, () => service);
19
+ },
20
+ };
21
+ }
@@ -0,0 +1,77 @@
1
+ import { type DatabaseViewOpenIn } from '../../affine-model/index.js';
2
+ import type { ExtensionType } from '../../store/index.js';
3
+ /**
4
+ * What a database asks the host to open (ADR 0035 §9a, issue B9).
5
+ *
6
+ * - `docId`: the row, which is a document: the seam is only read when the
7
+ * source says its rows are documents (`rowsAreDocuments`), and such a
8
+ * source's row id IS the document id.
9
+ * - `mode`: the view's stored `openIn`, `side` when absent (ADR 0035 §8);
10
+ * a Ctrl/Cmd click sends `full`.
11
+ * - `newTab`: `true` for a Ctrl/Cmd click, which also sends `full`.
12
+ * - `viewId` and `blockId`: the view the row was opened from and the
13
+ * `affine:database` block that hosts it, so the host can tell a base's
14
+ * own page from an inline view of it.
15
+ *
16
+ * Only widens: a new field is optional.
17
+ */
18
+ export interface DatabaseOpenRowRequest {
19
+ docId: string;
20
+ mode: DatabaseViewOpenIn;
21
+ newTab: boolean;
22
+ viewId: string;
23
+ blockId: string;
24
+ }
25
+ /**
26
+ * The host's way of opening a database row that is a document (ADR 0035
27
+ * §9a): a side preview, a centred window or the full page, as the view's
28
+ * "Open pages in" says. The library keeps no "is it open" state and draws
29
+ * nothing for the row itself: the host routes, the library asks.
30
+ */
31
+ export interface DatabaseOpenRowService {
32
+ open(request: DatabaseOpenRowRequest): void;
33
+ }
34
+ export declare const DatabaseOpenRowProvider: import("../../global/di/types.js").ServiceIdentifier<DatabaseOpenRowService> & (<U extends DatabaseOpenRowService = DatabaseOpenRowService>(variant: import("../../global/di/types.js").ServiceVariant) => import("../../global/di/types.js").ServiceIdentifier<U>);
35
+ /**
36
+ * Host seam: the host opens database rows, or `null` to say it does not.
37
+ *
38
+ * Absent or `null`, a row opens through the peek view (or the side detail
39
+ * without one), exactly as in 0.48, and the view's `openIn` has no effect. A
40
+ * row that is a block (an inline database) always takes that path: there is
41
+ * no document to open.
42
+ *
43
+ * `di.override`, so a later registration wins and registering twice never
44
+ * throws at boot.
45
+ */
46
+ export declare function DatabaseOpenRowExtension(service: DatabaseOpenRowService | null): ExtensionType;
47
+ /**
48
+ * The request for one row-open gesture, or `null` when the host does not
49
+ * open this row (no opener, or rows that are blocks): the one rule every
50
+ * view goes through, since every preset opens a row with
51
+ * `DataViewRootUILogic.openDetailPanel`, which lands in the database block.
52
+ */
53
+ export declare function databaseOpenRowRequest(input: {
54
+ hasOpener: boolean;
55
+ rowsAreDocuments: boolean;
56
+ rowId: string;
57
+ viewId: string;
58
+ blockId: string;
59
+ /** The view's stored `openIn`, read as stored: unknown values too. */
60
+ openIn: unknown;
61
+ newTab?: boolean;
62
+ }): DatabaseOpenRowRequest | null;
63
+ /**
64
+ * `DatabaseRowOpened` for one row-open gesture (telemetry README,
65
+ * "Databases"): the mode the row opens in, the host's when it opens it,
66
+ * `side` for the library's own peek or detail; ids only, never the row.
67
+ */
68
+ export declare function rowOpenedParams(request: DatabaseOpenRowRequest | null, rowsAreDocuments: boolean, newTab: boolean | undefined): {
69
+ mode: DatabaseViewOpenIn;
70
+ newTab: boolean;
71
+ rowKind: 'document' | 'block';
72
+ };
73
+ /**
74
+ * A stored `openIn` as this client reads it: absent, or a value appended by a
75
+ * later client, reads `side` (append-only, ADR 0035 §8).
76
+ */
77
+ export declare function openInOf(stored: unknown): DatabaseViewOpenIn;
@@ -0,0 +1,62 @@
1
+ import { DATABASE_VIEW_OPEN_IN, } from '../../affine-model/index.js';
2
+ import { createIdentifier } from '../../global/di/index.js';
3
+ export const DatabaseOpenRowProvider = createIdentifier('LabreDatabaseOpenRow');
4
+ /**
5
+ * Host seam: the host opens database rows, or `null` to say it does not.
6
+ *
7
+ * Absent or `null`, a row opens through the peek view (or the side detail
8
+ * without one), exactly as in 0.48, and the view's `openIn` has no effect. A
9
+ * row that is a block (an inline database) always takes that path: there is
10
+ * no document to open.
11
+ *
12
+ * `di.override`, so a later registration wins and registering twice never
13
+ * throws at boot.
14
+ */
15
+ export function DatabaseOpenRowExtension(service) {
16
+ return {
17
+ setup: di => {
18
+ // `null` rides through on purpose: `getOptional` then reports no
19
+ // opener and the row keeps the library's own detail panel.
20
+ di.override(DatabaseOpenRowProvider, () => service);
21
+ },
22
+ };
23
+ }
24
+ /**
25
+ * The request for one row-open gesture, or `null` when the host does not
26
+ * open this row (no opener, or rows that are blocks): the one rule every
27
+ * view goes through, since every preset opens a row with
28
+ * `DataViewRootUILogic.openDetailPanel`, which lands in the database block.
29
+ */
30
+ export function databaseOpenRowRequest(input) {
31
+ if (!input.hasOpener || !input.rowsAreDocuments)
32
+ return null;
33
+ const newTab = input.newTab === true;
34
+ return {
35
+ docId: input.rowId,
36
+ mode: newTab ? 'full' : openInOf(input.openIn),
37
+ newTab,
38
+ viewId: input.viewId,
39
+ blockId: input.blockId,
40
+ };
41
+ }
42
+ /**
43
+ * `DatabaseRowOpened` for one row-open gesture (telemetry README,
44
+ * "Databases"): the mode the row opens in, the host's when it opens it,
45
+ * `side` for the library's own peek or detail; ids only, never the row.
46
+ */
47
+ export function rowOpenedParams(request, rowsAreDocuments, newTab) {
48
+ return {
49
+ mode: request?.mode ?? 'side',
50
+ newTab: newTab === true,
51
+ rowKind: rowsAreDocuments ? 'document' : 'block',
52
+ };
53
+ }
54
+ /**
55
+ * A stored `openIn` as this client reads it: absent, or a value appended by a
56
+ * later client, reads `side` (append-only, ADR 0035 §8).
57
+ */
58
+ export function openInOf(stored) {
59
+ return DATABASE_VIEW_OPEN_IN.includes(stored)
60
+ ? stored
61
+ : 'side';
62
+ }
@@ -0,0 +1,23 @@
1
+ import type { DatabaseBlockModel } from '../../affine-model/index.js';
2
+ import { type PropertiesPanelRequest } from '../../affine-shared/services/index.js';
3
+ import type { BlockStdScope } from '../../std/index.js';
4
+ export type DatabasePropertiesPanelRequest = Extract<PropertiesPanelRequest, {
5
+ scope: 'source';
6
+ }>;
7
+ /**
8
+ * The properties panel's request for one view of a database (ADR 0035 §9b,
9
+ * issue B10): the document and the block that host the view, the view, and
10
+ * the source it reads. A view with no stored `sourceId` reads the block's
11
+ * implicit source, named here by the block's own id: the host that resolves
12
+ * sources reads it as "the view's default source", any other host as the
13
+ * block itself.
14
+ */
15
+ export declare function databasePropertiesPanelRequest(model: DatabaseBlockModel, viewId: string): DatabasePropertiesPanelRequest;
16
+ /**
17
+ * Open the host's properties panel on a view of `model`: the call the view
18
+ * options' "Properties" makes, and the one the view bar and the view settings
19
+ * of `@labre/affine-database-editor` make. `false` when the host has no panel
20
+ * (`PropertiesPanelExtension` absent or `null`): the caller then keeps the
21
+ * data-view's own properties popover.
22
+ */
23
+ export declare function openDatabasePropertiesPanel(std: BlockStdScope, model: DatabaseBlockModel, viewId: string): boolean;
@@ -0,0 +1,33 @@
1
+ import { PropertiesPanelProvider, } from '../../affine-shared/services/index.js';
2
+ /**
3
+ * The properties panel's request for one view of a database (ADR 0035 §9b,
4
+ * issue B10): the document and the block that host the view, the view, and
5
+ * the source it reads. A view with no stored `sourceId` reads the block's
6
+ * implicit source, named here by the block's own id: the host that resolves
7
+ * sources reads it as "the view's default source", any other host as the
8
+ * block itself.
9
+ */
10
+ export function databasePropertiesPanelRequest(model, viewId) {
11
+ const view = model.props.views.find(v => v.id === viewId);
12
+ return {
13
+ scope: 'source',
14
+ docId: model.store.id,
15
+ blockId: model.id,
16
+ sourceId: view?.sourceId ?? model.id,
17
+ viewId,
18
+ };
19
+ }
20
+ /**
21
+ * Open the host's properties panel on a view of `model`: the call the view
22
+ * options' "Properties" makes, and the one the view bar and the view settings
23
+ * of `@labre/affine-database-editor` make. `false` when the host has no panel
24
+ * (`PropertiesPanelExtension` absent or `null`): the caller then keeps the
25
+ * data-view's own properties popover.
26
+ */
27
+ export function openDatabasePropertiesPanel(std, model, viewId) {
28
+ const panel = std.getOptional(PropertiesPanelProvider);
29
+ if (!panel)
30
+ return false;
31
+ panel.open(databasePropertiesPanelRequest(model, viewId));
32
+ return true;
33
+ }
@@ -0,0 +1,10 @@
1
+ import type { ChromeWording } from '../affine-shared/services/index.js';
2
+ /** Drawn in place of a view whose `sourceId` the host cannot resolve. */
3
+ export declare const DATABASE_SOURCE_MISSING: ChromeWording;
4
+ export declare const DATABASE_SOURCE_MISSING_HINT: ChromeWording;
5
+ /** After 3 s of loading (`VALUES_SLOW_AFTER_MS`). */
6
+ export declare const DATABASE_VALUES_LOADING: ChromeWording;
7
+ export declare const DATABASE_VALUES_ERROR: ChromeWording;
8
+ /** The chevron beside "New", as its label and tooltip. */
9
+ export declare const DATABASE_NEW_RECORD_MORE: ChromeWording;
10
+ export declare const DATABASE_WORDINGS: readonly ChromeWording[];
@@ -0,0 +1,35 @@
1
+ /* ── A hosted source (ADR 0035 §7, issue B1) ───────────────────────────── */
2
+ /** Drawn in place of a view whose `sourceId` the host cannot resolve. */
3
+ export const DATABASE_SOURCE_MISSING = [
4
+ 'com.labre.database.source-missing',
5
+ 'Source not found',
6
+ ];
7
+ export const DATABASE_SOURCE_MISSING_HINT = [
8
+ 'com.labre.database.source-missing.hint',
9
+ 'The source this view reads was deleted or cannot be reached. Pick another view.',
10
+ ];
11
+ /* ── Cell hydration (ADR 0035 §9e, issue B2) ───────────────────────────── */
12
+ /** After 3 s of loading (`VALUES_SLOW_AFTER_MS`). */
13
+ export const DATABASE_VALUES_LOADING = [
14
+ 'com.labre.database.values.loading',
15
+ 'Values are still loading…',
16
+ ];
17
+ export const DATABASE_VALUES_ERROR = [
18
+ 'com.labre.database.values.error',
19
+ 'Values could not be loaded. Nothing was changed.',
20
+ ];
21
+ // Retry is the resource status's own word (`RESOURCE_STATUS_RETRY`,
22
+ // `@labre/affine-components/translations`): one chrome word, one key.
23
+ /* ── The host menu beside "New" (ADR 0035, amendment of 2026-10-14) ──── */
24
+ /** The chevron beside "New", as its label and tooltip. */
25
+ export const DATABASE_NEW_RECORD_MORE = [
26
+ 'com.labre.database.new-record.more',
27
+ 'Templates and options',
28
+ ];
29
+ export const DATABASE_WORDINGS = [
30
+ DATABASE_NEW_RECORD_MORE,
31
+ DATABASE_SOURCE_MISSING,
32
+ DATABASE_SOURCE_MISSING_HINT,
33
+ DATABASE_VALUES_ERROR,
34
+ DATABASE_VALUES_LOADING,
35
+ ];
@@ -0,0 +1,10 @@
1
+ import type { ExtensionType } from '../store/index.js';
2
+ /**
3
+ * Registered by `DatabaseViewExtension` only (`./view.ts`): its presence says
4
+ * the `database` tooling is on, so a rendered database offers "+ view". The
5
+ * block reads it when it builds its data source and, absent, sets data-view's
6
+ * `ViewCreationOffKey` on it (ADR 0035 §5). Its own file so the block reads it
7
+ * without importing the view extensions, which import the block.
8
+ */
9
+ export declare const DatabaseViewCreationIdentifier: import("../global/di/types.js").ServiceIdentifier<true> & (<U extends true = true>(variant: import("../global/di/types.js").ServiceVariant) => import("../global/di/types.js").ServiceIdentifier<U>);
10
+ export declare const DatabaseViewCreationExtension: ExtensionType;
@@ -0,0 +1,14 @@
1
+ import { createIdentifier } from '../global/di/index.js';
2
+ /**
3
+ * Registered by `DatabaseViewExtension` only (`./view.ts`): its presence says
4
+ * the `database` tooling is on, so a rendered database offers "+ view". The
5
+ * block reads it when it builds its data source and, absent, sets data-view's
6
+ * `ViewCreationOffKey` on it (ADR 0035 §5). Its own file so the block reads it
7
+ * without importing the view extensions, which import the block.
8
+ */
9
+ export const DatabaseViewCreationIdentifier = createIdentifier('AffineDatabaseViewCreation');
10
+ export const DatabaseViewCreationExtension = {
11
+ setup: di => {
12
+ di.override(DatabaseViewCreationIdentifier, () => true);
13
+ },
14
+ };
@@ -10,6 +10,37 @@ declare const optionsSchema: z.ZodObject<{
10
10
  configure: (args_0: DatabaseBlockModel, args_1: MenuOptions, ...args: unknown[]) => MenuOptions;
11
11
  }>;
12
12
  export type DatabaseViewExtensionOptions = z.infer<typeof optionsSchema>;
13
+ /**
14
+ * Database rendering — ALWAYS registered, independent of the `database` and
15
+ * `data-view` flags (ADR 0009, ADR 0035 §5, issue B4). A document that holds a
16
+ * database must show it, let its cells be edited and its rows be opened
17
+ * whatever the flags say: until 0.48 the whole view sat behind `database`, and
18
+ * `{ database: false }` left every stored database rendered as nothing.
19
+ *
20
+ * What lives here is what an EXISTING database needs, the mirror of
21
+ * `CalloutRenderViewExtension`:
22
+ * - `effects()` whole: every element it defines draws a stored database (the
23
+ * block, its title, the cells, the row detail and its peek);
24
+ * - the flavour and the block view, the lookup `lit-host` performs; the block
25
+ * brings the presets, the cells and the row opening with it;
26
+ * - the link cell for the title band (ADR 0035 §11): a `link` value already
27
+ * stored on a page is drawn with it.
28
+ */
29
+ export declare class DatabaseRenderViewExtension extends ViewExtensionProvider {
30
+ name: string;
31
+ effect(): void;
32
+ setup(context: ViewExtensionContext): void;
33
+ }
34
+ /**
35
+ * Database creation tooling — flag-gated (`database`, ADR 0009, ADR 0035 §5):
36
+ * the slash-menu entries that insert a database, the "+ view" of a rendered
37
+ * one (`DatabaseViewCreationIdentifier`, `./view-creation.ts`), and the host's additions to
38
+ * the block's "⋯" menu (`configure`, kept on this class so a host's
39
+ * `viewManager.configure(DatabaseViewExtension, …)` still compiles and its
40
+ * entries follow the flag). With the flag off no database and no view can be
41
+ * made; the stored ones keep rendering through
42
+ * {@link DatabaseRenderViewExtension}.
43
+ */
13
44
  export declare class DatabaseViewExtension extends ViewExtensionProvider<DatabaseViewExtensionOptions> {
14
45
  name: string;
15
46
  schema: z.ZodObject<{
@@ -19,7 +50,6 @@ export declare class DatabaseViewExtension extends ViewExtensionProvider<Databas
19
50
  }, {
20
51
  configure: (args_0: DatabaseBlockModel, args_1: MenuOptions, ...args: unknown[]) => MenuOptions;
21
52
  }>;
22
- effect(): void;
23
53
  setup(context: ViewExtensionContext, options?: DatabaseViewExtensionOptions): void;
24
54
  }
25
55
  export {};