@formicoidea/labre-core 0.48.0 → 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 (222) 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 +44 -5
  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-components/date-picker/date-picker.d.ts +20 -0
  46. package/dist/_pkgs/affine-components/date-picker/date-picker.js +60 -26
  47. package/dist/_pkgs/affine-components/date-picker/style.js +1 -0
  48. package/dist/_pkgs/affine-components/translations.d.ts +4 -0
  49. package/dist/_pkgs/affine-components/translations.js +26 -0
  50. package/dist/_pkgs/affine-fragment-doc-title/doc-title.d.ts +18 -0
  51. package/dist/_pkgs/affine-fragment-doc-title/doc-title.js +41 -2
  52. package/dist/_pkgs/affine-fragment-doc-title/title-band/band-cell.d.ts +8 -0
  53. package/dist/_pkgs/affine-fragment-doc-title/title-band/band-cell.js +12 -0
  54. package/dist/_pkgs/affine-fragment-doc-title/title-band/title-band.d.ts +5 -0
  55. package/dist/_pkgs/affine-fragment-doc-title/title-band/title-band.js +44 -4
  56. package/dist/_pkgs/affine-model/blocks/database/types.d.ts +16 -0
  57. package/dist/_pkgs/affine-model/blocks/database/types.js +5 -1
  58. package/dist/_pkgs/affine-shared/services/data-source-picker-service.d.ts +139 -0
  59. package/dist/_pkgs/affine-shared/services/data-source-picker-service.js +22 -0
  60. package/dist/_pkgs/affine-shared/services/index.d.ts +1 -0
  61. package/dist/_pkgs/affine-shared/services/index.js +1 -0
  62. package/dist/_pkgs/affine-shared/services/telemetry-service/database.d.ts +59 -0
  63. package/dist/_pkgs/affine-shared/services/title-band-service.d.ts +24 -0
  64. package/dist/_pkgs/data-view/core/component/cell-status/cell-status-css.d.ts +2 -0
  65. package/dist/_pkgs/data-view/core/component/cell-status/cell-status-css.js +16 -0
  66. package/dist/_pkgs/data-view/core/component/cell-status/cell-status.d.ts +10 -0
  67. package/dist/_pkgs/data-view/core/component/cell-status/cell-status.js +23 -0
  68. package/dist/_pkgs/data-view/core/component/index.d.ts +1 -0
  69. package/dist/_pkgs/data-view/core/component/index.js +1 -0
  70. package/dist/_pkgs/data-view/core/component/overflow/fit.d.ts +26 -0
  71. package/dist/_pkgs/data-view/core/component/overflow/fit.js +48 -0
  72. package/dist/_pkgs/data-view/core/component/overflow/overflow.d.ts +26 -3
  73. package/dist/_pkgs/data-view/core/component/overflow/overflow.js +84 -31
  74. package/dist/_pkgs/data-view/core/component/tags/colors.d.ts +7 -0
  75. package/dist/_pkgs/data-view/core/component/tags/colors.js +22 -10
  76. package/dist/_pkgs/data-view/core/component/tags/multi-tag-select.d.ts +18 -0
  77. package/dist/_pkgs/data-view/core/component/tags/multi-tag-select.js +63 -21
  78. package/dist/_pkgs/data-view/core/data-source/base.d.ts +5 -1
  79. package/dist/_pkgs/data-view/core/data-source/base.js +7 -1
  80. package/dist/_pkgs/data-view/core/data-source/hydration.d.ts +44 -0
  81. package/dist/_pkgs/data-view/core/data-source/hydration.js +31 -0
  82. package/dist/_pkgs/data-view/core/data-source/index.d.ts +1 -0
  83. package/dist/_pkgs/data-view/core/data-source/index.js +1 -0
  84. package/dist/_pkgs/data-view/core/data-view.d.ts +22 -2
  85. package/dist/_pkgs/data-view/core/data-view.js +14 -0
  86. package/dist/_pkgs/data-view/core/effect.js +2 -0
  87. package/dist/_pkgs/data-view/core/group-by/collapsed-state.d.ts +3 -0
  88. package/dist/_pkgs/data-view/core/group-by/collapsed-state.js +59 -0
  89. package/dist/_pkgs/data-view/core/group-by/group-properties.d.ts +21 -0
  90. package/dist/_pkgs/data-view/core/group-by/group-properties.js +38 -0
  91. package/dist/_pkgs/data-view/core/group-by/group-title.js +4 -0
  92. package/dist/_pkgs/data-view/core/group-by/group-visibility.d.ts +40 -0
  93. package/dist/_pkgs/data-view/core/group-by/group-visibility.js +291 -0
  94. package/dist/_pkgs/data-view/core/group-by/setting.d.ts +11 -3
  95. package/dist/_pkgs/data-view/core/group-by/setting.js +81 -8
  96. package/dist/_pkgs/data-view/core/group-by/trait.d.ts +22 -0
  97. package/dist/_pkgs/data-view/core/group-by/trait.js +62 -1
  98. package/dist/_pkgs/data-view/core/index.d.ts +3 -0
  99. package/dist/_pkgs/data-view/core/index.js +3 -0
  100. package/dist/_pkgs/data-view/core/property/base-cell.d.ts +15 -1
  101. package/dist/_pkgs/data-view/core/property/base-cell.js +28 -3
  102. package/dist/_pkgs/data-view/core/property/standalone-cell.d.ts +15 -1
  103. package/dist/_pkgs/data-view/core/property/standalone-cell.js +19 -1
  104. package/dist/_pkgs/data-view/core/telemetry.d.ts +16 -0
  105. package/dist/_pkgs/data-view/core/telemetry.js +22 -0
  106. package/dist/_pkgs/data-view/core/utils/new-tab-click.d.ts +2 -0
  107. package/dist/_pkgs/data-view/core/utils/new-tab-click.js +4 -0
  108. package/dist/_pkgs/data-view/core/utils/wording.d.ts +11 -0
  109. package/dist/_pkgs/data-view/core/utils/wording.js +9 -0
  110. package/dist/_pkgs/data-view/core/view/data-view.d.ts +7 -0
  111. package/dist/_pkgs/data-view/core/view/default-name.d.ts +10 -0
  112. package/dist/_pkgs/data-view/core/view/default-name.js +14 -0
  113. package/dist/_pkgs/data-view/core/view/index.d.ts +2 -0
  114. package/dist/_pkgs/data-view/core/view/index.js +2 -0
  115. package/dist/_pkgs/data-view/core/view/open-in.d.ts +27 -0
  116. package/dist/_pkgs/data-view/core/view/open-in.js +39 -0
  117. package/dist/_pkgs/data-view/core/view-manager/cell.d.ts +5 -0
  118. package/dist/_pkgs/data-view/core/view-manager/cell.js +11 -0
  119. package/dist/_pkgs/data-view/core/view-manager/index.d.ts +3 -0
  120. package/dist/_pkgs/data-view/core/view-manager/index.js +3 -0
  121. package/dist/_pkgs/data-view/core/view-manager/new-row-menu-opener.d.ts +18 -0
  122. package/dist/_pkgs/data-view/core/view-manager/new-row-menu-opener.js +2 -0
  123. package/dist/_pkgs/data-view/core/view-manager/properties-panel-opener.d.ts +8 -0
  124. package/dist/_pkgs/data-view/core/view-manager/properties-panel-opener.js +9 -0
  125. package/dist/_pkgs/data-view/core/view-manager/property.d.ts +8 -0
  126. package/dist/_pkgs/data-view/core/view-manager/single-view.d.ts +28 -1
  127. package/dist/_pkgs/data-view/core/view-manager/single-view.js +45 -1
  128. package/dist/_pkgs/data-view/core/view-manager/view-creation.d.ts +49 -0
  129. package/dist/_pkgs/data-view/core/view-manager/view-creation.js +40 -0
  130. package/dist/_pkgs/data-view/core/view-manager/view-manager.d.ts +6 -2
  131. package/dist/_pkgs/data-view/core/view-manager/view-manager.js +2 -2
  132. package/dist/_pkgs/data-view/property-presets/date/cell-renderer.d.ts +2 -0
  133. package/dist/_pkgs/data-view/property-presets/date/cell-renderer.js +11 -2
  134. package/dist/_pkgs/data-view/property-presets/multi-select/cell-renderer.js +2 -0
  135. package/dist/_pkgs/data-view/property-presets/select/cell-renderer.js +2 -0
  136. package/dist/_pkgs/data-view/translations.d.ts +55 -0
  137. package/dist/_pkgs/data-view/translations.js +181 -0
  138. package/dist/_pkgs/data-view/view-presets/calendar/define.js +3 -1
  139. package/dist/_pkgs/data-view/view-presets/convert.js +2 -0
  140. package/dist/_pkgs/data-view/view-presets/effect.js +4 -0
  141. package/dist/_pkgs/data-view/view-presets/flat/flat-converts.d.ts +2 -0
  142. package/dist/_pkgs/data-view/view-presets/flat/flat-converts.js +35 -0
  143. package/dist/_pkgs/data-view/view-presets/flat/flat-view-manager.d.ts +79 -0
  144. package/dist/_pkgs/data-view/view-presets/flat/flat-view-manager.js +194 -0
  145. package/dist/_pkgs/data-view/view-presets/flat/flat-view-ui.d.ts +56 -0
  146. package/dist/_pkgs/data-view/view-presets/flat/flat-view-ui.js +266 -0
  147. package/dist/_pkgs/data-view/view-presets/gallery/define.d.ts +14 -0
  148. package/dist/_pkgs/data-view/view-presets/gallery/define.js +15 -0
  149. package/dist/_pkgs/data-view/view-presets/gallery/effect.d.ts +1 -0
  150. package/dist/_pkgs/data-view/view-presets/gallery/effect.js +4 -0
  151. package/dist/_pkgs/data-view/view-presets/gallery/gallery-view.d.ts +27 -0
  152. package/dist/_pkgs/data-view/view-presets/gallery/gallery-view.js +179 -0
  153. package/dist/_pkgs/data-view/view-presets/gallery/index.d.ts +2 -0
  154. package/dist/_pkgs/data-view/view-presets/gallery/index.js +2 -0
  155. package/dist/_pkgs/data-view/view-presets/gallery/renderer.d.ts +1 -0
  156. package/dist/_pkgs/data-view/view-presets/gallery/renderer.js +11 -0
  157. package/dist/_pkgs/data-view/view-presets/index.d.ts +5 -0
  158. package/dist/_pkgs/data-view/view-presets/index.js +7 -0
  159. package/dist/_pkgs/data-view/view-presets/kanban/define.js +3 -1
  160. package/dist/_pkgs/data-view/view-presets/kanban/kanban-view-manager.js +5 -53
  161. package/dist/_pkgs/data-view/view-presets/kanban/mobile/card.js +8 -1
  162. package/dist/_pkgs/data-view/view-presets/kanban/mobile/cell.js +6 -1
  163. package/dist/_pkgs/data-view/view-presets/kanban/mobile/group.d.ts +4 -2
  164. package/dist/_pkgs/data-view/view-presets/kanban/mobile/group.js +52 -6
  165. package/dist/_pkgs/data-view/view-presets/kanban/mobile/kanban-view-ui-logic.js +5 -1
  166. package/dist/_pkgs/data-view/view-presets/kanban/pc/card.js +2 -0
  167. package/dist/_pkgs/data-view/view-presets/kanban/pc/cell.js +4 -0
  168. package/dist/_pkgs/data-view/view-presets/kanban/pc/group.d.ts +4 -2
  169. package/dist/_pkgs/data-view/view-presets/kanban/pc/group.js +51 -6
  170. package/dist/_pkgs/data-view/view-presets/kanban/pc/kanban-view-ui-logic.js +5 -1
  171. package/dist/_pkgs/data-view/view-presets/list/define.d.ts +14 -0
  172. package/dist/_pkgs/data-view/view-presets/list/define.js +15 -0
  173. package/dist/_pkgs/data-view/view-presets/list/effect.d.ts +1 -0
  174. package/dist/_pkgs/data-view/view-presets/list/effect.js +4 -0
  175. package/dist/_pkgs/data-view/view-presets/list/index.d.ts +2 -0
  176. package/dist/_pkgs/data-view/view-presets/list/index.js +2 -0
  177. package/dist/_pkgs/data-view/view-presets/list/list-view.d.ts +24 -0
  178. package/dist/_pkgs/data-view/view-presets/list/list-view.js +194 -0
  179. package/dist/_pkgs/data-view/view-presets/list/renderer.d.ts +1 -0
  180. package/dist/_pkgs/data-view/view-presets/list/renderer.js +11 -0
  181. package/dist/_pkgs/data-view/view-presets/table/collapsed-state.d.ts +3 -14
  182. package/dist/_pkgs/data-view/view-presets/table/collapsed-state.js +6 -30
  183. package/dist/_pkgs/data-view/view-presets/table/consts.d.ts +2 -0
  184. package/dist/_pkgs/data-view/view-presets/table/consts.js +2 -0
  185. package/dist/_pkgs/data-view/view-presets/table/define.js +3 -1
  186. package/dist/_pkgs/data-view/view-presets/table/mobile/cell.js +4 -1
  187. package/dist/_pkgs/data-view/view-presets/table/mobile/column-header.js +2 -2
  188. package/dist/_pkgs/data-view/view-presets/table/mobile/group.d.ts +3 -1
  189. package/dist/_pkgs/data-view/view-presets/table/mobile/group.js +20 -5
  190. package/dist/_pkgs/data-view/view-presets/table/mobile/row.js +10 -2
  191. package/dist/_pkgs/data-view/view-presets/table/mobile/table-view-ui-logic.js +4 -1
  192. package/dist/_pkgs/data-view/view-presets/table/pc/cell.js +4 -1
  193. package/dist/_pkgs/data-view/view-presets/table/pc/controller/hotkeys.js +1 -1
  194. package/dist/_pkgs/data-view/view-presets/table/pc/group.d.ts +3 -1
  195. package/dist/_pkgs/data-view/view-presets/table/pc/group.js +20 -5
  196. package/dist/_pkgs/data-view/view-presets/table/pc/menu.d.ts +1 -1
  197. package/dist/_pkgs/data-view/view-presets/table/pc/menu.js +2 -1
  198. package/dist/_pkgs/data-view/view-presets/table/pc/row/row.js +3 -2
  199. package/dist/_pkgs/data-view/view-presets/table/pc/table-view-ui-logic.js +4 -1
  200. package/dist/_pkgs/data-view/view-presets/table/pc-virtual/controller/hotkeys.js +1 -1
  201. package/dist/_pkgs/data-view/view-presets/table/pc-virtual/group/bottom/stats/column-stats-column.js +5 -1
  202. package/dist/_pkgs/data-view/view-presets/table/pc-virtual/group/top/group-title.js +22 -19
  203. package/dist/_pkgs/data-view/view-presets/table/pc-virtual/row/cell.js +4 -1
  204. package/dist/_pkgs/data-view/view-presets/table/pc-virtual/table-view-ui-logic.js +7 -2
  205. package/dist/_pkgs/data-view/view-presets/table/stats/column-stats-column.js +5 -1
  206. package/dist/_pkgs/data-view/view-presets/table/table-view-manager.js +5 -53
  207. package/dist/_pkgs/data-view/widget-presets/tools/presets/table-add-row/add-row.d.ts +1 -0
  208. package/dist/_pkgs/data-view/widget-presets/tools/presets/table-add-row/add-row.js +60 -2
  209. package/dist/_pkgs/data-view/widget-presets/tools/presets/view-options/view-options.d.ts +18 -1
  210. package/dist/_pkgs/data-view/widget-presets/tools/presets/view-options/view-options.js +121 -124
  211. package/dist/_pkgs/data-view/widget-presets/tools/presets/view-options/view-settings.d.ts +43 -0
  212. package/dist/_pkgs/data-view/widget-presets/tools/presets/view-options/view-settings.js +187 -0
  213. package/dist/_pkgs/data-view/widget-presets/views-bar/views-view.d.ts +36 -3
  214. package/dist/_pkgs/data-view/widget-presets/views-bar/views-view.js +187 -59
  215. package/dist/extensions/view.d.ts +2 -2
  216. package/dist/extensions/view.js +10 -3
  217. package/dist/flags.d.ts +8 -4
  218. package/dist/flags.js +8 -4
  219. package/dist/frameworks.d.ts +27 -0
  220. package/dist/frameworks.js +28 -0
  221. package/dist/translations.js +13 -1
  222. package/package.json +5 -1
@@ -1,6 +1,7 @@
1
1
  import { FeatureFlagService } from '../../affine-shared/services/index.js';
2
2
  import { isInsideBlockByFlavour } from '../../affine-shared/utils/index.js';
3
3
  import {} from '../../affine-widget-slash-menu/index.js';
4
+ import { viewDefaultName } from '../../data-view/index.js';
4
5
  import { DatabaseTableViewIcon } from '@blocksuite/icons/lit';
5
6
  import { ToDoListTooltip } from './tooltips.js';
6
7
  export const dataViewSlashMenuConfig = {
@@ -28,7 +29,8 @@ export const dataViewSlashMenuConfig = {
28
29
  const id = host.store.addBlock('affine:data-view', {}, host.store.getParent(model), index + 1);
29
30
  const dataViewModel = host.store.getBlock(id);
30
31
  const dataView = std.view.getBlock(dataViewModel.id);
31
- dataView?.dataSource.viewManager.viewAdd('table');
32
+ const dataSource = dataView?.dataSource;
33
+ dataSource?.viewManager.viewAdd('table', viewDefaultName(dataSource.viewMetaGet('table'), std));
32
34
  if (model.text?.length === 0) {
33
35
  model.store.deleteBlock(model);
34
36
  }
@@ -1,6 +1,22 @@
1
1
  import { type ViewExtensionContext, ViewExtensionProvider } from '../affine-ext-loader/index.js';
2
- export declare class DataViewViewExtension extends ViewExtensionProvider {
2
+ /**
3
+ * Data-view block rendering — ALWAYS registered, independent of the
4
+ * `data-view` flag (ADR 0009, ADR 0035 §5, issue B4): `effects()`, the
5
+ * flavour and the block view, so a stored `affine:data-view` block draws
6
+ * whatever the flags say. Until 0.48 all of it sat behind `data-view`.
7
+ */
8
+ export declare class DataViewRenderViewExtension extends ViewExtensionProvider {
3
9
  name: string;
4
10
  effect(): void;
5
11
  setup(context: ViewExtensionContext): void;
6
12
  }
13
+ /**
14
+ * Data-view creation tooling — flag-gated (`data-view`). It registers nothing
15
+ * today: the block's only creation path, `dataViewSlashMenuConfig`, was never
16
+ * registered (it also waits on `enable_block_query`). The class keeps the
17
+ * render / tooling split of every other block, so a creation entry lands here
18
+ * the day one ships, and a host that names it keeps compiling.
19
+ */
20
+ export declare class DataViewViewExtension extends ViewExtensionProvider {
21
+ name: string;
22
+ }
@@ -4,10 +4,16 @@ import { literal } from 'lit/static-html.js';
4
4
  import { DataViewBlockSchema } from './data-view-model.js';
5
5
  import { effects } from './effects.js';
6
6
  const flavour = DataViewBlockSchema.model.flavour;
7
- export class DataViewViewExtension extends ViewExtensionProvider {
7
+ /**
8
+ * Data-view block rendering — ALWAYS registered, independent of the
9
+ * `data-view` flag (ADR 0009, ADR 0035 §5, issue B4): `effects()`, the
10
+ * flavour and the block view, so a stored `affine:data-view` block draws
11
+ * whatever the flags say. Until 0.48 all of it sat behind `data-view`.
12
+ */
13
+ export class DataViewRenderViewExtension extends ViewExtensionProvider {
8
14
  constructor() {
9
15
  super(...arguments);
10
- this.name = 'affine-data-view-block';
16
+ this.name = 'affine-data-view-render-block';
11
17
  }
12
18
  effect() {
13
19
  super.effect();
@@ -21,3 +27,16 @@ export class DataViewViewExtension extends ViewExtensionProvider {
21
27
  ]);
22
28
  }
23
29
  }
30
+ /**
31
+ * Data-view creation tooling — flag-gated (`data-view`). It registers nothing
32
+ * today: the block's only creation path, `dataViewSlashMenuConfig`, was never
33
+ * registered (it also waits on `enable_block_query`). The class keeps the
34
+ * render / tooling split of every other block, so a creation entry lands here
35
+ * the day one ships, and a host that names it keeps compiling.
36
+ */
37
+ export class DataViewViewExtension extends ViewExtensionProvider {
38
+ constructor() {
39
+ super(...arguments);
40
+ this.name = 'affine-data-view-block';
41
+ }
42
+ }
@@ -1,4 +1,4 @@
1
- import type { Command } from '../std/index.js';
1
+ import type { BlockStdScope, Command } from '../std/index.js';
2
2
  import type { BlockModel, Store } from '../store/index.js';
3
3
  export declare const insertDatabaseBlockCommand: Command<{
4
4
  selectedModels?: BlockModel[];
@@ -8,4 +8,4 @@ export declare const insertDatabaseBlockCommand: Command<{
8
8
  }, {
9
9
  insertedDatabaseBlockId: string;
10
10
  }>;
11
- export declare const initDatabaseBlock: (doc: Store, model: BlockModel, databaseId: string, viewType: string, isAppendNewRow?: boolean) => void;
11
+ export declare const initDatabaseBlock: (doc: Store, model: BlockModel, databaseId: string, viewType: string, isAppendNewRow?: boolean, std?: BlockStdScope) => void;
@@ -12,19 +12,19 @@ export const insertDatabaseBlockCommand = (ctx, next) => {
12
12
  const string = result[0];
13
13
  if (string == null)
14
14
  return;
15
- initDatabaseBlock(std.store, targetModel, string, viewType, false);
15
+ initDatabaseBlock(std.store, targetModel, string, viewType, false, std);
16
16
  if (removeEmptyLine && targetModel.text?.length === 0) {
17
17
  std.store.deleteBlock(targetModel);
18
18
  }
19
19
  next({ insertedDatabaseBlockId: string });
20
20
  };
21
- export const initDatabaseBlock = (doc, model, databaseId, viewType, isAppendNewRow = true) => {
21
+ export const initDatabaseBlock = (doc, model, databaseId, viewType, isAppendNewRow = true, std) => {
22
22
  const blockModel = doc.getBlock(databaseId)?.model;
23
23
  if (!blockModel) {
24
24
  return;
25
25
  }
26
26
  const datasource = new DatabaseBlockDataSource(blockModel);
27
- databaseViewInitTemplate(datasource, viewType);
27
+ databaseViewInitTemplate(datasource, viewType, std);
28
28
  if (isAppendNewRow) {
29
29
  const parent = doc.getParent(model);
30
30
  if (!parent)
@@ -0,0 +1,28 @@
1
+ import { type DatabaseAllEvents, type EventTraceFn } from '../../affine-shared/services/index.js';
2
+ import { type DataSourceHydration } from '../../data-view/index.js';
3
+ import { type BlockStdScope, ShadowlessElement } from '../../std/index.js';
4
+ import { nothing } from 'lit';
5
+ declare const DatabaseValuesBanner_base: typeof ShadowlessElement & import("../../global/utils/types.js").Constructor<import("../../global/lit/with-disposable.js").DisposableClass>;
6
+ export declare class DatabaseValuesBanner extends DatabaseValuesBanner_base {
7
+ static styles: import("lit").CSSResult;
8
+ accessor dataSource: DataSourceHydration;
9
+ accessor std: BlockStdScope;
10
+ /** Where `DatabaseValuesLoadFailed` goes (the block's tracer); absent, nowhere. */
11
+ accessor trace: EventTraceFn<DatabaseAllEvents> | undefined;
12
+ /** Re-evaluated when the 3 s mark passes; never toggled. */
13
+ private readonly _now$;
14
+ connectedCallback(): void;
15
+ /**
16
+ * Once per failure of a source (its `since`), not per banner: a block
17
+ * re-rendered, or two views of one source, report it once.
18
+ */
19
+ private reportFailure;
20
+ private readonly _retry;
21
+ render(): import("lit-html").TemplateResult<1> | typeof nothing;
22
+ }
23
+ declare global {
24
+ interface HTMLElementTagNameMap {
25
+ 'affine-database-values-banner': DatabaseValuesBanner;
26
+ }
27
+ }
28
+ export {};
@@ -0,0 +1,199 @@
1
+ var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
2
+ function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
3
+ var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
4
+ var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
5
+ var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
6
+ var _, done = false;
7
+ for (var i = decorators.length - 1; i >= 0; i--) {
8
+ var context = {};
9
+ for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
10
+ for (var p in contextIn.access) context.access[p] = contextIn.access[p];
11
+ context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
12
+ var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
13
+ if (kind === "accessor") {
14
+ if (result === void 0) continue;
15
+ if (result === null || typeof result !== "object") throw new TypeError("Object expected");
16
+ if (_ = accept(result.get)) descriptor.get = _;
17
+ if (_ = accept(result.set)) descriptor.set = _;
18
+ if (_ = accept(result.init)) initializers.unshift(_);
19
+ }
20
+ else if (_ = accept(result)) {
21
+ if (kind === "field") initializers.unshift(_);
22
+ else descriptor[key] = _;
23
+ }
24
+ }
25
+ if (target) Object.defineProperty(target, contextIn.name, descriptor);
26
+ done = true;
27
+ };
28
+ var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
29
+ var useValue = arguments.length > 2;
30
+ for (var i = 0; i < initializers.length; i++) {
31
+ value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
32
+ }
33
+ return useValue ? value : void 0;
34
+ };
35
+ import { RESOURCE_STATUS_RETRY } from '../../affine-components/translations.js';
36
+ import { translateKey, } from '../../affine-shared/services/index.js';
37
+ import { valuesBannerOf, valuesStateOf, VALUES_SLOW_AFTER_MS, } from '../../data-view/index.js';
38
+ import { SignalWatcher, WithDisposable } from '../../global/lit/index.js';
39
+ import { ShadowlessElement } from '../../std/index.js';
40
+ import { effect, signal } from '@preact/signals-core';
41
+ import { css, html, nothing } from 'lit';
42
+ import { property } from 'lit/decorators.js';
43
+ import { DATABASE_VALUES_ERROR, DATABASE_VALUES_LOADING, } from '../translations.js';
44
+ /**
45
+ * The hydration banner of a database (ADR 0035 §9e, issue B2): nothing while
46
+ * values load for less than 3 s, "still loading" after, "could not be
47
+ * loaded" with Retry on `error` (Retry only when the source offers
48
+ * `retryValues`). It reads the source's `valuesState$` and writes nothing; a
49
+ * source that says nothing about hydration never shows it.
50
+ */
51
+ const reportedFailures = new WeakMap();
52
+ let DatabaseValuesBanner = (() => {
53
+ let _classSuper = SignalWatcher(WithDisposable(ShadowlessElement));
54
+ let _dataSource_decorators;
55
+ let _dataSource_initializers = [];
56
+ let _dataSource_extraInitializers = [];
57
+ let _std_decorators;
58
+ let _std_initializers = [];
59
+ let _std_extraInitializers = [];
60
+ let _trace_decorators;
61
+ let _trace_initializers = [];
62
+ let _trace_extraInitializers = [];
63
+ return class DatabaseValuesBanner extends _classSuper {
64
+ constructor() {
65
+ super(...arguments);
66
+ this.#dataSource_accessor_storage = __runInitializers(this, _dataSource_initializers, void 0);
67
+ this.#std_accessor_storage = (__runInitializers(this, _dataSource_extraInitializers), __runInitializers(this, _std_initializers, void 0));
68
+ this.#trace_accessor_storage = (__runInitializers(this, _std_extraInitializers), __runInitializers(this, _trace_initializers, undefined));
69
+ /** Re-evaluated when the 3 s mark passes; never toggled. */
70
+ this._now$ = (__runInitializers(this, _trace_extraInitializers), signal(Date.now()));
71
+ this._retry = () => {
72
+ this.dataSource.retryValues?.();
73
+ };
74
+ }
75
+ static {
76
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
77
+ _dataSource_decorators = [property({ attribute: false })];
78
+ _std_decorators = [property({ attribute: false })];
79
+ _trace_decorators = [property({ attribute: false })];
80
+ __esDecorate(this, null, _dataSource_decorators, { kind: "accessor", name: "dataSource", static: false, private: false, access: { has: obj => "dataSource" in obj, get: obj => obj.dataSource, set: (obj, value) => { obj.dataSource = value; } }, metadata: _metadata }, _dataSource_initializers, _dataSource_extraInitializers);
81
+ __esDecorate(this, null, _std_decorators, { kind: "accessor", name: "std", static: false, private: false, access: { has: obj => "std" in obj, get: obj => obj.std, set: (obj, value) => { obj.std = value; } }, metadata: _metadata }, _std_initializers, _std_extraInitializers);
82
+ __esDecorate(this, null, _trace_decorators, { kind: "accessor", name: "trace", static: false, private: false, access: { has: obj => "trace" in obj, get: obj => obj.trace, set: (obj, value) => { obj.trace = value; } }, metadata: _metadata }, _trace_initializers, _trace_extraInitializers);
83
+ if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
84
+ }
85
+ static { this.styles = css `
86
+ affine-database-values-banner {
87
+ display: block;
88
+ }
89
+
90
+ .affine-database-values-banner {
91
+ display: flex;
92
+ align-items: center;
93
+ gap: 8px;
94
+ margin: 4px 0;
95
+ padding: 4px 8px;
96
+ min-height: 32px;
97
+ border-radius: 8px;
98
+ font-size: 14px;
99
+ line-height: 22px;
100
+ color: var(--affine-text-secondary-color);
101
+ background-color: var(--affine-hover-color);
102
+ }
103
+
104
+ .affine-database-values-banner[data-kind='error'] {
105
+ color: var(--affine-error-color);
106
+ }
107
+
108
+ .affine-database-values-banner-text {
109
+ flex: 1;
110
+ min-width: 0;
111
+ }
112
+ `; }
113
+ #dataSource_accessor_storage;
114
+ get dataSource() { return this.#dataSource_accessor_storage; }
115
+ set dataSource(value) { this.#dataSource_accessor_storage = value; }
116
+ #std_accessor_storage;
117
+ get std() { return this.#std_accessor_storage; }
118
+ set std(value) { this.#std_accessor_storage = value; }
119
+ #trace_accessor_storage;
120
+ /** Where `DatabaseValuesLoadFailed` goes (the block's tracer); absent, nowhere. */
121
+ get trace() { return this.#trace_accessor_storage; }
122
+ set trace(value) { this.#trace_accessor_storage = value; }
123
+ connectedCallback() {
124
+ super.connectedCallback();
125
+ let timer;
126
+ const clear = () => {
127
+ if (timer !== undefined)
128
+ clearTimeout(timer);
129
+ timer = undefined;
130
+ };
131
+ this.disposables.add(effect(() => {
132
+ const state = valuesStateOf(this.dataSource);
133
+ clear();
134
+ this._now$.value = Date.now();
135
+ if (state.status === 'error')
136
+ this.reportFailure(state.since);
137
+ if (state.status !== 'loading')
138
+ return;
139
+ const wait = state.since + VALUES_SLOW_AFTER_MS - Date.now();
140
+ if (wait <= 0)
141
+ return;
142
+ timer = setTimeout(() => {
143
+ this._now$.value = Date.now();
144
+ }, wait);
145
+ }));
146
+ this.disposables.add(clear);
147
+ }
148
+ /**
149
+ * Once per failure of a source (its `since`), not per banner: a block
150
+ * re-rendered, or two views of one source, report it once.
151
+ */
152
+ reportFailure(since) {
153
+ const source = this.dataSource;
154
+ if (reportedFailures.get(source) === since)
155
+ return;
156
+ reportedFailures.set(source, since);
157
+ this.trace?.('DatabaseValuesLoadFailed', {
158
+ retryable: !!source.retryValues,
159
+ });
160
+ }
161
+ render() {
162
+ const kind = valuesBannerOf(valuesStateOf(this.dataSource), this._now$.value);
163
+ if (kind === 'none')
164
+ return nothing;
165
+ if (kind === 'slow') {
166
+ return html `<div
167
+ class="affine-database-values-banner"
168
+ data-kind="slow"
169
+ data-testid="database-values-loading"
170
+ role="status"
171
+ >
172
+ <span class="affine-database-values-banner-text"
173
+ >${translateKey(this.std, ...DATABASE_VALUES_LOADING)}</span
174
+ >
175
+ </div>`;
176
+ }
177
+ const canRetry = !!this.dataSource.retryValues;
178
+ return html `<div
179
+ class="affine-database-values-banner"
180
+ data-kind="error"
181
+ data-testid="database-values-error"
182
+ role="alert"
183
+ >
184
+ <span class="affine-database-values-banner-text"
185
+ >${translateKey(this.std, ...DATABASE_VALUES_ERROR)}</span
186
+ >
187
+ ${canRetry
188
+ ? html `<data-view-component-button
189
+ data-testid="database-values-retry"
190
+ hoverType="border"
191
+ .onClick="${this._retry}"
192
+ .text="${translateKey(this.std, ...RESOURCE_STATUS_RETRY)}"
193
+ ></data-view-component-button>`
194
+ : nothing}
195
+ </div>`;
196
+ }
197
+ };
198
+ })();
199
+ export { DatabaseValuesBanner };
@@ -1,2 +1,7 @@
1
- import { type SlashMenuConfig } from '../../affine-widget-slash-menu/index.js';
1
+ import type { SlashMenuConfig } from '../../affine-widget-slash-menu/index.js';
2
+ /**
3
+ * The slash entries that CREATE a database, registered by the gated
4
+ * `DatabaseViewExtension` only. No Calendar entry after 0.48 (ADR 0035 §6):
5
+ * a calendar is no longer created anywhere, a stored one still renders.
6
+ */
2
7
  export declare const databaseSlashMenuConfig: SlashMenuConfig;
@@ -1,11 +1,59 @@
1
1
  import { getSelectedModelsCommand } from '../../affine-shared/commands/index.js';
2
- import { TelemetryProvider } from '../../affine-shared/services/index.js';
2
+ import { DataSourcePickerProvider, TelemetryProvider, } from '../../affine-shared/services/index.js';
3
3
  import { isInsideBlockByFlavour } from '../../affine-shared/utils/index.js';
4
- import {} from '../../affine-widget-slash-menu/index.js';
5
4
  import { viewPresets } from '../../data-view/view-presets/index.js';
6
- import { DatabaseKanbanViewIcon, DatabaseTableViewIcon, TodayIcon, } from '@blocksuite/icons/lit';
5
+ import { DatabaseKanbanViewIcon, DatabaseTableViewIcon, } from '@blocksuite/icons/lit';
7
6
  import { insertDatabaseBlockCommand } from '../commands.js';
7
+ import { createHostedDatabaseView } from '../linked-view.js';
8
8
  import { KanbanViewTooltip, TableViewTooltip } from './tooltips.js';
9
+ /**
10
+ * With a data-source picker the host owns database creation (ADR 0035 §5):
11
+ * its `createDatabase` is the only way in, and without it no entry creates
12
+ * one. Without a picker, a native inline database, as in 0.48.
13
+ */
14
+ function canCreateDatabase(std) {
15
+ const picker = std.getOptional(DataSourcePickerProvider);
16
+ return !picker || !!picker.createDatabase;
17
+ }
18
+ function createDatabaseAction(viewType) {
19
+ return ({ std }) => {
20
+ const picker = std.getOptional(DataSourcePickerProvider);
21
+ if (picker) {
22
+ const [, { selectedModels }] = std.command.exec(getSelectedModelsCommand);
23
+ const after = selectedModels?.at(-1);
24
+ if (!after)
25
+ return;
26
+ createHostedDatabaseView(std, picker, {
27
+ after,
28
+ viewType,
29
+ removeEmptyLine: true,
30
+ }).catch(console.error);
31
+ return;
32
+ }
33
+ std.command
34
+ .chain()
35
+ .pipe(getSelectedModelsCommand)
36
+ .pipe(insertDatabaseBlockCommand, {
37
+ viewType,
38
+ place: 'after',
39
+ removeEmptyLine: true,
40
+ })
41
+ .pipe(({ insertedDatabaseBlockId }) => {
42
+ if (insertedDatabaseBlockId) {
43
+ const telemetry = std.getOptional(TelemetryProvider);
44
+ telemetry?.track('BlockCreated', {
45
+ blockType: 'affine:database',
46
+ });
47
+ }
48
+ })
49
+ .run();
50
+ };
51
+ }
52
+ /**
53
+ * The slash entries that CREATE a database, registered by the gated
54
+ * `DatabaseViewExtension` only. No Calendar entry after 0.48 (ADR 0035 §6):
55
+ * a calendar is no longer created anywhere, a stored one still renders.
56
+ */
9
57
  export const databaseSlashMenuConfig = {
10
58
  disableWhen: ({ model }) => model.flavour === 'affine:database',
11
59
  items: [
@@ -19,53 +67,9 @@ export const databaseSlashMenuConfig = {
19
67
  caption: 'Table View',
20
68
  },
21
69
  group: '7_Database@0',
22
- when: ({ model }) => !isInsideBlockByFlavour(model.store, model, 'affine:edgeless-text'),
23
- action: ({ std }) => {
24
- std.command
25
- .chain()
26
- .pipe(getSelectedModelsCommand)
27
- .pipe(insertDatabaseBlockCommand, {
28
- viewType: viewPresets.tableViewMeta.type,
29
- place: 'after',
30
- removeEmptyLine: true,
31
- })
32
- .pipe(({ insertedDatabaseBlockId }) => {
33
- if (insertedDatabaseBlockId) {
34
- const telemetry = std.getOptional(TelemetryProvider);
35
- telemetry?.track('BlockCreated', {
36
- blockType: 'affine:database',
37
- });
38
- }
39
- })
40
- .run();
41
- },
42
- },
43
- {
44
- name: 'Calendar View',
45
- description: 'Display items by date in a calendar.',
46
- searchAlias: ['database', 'calendar'],
47
- icon: TodayIcon(),
48
- group: '7_Database@1',
49
- when: ({ model }) => !isInsideBlockByFlavour(model.store, model, 'affine:edgeless-text'),
50
- action: ({ std }) => {
51
- std.command
52
- .chain()
53
- .pipe(getSelectedModelsCommand)
54
- .pipe(insertDatabaseBlockCommand, {
55
- viewType: viewPresets.calendarViewMeta.type,
56
- place: 'after',
57
- removeEmptyLine: true,
58
- })
59
- .pipe(({ insertedDatabaseBlockId }) => {
60
- if (insertedDatabaseBlockId) {
61
- const telemetry = std.getOptional(TelemetryProvider);
62
- telemetry?.track('BlockCreated', {
63
- blockType: 'affine:database',
64
- });
65
- }
66
- })
67
- .run();
68
- },
70
+ when: ({ model, std }) => !isInsideBlockByFlavour(model.store, model, 'affine:edgeless-text') &&
71
+ canCreateDatabase(std),
72
+ action: createDatabaseAction(viewPresets.tableViewMeta.type),
69
73
  },
70
74
  {
71
75
  name: 'Kanban View',
@@ -77,26 +81,9 @@ export const databaseSlashMenuConfig = {
77
81
  caption: 'Kanban View',
78
82
  },
79
83
  group: '7_Database@2',
80
- when: ({ model }) => !isInsideBlockByFlavour(model.store, model, 'affine:edgeless-text'),
81
- action: ({ std }) => {
82
- std.command
83
- .chain()
84
- .pipe(getSelectedModelsCommand)
85
- .pipe(insertDatabaseBlockCommand, {
86
- viewType: viewPresets.kanbanViewMeta.type,
87
- place: 'after',
88
- removeEmptyLine: true,
89
- })
90
- .pipe(({ insertedDatabaseBlockId }) => {
91
- if (insertedDatabaseBlockId) {
92
- const telemetry = std.getOptional(TelemetryProvider);
93
- telemetry?.track('BlockCreated', {
94
- blockType: 'affine:database',
95
- });
96
- }
97
- })
98
- .run();
99
- },
84
+ when: ({ model, std }) => !isInsideBlockByFlavour(model.store, model, 'affine:edgeless-text') &&
85
+ canCreateDatabase(std),
86
+ action: createDatabaseAction(viewPresets.kanbanViewMeta.type),
100
87
  },
101
88
  ],
102
89
  };
@@ -1,19 +1,19 @@
1
1
  import type { ColumnDataType, DatabaseBlockModel } from '../affine-model/index.js';
2
2
  import { type InsertToPosition } from '../affine-shared/utils/index.js';
3
3
  import { type PropertyMetaConfig, type TypeInstance } from '../data-view/index.js';
4
- import type { EditorHost } from '../std/index.js';
5
- import { ExternalDataSourceBase } from './external-data-source.js';
4
+ import type { BlockStdScope, EditorHost } from '../std/index.js';
5
+ import { HostedDataSourceBase } from './external-data-source.js';
6
6
  type SpacialProperty = {
7
7
  valueSet: (rowId: string, propertyId: string, value: unknown) => void;
8
8
  valueGet: (rowId: string, propertyId: string) => unknown;
9
9
  };
10
10
  /**
11
11
  * The inline blob source: rows are the block's children, cells/columns live in
12
- * the model blob. It implements the {@link ExternalDataSourceBase} data
12
+ * the model blob. It implements the {@link HostedDataSourceBase} data
13
13
  * contract by reading blocksuite signals directly, so it never needs to bump
14
14
  * `revision` — reactivity is automatic.
15
15
  */
16
- export declare class DatabaseBlockDataSource extends ExternalDataSourceBase {
16
+ export declare class DatabaseBlockDataSource extends HostedDataSourceBase {
17
17
  spacialProperties: Record<string, SpacialProperty>;
18
18
  isSpacialProperty(propertyType: string): boolean;
19
19
  spacialValueGet(rowId: string, propertyId: string, propertyType: string): unknown;
@@ -79,6 +79,10 @@ export declare class DatabaseBlockDataSource extends ExternalDataSourceBase {
79
79
  rowDelete(ids: string[]): void;
80
80
  rowMove(rowId: string, position: InsertToPosition): void;
81
81
  }
82
- export declare const databaseViewInitTemplate: (datasource: DatabaseBlockDataSource, viewType: string) => void;
82
+ /**
83
+ * `std` names the first view in the author's language (`viewDefaultName`),
84
+ * at the gesture; absent, the preset's English name, as in 0.48.
85
+ */
86
+ export declare const databaseViewInitTemplate: (datasource: DatabaseBlockDataSource, viewType: string, std?: BlockStdScope) => void;
83
87
  export declare const convertToDatabase: (host: EditorHost, viewType: string) => void;
84
88
  export {};
@@ -1,20 +1,20 @@
1
1
  import { getSelectedModelsCommand } from '../affine-shared/commands/index.js';
2
2
  import { insertPositionToIndex, } from '../affine-shared/utils/index.js';
3
- import {} from '../data-view/index.js';
3
+ import { viewDefaultName, } from '../data-view/index.js';
4
4
  import { propertyPresets } from '../data-view/property-presets/index.js';
5
5
  import {} from '../store/index.js';
6
6
  import { computed, signal } from '@preact/signals-core';
7
7
  import { getIcon } from './block-icons.js';
8
- import { ExternalDataSourceBase } from './external-data-source.js';
8
+ import { HostedDataSourceBase } from './external-data-source.js';
9
9
  import { databaseBlockProperties, databasePropertyConverts, } from './properties/index.js';
10
10
  import { addProperty, copyCellsByProperty, deleteRows, getCell, getProperty, updateCell, updateCells, updateProperty, } from './utils/block-utils.js';
11
11
  /**
12
12
  * The inline blob source: rows are the block's children, cells/columns live in
13
- * the model blob. It implements the {@link ExternalDataSourceBase} data
13
+ * the model blob. It implements the {@link HostedDataSourceBase} data
14
14
  * contract by reading blocksuite signals directly, so it never needs to bump
15
15
  * `revision` — reactivity is automatic.
16
16
  */
17
- export class DatabaseBlockDataSource extends ExternalDataSourceBase {
17
+ export class DatabaseBlockDataSource extends HostedDataSourceBase {
18
18
  isSpacialProperty(propertyType) {
19
19
  return this.spacialProperties[propertyType] !== undefined;
20
20
  }
@@ -393,11 +393,15 @@ export class DatabaseBlockDataSource extends ExternalDataSourceBase {
393
393
  }
394
394
  }
395
395
  }
396
- export const databaseViewInitTemplate = (datasource, viewType) => {
396
+ /**
397
+ * `std` names the first view in the author's language (`viewDefaultName`),
398
+ * at the gesture; absent, the preset's English name, as in 0.48.
399
+ */
400
+ export const databaseViewInitTemplate = (datasource, viewType, std) => {
397
401
  Array.from({ length: 3 }).forEach(() => {
398
402
  datasource.rowAdd('end');
399
403
  });
400
- datasource.viewManager.viewAdd(viewType);
404
+ datasource.viewManager.viewAdd(viewType, viewDefaultName(datasource.viewMetaGet(viewType), std));
401
405
  };
402
406
  export const convertToDatabase = (host, viewType) => {
403
407
  const [_, ctx] = host.std.command.exec(getSelectedModelsCommand, {
@@ -418,7 +422,7 @@ export const convertToDatabase = (host, viewType) => {
418
422
  return;
419
423
  }
420
424
  const datasource = new DatabaseBlockDataSource(databaseModel);
421
- datasource.viewManager.viewAdd(viewType);
425
+ datasource.viewManager.viewAdd(viewType, viewDefaultName(datasource.viewMetaGet(viewType), host.std));
422
426
  host.store.moveBlocks(selectedModels, databaseModel);
423
427
  const selectionManager = host.selection;
424
428
  selectionManager.clear();
@@ -8,3 +8,5 @@ export declare const databaseTitleRowStyles: string;
8
8
  export declare const databaseToolbarRowStyles: string;
9
9
  export declare const databaseViewBarContainerStyles: string;
10
10
  export declare const databaseContentStyles: string;
11
+ export declare const databaseSourceMissingStyles: string;
12
+ export declare const databaseSourceMissingHintStyles: string;
@@ -60,3 +60,18 @@ export const databaseContentStyles = css({
60
60
  backgroundColor: 'var(--affine-background-primary-color)',
61
61
  borderRadius: '4px',
62
62
  });
63
+ export const databaseSourceMissingStyles = css({
64
+ display: 'flex',
65
+ flexDirection: 'column',
66
+ gap: '4px',
67
+ margin: '8px 0',
68
+ padding: '12px',
69
+ borderRadius: '8px',
70
+ fontSize: '14px',
71
+ lineHeight: '22px',
72
+ color: 'var(--affine-text-primary-color)',
73
+ backgroundColor: 'var(--affine-hover-color)',
74
+ });
75
+ export const databaseSourceMissingHintStyles = css({
76
+ color: 'var(--affine-text-secondary-color)',
77
+ });