@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
@@ -1,34 +1,78 @@
1
1
  import { ViewExtensionProvider, } from '../affine-ext-loader/index.js';
2
2
  import { DatabaseBlockModel } from '../affine-model/index.js';
3
3
  import { SlashMenuConfigExtension } from '../affine-widget-slash-menu/index.js';
4
+ import { StandaloneCellMetaExtension } from '../data-view/index.js';
4
5
  import { BlockViewExtension, FlavourExtension } from '../std/index.js';
5
6
  import { literal } from 'lit/static-html.js';
6
7
  import { z } from 'zod';
7
8
  import { DatabaseConfigExtension } from './config.js';
8
9
  import { databaseSlashMenuConfig } from './configs/slash-menu.js';
9
10
  import { effects } from './effects.js';
11
+ import { linkColumnConfig } from './properties/link/cell-renderer.js';
12
+ import { DatabaseViewCreationExtension } from './view-creation.js';
10
13
  const optionsSchema = z.object({
11
14
  configure: z
12
15
  .function()
13
16
  .args(z.instanceof(DatabaseBlockModel), z.custom())
14
17
  .returns(z.custom()),
15
18
  });
16
- export class DatabaseViewExtension extends ViewExtensionProvider {
19
+ /**
20
+ * Database rendering — ALWAYS registered, independent of the `database` and
21
+ * `data-view` flags (ADR 0009, ADR 0035 §5, issue B4). A document that holds a
22
+ * database must show it, let its cells be edited and its rows be opened
23
+ * whatever the flags say: until 0.48 the whole view sat behind `database`, and
24
+ * `{ database: false }` left every stored database rendered as nothing.
25
+ *
26
+ * What lives here is what an EXISTING database needs, the mirror of
27
+ * `CalloutRenderViewExtension`:
28
+ * - `effects()` whole: every element it defines draws a stored database (the
29
+ * block, its title, the cells, the row detail and its peek);
30
+ * - the flavour and the block view, the lookup `lit-host` performs; the block
31
+ * brings the presets, the cells and the row opening with it;
32
+ * - the link cell for the title band (ADR 0035 §11): a `link` value already
33
+ * stored on a page is drawn with it.
34
+ */
35
+ export class DatabaseRenderViewExtension extends ViewExtensionProvider {
17
36
  constructor() {
18
37
  super(...arguments);
19
- this.name = 'affine-database-block';
20
- this.schema = optionsSchema;
38
+ this.name = 'affine-database-render-block';
21
39
  }
22
40
  effect() {
23
41
  super.effect();
24
42
  effects();
25
43
  }
26
- setup(context, options) {
44
+ setup(context) {
27
45
  super.setup(context);
28
46
  context.register([
29
47
  FlavourExtension('affine:database'),
30
48
  BlockViewExtension('affine:database', literal `affine-database`),
49
+ // The title band draws a `link` / `url` property with the table's link
50
+ // cell; it sits below this package and cannot import it (ADR 0035 §11).
51
+ StandaloneCellMetaExtension(linkColumnConfig),
52
+ ]);
53
+ }
54
+ }
55
+ /**
56
+ * Database creation tooling — flag-gated (`database`, ADR 0009, ADR 0035 §5):
57
+ * the slash-menu entries that insert a database, the "+ view" of a rendered
58
+ * one (`DatabaseViewCreationIdentifier`, `./view-creation.ts`), and the host's additions to
59
+ * the block's "⋯" menu (`configure`, kept on this class so a host's
60
+ * `viewManager.configure(DatabaseViewExtension, …)` still compiles and its
61
+ * entries follow the flag). With the flag off no database and no view can be
62
+ * made; the stored ones keep rendering through
63
+ * {@link DatabaseRenderViewExtension}.
64
+ */
65
+ export class DatabaseViewExtension extends ViewExtensionProvider {
66
+ constructor() {
67
+ super(...arguments);
68
+ this.name = 'affine-database-block';
69
+ this.schema = optionsSchema;
70
+ }
71
+ setup(context, options) {
72
+ super.setup(context);
73
+ context.register([
31
74
  SlashMenuConfigExtension('affine:database', databaseSlashMenuConfig),
75
+ DatabaseViewCreationExtension,
32
76
  ]);
33
77
  if (options) {
34
78
  context.register(DatabaseConfigExtension({ configure: options.configure }));
@@ -1,6 +1,33 @@
1
1
  import type { ViewMeta } from '../../data-view/index.js';
2
+ /**
3
+ * Every preset a stored `affine:database` view can be drawn with (ADR 0035
4
+ * §6). Calendar stays here: calendar views were creatable until 0.48, so
5
+ * documents hold them, and a stored calendar keeps rendering and editing as a
6
+ * calendar. Never shrink this list: a mode that leaves it falls back to a
7
+ * table on every document that stores it.
8
+ */
9
+ export declare const databaseBlockRenderableViews: ViewMeta[];
10
+ /**
11
+ * The presets a user can CREATE, a subset of the renderable ones: what the
12
+ * data source answers as `viewMetas`, so the views bar ("+", "Create …") and
13
+ * the Layout switch list only these. Calendar left it after 0.48 (ADR 0035 §6,
14
+ * labre ADR-0046 §8): no new calendar, the stored ones still render.
15
+ */
2
16
  export declare const databaseBlockViews: ViewMeta[];
3
- export declare const databaseBlockViewMap: {
4
- [k: string]: ViewMeta;
5
- };
17
+ /** The preset a mode with none of its own is drawn with. */
18
+ export declare const databaseBlockFallbackView: ViewMeta;
19
+ export declare const databaseBlockViewMap: Record<string, ViewMeta | undefined>;
20
+ /**
21
+ * The preset that draws a stored `mode`. Never throws: a mode this client has
22
+ * no preset for (a `timeline`, a newer client's view, an import) is drawn as a
23
+ * table over the source's properties, and its stored data stays as it is
24
+ * (`SingleView.shownAsFallback$`). Up to 0.48 it threw `Unknown view type`
25
+ * and the whole database rendered nothing.
26
+ */
27
+ export declare function databaseBlockViewMetaGet(mode: string): ViewMeta;
28
+ /**
29
+ * Conversions INTO a creatable preset only: switching a view's layout to
30
+ * calendar would create a calendar. The conversions out of calendar stay, so a
31
+ * stored calendar can still become a table or a board.
32
+ */
6
33
  export declare const databaseBlockViewConverts: import("../index.js").ViewConvertConfig[];
@@ -1,8 +1,49 @@
1
1
  import { viewConverts, viewPresets } from '../../data-view/view-presets/index.js';
2
- export const databaseBlockViews = [
2
+ /**
3
+ * Every preset a stored `affine:database` view can be drawn with (ADR 0035
4
+ * §6). Calendar stays here: calendar views were creatable until 0.48, so
5
+ * documents hold them, and a stored calendar keeps rendering and editing as a
6
+ * calendar. Never shrink this list: a mode that leaves it falls back to a
7
+ * table on every document that stores it.
8
+ */
9
+ export const databaseBlockRenderableViews = [
3
10
  viewPresets.tableViewMeta,
4
11
  viewPresets.kanbanViewMeta,
5
12
  viewPresets.calendarViewMeta,
13
+ viewPresets.galleryViewMeta,
14
+ viewPresets.listViewMeta,
15
+ ];
16
+ /**
17
+ * The presets a user can CREATE, a subset of the renderable ones: what the
18
+ * data source answers as `viewMetas`, so the views bar ("+", "Create …") and
19
+ * the Layout switch list only these. Calendar left it after 0.48 (ADR 0035 §6,
20
+ * labre ADR-0046 §8): no new calendar, the stored ones still render.
21
+ */
22
+ export const databaseBlockViews = [
23
+ viewPresets.tableViewMeta,
24
+ viewPresets.kanbanViewMeta,
25
+ viewPresets.galleryViewMeta,
26
+ viewPresets.listViewMeta,
6
27
  ];
7
- export const databaseBlockViewMap = Object.fromEntries(databaseBlockViews.map(view => [view.type, view]));
8
- export const databaseBlockViewConverts = [...viewConverts];
28
+ /** The preset a mode with none of its own is drawn with. */
29
+ export const databaseBlockFallbackView = viewPresets.tableViewMeta;
30
+ // No prototype: a stored mode is any string, and `'constructor'` or
31
+ // `'__proto__'` must find no preset rather than Object's own members.
32
+ export const databaseBlockViewMap = Object.assign(Object.create(null), Object.fromEntries(databaseBlockRenderableViews.map(v => [v.type, v])));
33
+ /**
34
+ * The preset that draws a stored `mode`. Never throws: a mode this client has
35
+ * no preset for (a `timeline`, a newer client's view, an import) is drawn as a
36
+ * table over the source's properties, and its stored data stays as it is
37
+ * (`SingleView.shownAsFallback$`). Up to 0.48 it threw `Unknown view type`
38
+ * and the whole database rendered nothing.
39
+ */
40
+ export function databaseBlockViewMetaGet(mode) {
41
+ return databaseBlockViewMap[mode] ?? databaseBlockFallbackView;
42
+ }
43
+ const creatableModes = new Set(databaseBlockViews.map(view => view.type));
44
+ /**
45
+ * Conversions INTO a creatable preset only: switching a view's layout to
46
+ * calendar would create a calendar. The conversions out of calendar stay, so a
47
+ * stored calendar can still become a table or a board.
48
+ */
49
+ export const databaseBlockViewConverts = viewConverts.filter(convert => creatableModes.has(convert.to));
@@ -0,0 +1,25 @@
1
+ import type { BlockStdScope } from '../../../std/index.js';
2
+ import type { BlockModel } from '../../../store/index.js';
3
+ /**
4
+ * Whether the slash menu offers "New Page" here: the card's schema is
5
+ * registered, and the host, if it creates docs, does not refuse it on this
6
+ * editor (`LinkedDocCreationProvider.canCreateLinkedDoc`).
7
+ */
8
+ export declare function canCreateDocHere(std: BlockStdScope, model: BlockModel): boolean;
9
+ /**
10
+ * The slash menu's "New Page": creates a page and leaves a CARD of it
11
+ * (`affine:embed-linked-doc`) right after the block the gesture was typed in.
12
+ * A paragraph the gesture left empty is replaced by the card, as Notion turns
13
+ * the line into the page. A card shows a child where its parent places it; an
14
+ * inline mention is only a reference (Labre ADR-0045 §9, host side).
15
+ *
16
+ * The page comes from the host's `LinkedDocCreationProvider` when there is
17
+ * one (the host persists it, registers it, decides its parent), else from the
18
+ * workspace (`createDefaultDoc`, the playground and standalone editors).
19
+ *
20
+ * One undo step for the card and the removed line. When no card can go there
21
+ * (a parent whose schema refuses it, an edgeless text for one), the gesture
22
+ * falls back on the inline mention it used to leave, so it always yields a way
23
+ * to the page. Returns the new page's id, or null on a read-only store.
24
+ */
25
+ export declare function createDocFromSlash(std: BlockStdScope, model: BlockModel): string | null;
@@ -0,0 +1,71 @@
1
+ import { insertContent } from '../../../affine-rich-text/index.js';
2
+ import { REFERENCE_NODE } from '../../../affine-shared/consts/index.js';
3
+ import { LinkedDocCreationProvider, TelemetryProvider, } from '../../../affine-shared/services/index.js';
4
+ import { createDefaultDoc, writeDefaultDocBlocks, } from '../../../affine-shared/utils/index.js';
5
+ const LINKED_DOC = 'affine:embed-linked-doc';
6
+ /**
7
+ * Whether the slash menu offers "New Page" here: the card's schema is
8
+ * registered, and the host, if it creates docs, does not refuse it on this
9
+ * editor (`LinkedDocCreationProvider.canCreateLinkedDoc`).
10
+ */
11
+ export function canCreateDocHere(std, model) {
12
+ if (!model.store.schema.flavourSchemaMap.has(LINKED_DOC))
13
+ return false;
14
+ const creation = std.getOptional(LinkedDocCreationProvider);
15
+ return creation?.canCreateLinkedDoc?.(std.host) ?? true;
16
+ }
17
+ /**
18
+ * The slash menu's "New Page": creates a page and leaves a CARD of it
19
+ * (`affine:embed-linked-doc`) right after the block the gesture was typed in.
20
+ * A paragraph the gesture left empty is replaced by the card, as Notion turns
21
+ * the line into the page. A card shows a child where its parent places it; an
22
+ * inline mention is only a reference (Labre ADR-0045 §9, host side).
23
+ *
24
+ * The page comes from the host's `LinkedDocCreationProvider` when there is
25
+ * one (the host persists it, registers it, decides its parent), else from the
26
+ * workspace (`createDefaultDoc`, the playground and standalone editors).
27
+ *
28
+ * One undo step for the card and the removed line. When no card can go there
29
+ * (a parent whose schema refuses it, an edgeless text for one), the gesture
30
+ * falls back on the inline mention it used to leave, so it always yields a way
31
+ * to the page. Returns the new page's id, or null on a read-only store.
32
+ */
33
+ export function createDocFromSlash(std, model) {
34
+ const { store } = std;
35
+ if (store.readonly)
36
+ return null;
37
+ const pageId = createNewDoc(std).id;
38
+ store.captureSync();
39
+ if (insertCard(store, model, pageId)) {
40
+ std.getOptional(TelemetryProvider)?.track('BlockCreated', {
41
+ blockType: LINKED_DOC,
42
+ });
43
+ }
44
+ else {
45
+ insertContent(std, model, REFERENCE_NODE, {
46
+ reference: { type: 'LinkedPage', pageId },
47
+ });
48
+ }
49
+ return pageId;
50
+ }
51
+ function createNewDoc(std) {
52
+ const creation = std.getOptional(LinkedDocCreationProvider);
53
+ if (!creation)
54
+ return createDefaultDoc(std.store.workspace);
55
+ const doc = creation.createLinkedDoc(std.host, '');
56
+ doc.load(() => writeDefaultDocBlocks(doc));
57
+ // The new page's first undo must not empty it (as in `createDefaultDoc`).
58
+ doc.resetHistory();
59
+ return doc;
60
+ }
61
+ function insertCard(store, anchor, pageId) {
62
+ const parent = store.getParent(anchor);
63
+ if (!parent || !store.schema.isValid(LINKED_DOC, parent.flavour)) {
64
+ return null;
65
+ }
66
+ const cardId = store.addBlock(LINKED_DOC, { pageId }, parent, parent.children.indexOf(anchor) + 1);
67
+ if (anchor.flavour === 'affine:paragraph' && anchor.text?.length === 0) {
68
+ store.deleteBlock(anchor);
69
+ }
70
+ return cardId;
71
+ }
@@ -1,11 +1,9 @@
1
1
  import { EmbedLinkedDocBlockSchema } from '../../../affine-model/index.js';
2
- import { insertContent } from '../../../affine-rich-text/index.js';
3
- import { REFERENCE_NODE } from '../../../affine-shared/consts/index.js';
4
- import { createDefaultDoc } from '../../../affine-shared/utils/index.js';
5
2
  import { SlashMenuConfigIdentifier, } from '../../../affine-widget-slash-menu/index.js';
6
3
  import { LinkedPageIcon, PlusIcon } from '@blocksuite/icons/lit';
7
4
  import {} from '../../../store/index.js';
8
5
  import { EMBED_DOC_SLASH_LINKED_DOC_CAPTION, EMBED_DOC_SLASH_LINKED_DOC_DESCRIPTION, EMBED_DOC_SLASH_LINKED_DOC_NAME, EMBED_DOC_SLASH_NEW_DOC_DESCRIPTION, EMBED_DOC_SLASH_NEW_DOC_NAME, } from '../../translations.js';
6
+ import { canCreateDocHere, createDocFromSlash } from './new-doc.js';
9
7
  import { LinkDocTooltip, NewDocTooltip } from './tooltips.js';
10
8
  const linkedDocSlashMenuConfig = {
11
9
  items: [
@@ -21,15 +19,9 @@ const linkedDocSlashMenuConfig = {
21
19
  captionWording: EMBED_DOC_SLASH_NEW_DOC_NAME,
22
20
  },
23
21
  group: '3_Page@0',
24
- when: ({ model }) => model.store.schema.flavourSchemaMap.has('affine:embed-linked-doc'),
22
+ when: ({ std, model }) => canCreateDocHere(std, model),
25
23
  action: ({ std, model }) => {
26
- const newDoc = createDefaultDoc(std.host.store.workspace);
27
- insertContent(std, model, REFERENCE_NODE, {
28
- reference: {
29
- type: 'LinkedPage',
30
- pageId: newDoc.id,
31
- },
32
- });
24
+ createDocFromSlash(std, model);
33
25
  },
34
26
  },
35
27
  {
@@ -1,4 +1,13 @@
1
+ import type { ChromeWording } from '../../affine-shared/services/index.js';
1
2
  import { LitElement, type PropertyValues, type TemplateResult } from 'lit';
3
+ /**
4
+ * The week header, Sunday first, in two letters: `Intl` short weekdays cut to
5
+ * two (`Su Mo…` in `en-US`, `Di Lu…` in `fr`), so the default reads as it
6
+ * did before the names came from `Intl`.
7
+ */
8
+ export declare function weekdayLabels(locale: string): string[];
9
+ /** The month names of the header and the month grid (`Jan…` in `en-US`). */
10
+ export declare function monthLabels(locale: string): string[];
2
11
  export interface DateCell {
3
12
  date: Date;
4
13
  label: string;
@@ -95,6 +104,17 @@ export declare class DatePicker extends DatePicker_base {
95
104
  accessor size: number;
96
105
  /** Checked date timestamp */
97
106
  accessor value: number | undefined;
107
+ /**
108
+ * The BCP-47 locale of the day and month names (`formatLocale(std)` at the
109
+ * caller). `en-US` by default, which reads as the picker always did.
110
+ */
111
+ accessor locale: string;
112
+ /**
113
+ * Resolves the picker's own wordings: it renders in a popup, outside the
114
+ * editor, so its caller holds the catalogue. Absent, English.
115
+ */
116
+ accessor wording: ((wording: ChromeWording) => string) | undefined;
117
+ private say;
98
118
  }
99
119
  declare global {
100
120
  interface HTMLElementTagNameMap {
@@ -39,24 +39,29 @@ import { html, LitElement, nothing, } from 'lit';
39
39
  import { property } from 'lit/decorators.js';
40
40
  import { classMap } from 'lit/directives/class-map.js';
41
41
  import { styleMap } from 'lit/directives/style-map.js';
42
+ import { DATE_PICKER_CLEAR, DATE_PICKER_NEXT, DATE_PICKER_PREVIOUS, DATE_PICKER_TODAY, } from '../translations.js';
42
43
  import { arrowLeftIcon } from './icons.js';
43
44
  import { datePickerStyle } from './style.js';
44
45
  import { getMonthMatrix, toDate } from './utils.js';
45
- const days = ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'];
46
- const months = [
47
- 'Jan',
48
- 'Feb',
49
- 'Mar',
50
- 'Apr',
51
- 'May',
52
- 'Jun',
53
- 'Jul',
54
- 'Aug',
55
- 'Sep',
56
- 'Oct',
57
- 'Nov',
58
- 'Dec',
59
- ];
46
+ /**
47
+ * The week header, Sunday first, in two letters: `Intl` short weekdays cut to
48
+ * two (`Su Mo…` in `en-US`, `Di Lu…` in `fr`), so the default reads as it
49
+ * did before the names came from `Intl`.
50
+ */
51
+ export function weekdayLabels(locale) {
52
+ const format = new Intl.DateTimeFormat(locale, { weekday: 'short' });
53
+ // 2023-01-01 is a Sunday.
54
+ return Array.from({ length: 7 }, (_, i) => {
55
+ const name = format.format(new Date(2023, 0, 1 + i)).slice(0, 2);
56
+ return name.charAt(0).toLocaleUpperCase(locale) + name.slice(1);
57
+ });
58
+ }
59
+ /** The month names of the header and the month grid (`Jan…` in `en-US`). */
60
+ export function monthLabels(locale) {
61
+ const format = new Intl.DateTimeFormat(locale, { month: 'short' });
62
+ return Array.from({ length: 12 }, (_, i) => format.format(new Date(2023, i, 1)));
63
+ }
64
+ const englishWording = (wording) => wording[1];
60
65
  /**
61
66
  * Date picker
62
67
  */
@@ -107,6 +112,12 @@ let DatePicker = (() => {
107
112
  let _value_decorators;
108
113
  let _value_initializers = [];
109
114
  let _value_extraInitializers = [];
115
+ let _locale_decorators;
116
+ let _locale_initializers = [];
117
+ let _locale_extraInitializers = [];
118
+ let _wording_decorators;
119
+ let _wording_initializers = [];
120
+ let _wording_extraInitializers = [];
110
121
  return class DatePicker extends _classSuper {
111
122
  static {
112
123
  const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
@@ -125,6 +136,8 @@ let DatePicker = (() => {
125
136
  _popup_decorators = [property({ type: Boolean })];
126
137
  _size_decorators = [property({ type: Number })];
127
138
  _value_decorators = [property({ type: Number })];
139
+ _locale_decorators = [property({ attribute: false })];
140
+ _wording_decorators = [property({ attribute: false })];
128
141
  __esDecorate(this, null, __matrix_decorators, { kind: "accessor", name: "_matrix", static: false, private: false, access: { has: obj => "_matrix" in obj, get: obj => obj._matrix, set: (obj, value) => { obj._matrix = value; } }, metadata: _metadata }, __matrix_initializers, __matrix_extraInitializers);
129
142
  __esDecorate(this, null, __mode_decorators, { kind: "accessor", name: "_mode", static: false, private: false, access: { has: obj => "_mode" in obj, get: obj => obj._mode, set: (obj, value) => { obj._mode = value; } }, metadata: _metadata }, __mode_initializers, __mode_extraInitializers);
130
143
  __esDecorate(this, null, __monthCursor_decorators, { kind: "accessor", name: "_monthCursor", static: false, private: false, access: { has: obj => "_monthCursor" in obj, get: obj => obj._monthCursor, set: (obj, value) => { obj._monthCursor = value; } }, metadata: _metadata }, __monthCursor_initializers, __monthCursor_extraInitializers);
@@ -140,6 +153,8 @@ let DatePicker = (() => {
140
153
  __esDecorate(this, null, _popup_decorators, { kind: "accessor", name: "popup", static: false, private: false, access: { has: obj => "popup" in obj, get: obj => obj.popup, set: (obj, value) => { obj.popup = value; } }, metadata: _metadata }, _popup_initializers, _popup_extraInitializers);
141
154
  __esDecorate(this, null, _size_decorators, { kind: "accessor", name: "size", static: false, private: false, access: { has: obj => "size" in obj, get: obj => obj.size, set: (obj, value) => { obj.size = value; } }, metadata: _metadata }, _size_initializers, _size_extraInitializers);
142
155
  __esDecorate(this, null, _value_decorators, { kind: "accessor", name: "value", static: false, private: false, access: { has: obj => "value" in obj, get: obj => obj.value, set: (obj, value) => { obj.value = value; } }, metadata: _metadata }, _value_initializers, _value_extraInitializers);
156
+ __esDecorate(this, null, _locale_decorators, { kind: "accessor", name: "locale", static: false, private: false, access: { has: obj => "locale" in obj, get: obj => obj.locale, set: (obj, value) => { obj.locale = value; } }, metadata: _metadata }, _locale_initializers, _locale_extraInitializers);
157
+ __esDecorate(this, null, _wording_decorators, { kind: "accessor", name: "wording", static: false, private: false, access: { has: obj => "wording" in obj, get: obj => obj.wording, set: (obj, value) => { obj.wording = value; } }, metadata: _metadata }, _wording_initializers, _wording_extraInitializers);
143
158
  if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
144
159
  }
145
160
  static { this.styles = datePickerStyle; }
@@ -168,7 +183,7 @@ let DatePicker = (() => {
168
183
  return this._cursor.getDay();
169
184
  }
170
185
  get dayLabel() {
171
- return days[this.day];
186
+ return weekdayLabels(this.locale)[this.day];
172
187
  }
173
188
  get minHeight() {
174
189
  const rowNum = this._matrix.length;
@@ -178,7 +193,7 @@ let DatePicker = (() => {
178
193
  return this._cursor.getMonth();
179
194
  }
180
195
  get monthLabel() {
181
- return months[this.month];
196
+ return monthLabels(this.locale)[this.month];
182
197
  }
183
198
  get year() {
184
199
  return this._cursor.getFullYear();
@@ -228,13 +243,13 @@ let DatePicker = (() => {
228
243
 
229
244
  ${this._navAction(() => this._moveMonth(-1), () => this._moveMonth(1), html `<button
230
245
  tabindex="0"
231
- aria-label="today"
246
+ aria-label=${this.say(DATE_PICKER_TODAY)}
232
247
  class="action-label interactive today"
233
248
  @click=${() => {
234
249
  this._onChange(new Date());
235
250
  }}
236
251
  >
237
- <span>TODAY</span>
252
+ <span>${this.say(DATE_PICKER_TODAY)}</span>
238
253
  </button>`)}
239
254
  </div>
240
255
  ${this._dayHeaderRenderer()}
@@ -247,11 +262,11 @@ let DatePicker = (() => {
247
262
  ? html `<div class="date-picker-footer">
248
263
  <button
249
264
  tabindex="0"
250
- aria-label="clear"
265
+ aria-label=${this.say(DATE_PICKER_CLEAR)}
251
266
  class="footer-button interactive"
252
267
  @click=${() => this.onClear?.()}
253
268
  >
254
- Clear
269
+ ${this.say(DATE_PICKER_CLEAR)}
255
270
  </button>
256
271
  </div>`
257
272
  : nothing}`;
@@ -259,7 +274,7 @@ let DatePicker = (() => {
259
274
  /** Week header */
260
275
  _dayHeaderRenderer() {
261
276
  return html `<div class="days-header">
262
- ${days.map(day => html `<div class="date-cell">${day}</div>`)}
277
+ ${weekdayLabels(this.locale).map(day => html `<div class="date-cell">${day}</div>`)}
263
278
  </div>`;
264
279
  }
265
280
  _getMatrix() {
@@ -307,7 +322,7 @@ let DatePicker = (() => {
307
322
  })}
308
323
  </div>
309
324
  <div class="date-picker-month">
310
- ${months.map((month, index) => {
325
+ ${monthLabels(this.locale).map((month, index) => {
311
326
  const isActive = this.value
312
327
  ? isSameMonth(this.value, new Date(this._monthPickYearCursor, index, 1))
313
328
  : false;
@@ -348,7 +363,7 @@ let DatePicker = (() => {
348
363
  });
349
364
  return html `<div class=${classes}>
350
365
  <button
351
- aria-label="previous month"
366
+ aria-label=${this.say(DATE_PICKER_PREVIOUS)}
352
367
  class="date-picker-small-action interactive left"
353
368
  @click=${onPrev}
354
369
  ?disabled=${prevDisable}
@@ -357,7 +372,7 @@ let DatePicker = (() => {
357
372
  </button>
358
373
  ${slot ?? nothing}
359
374
  <button
360
- aria-label="next month"
375
+ aria-label=${this.say(DATE_PICKER_NEXT)}
361
376
  class="date-picker-small-action interactive right"
362
377
  @click=${onNext}
363
378
  ?disabled=${nextDisable}
@@ -636,6 +651,23 @@ let DatePicker = (() => {
636
651
  /** Checked date timestamp */
637
652
  get value() { return this.#value_accessor_storage; }
638
653
  set value(value) { this.#value_accessor_storage = value; }
654
+ #locale_accessor_storage;
655
+ /**
656
+ * The BCP-47 locale of the day and month names (`formatLocale(std)` at the
657
+ * caller). `en-US` by default, which reads as the picker always did.
658
+ */
659
+ get locale() { return this.#locale_accessor_storage; }
660
+ set locale(value) { this.#locale_accessor_storage = value; }
661
+ #wording_accessor_storage;
662
+ /**
663
+ * Resolves the picker's own wordings: it renders in a popup, outside the
664
+ * editor, so its caller holds the catalogue. Absent, English.
665
+ */
666
+ get wording() { return this.#wording_accessor_storage; }
667
+ set wording(value) { this.#wording_accessor_storage = value; }
668
+ say(wording) {
669
+ return (this.wording ?? englishWording)(wording);
670
+ }
639
671
  constructor() {
640
672
  super(...arguments);
641
673
  /** current active month */
@@ -657,7 +689,9 @@ let DatePicker = (() => {
657
689
  this.#popup_accessor_storage = (__runInitializers(this, _padding_extraInitializers), __runInitializers(this, _popup_initializers, false));
658
690
  this.#size_accessor_storage = (__runInitializers(this, _popup_extraInitializers), __runInitializers(this, _size_initializers, 28));
659
691
  this.#value_accessor_storage = (__runInitializers(this, _size_extraInitializers), __runInitializers(this, _value_initializers, undefined));
660
- __runInitializers(this, _value_extraInitializers);
692
+ this.#locale_accessor_storage = (__runInitializers(this, _value_extraInitializers), __runInitializers(this, _locale_initializers, 'en-US'));
693
+ this.#wording_accessor_storage = (__runInitializers(this, _locale_extraInitializers), __runInitializers(this, _wording_initializers, undefined));
694
+ __runInitializers(this, _wording_extraInitializers);
661
695
  }
662
696
  };
663
697
  })();
@@ -32,6 +32,7 @@ export const datePickerStyle = css `
32
32
  .interactive.date-picker-small-action,
33
33
  .interactive.action-label.today {
34
34
  color: var(--affine-icon-color);
35
+ text-transform: uppercase;
35
36
  }
36
37
 
37
38
  .date-picker-small-action:hover {
@@ -35,6 +35,10 @@ export { COLOR_LABEL, FILL_COLOR_LABEL };
35
35
  export declare const BORDER_COLOR_LABEL: ChromeWording;
36
36
  export declare const CONTEXT_MENU_NO_RESULTS: ChromeWording;
37
37
  export declare const CONTEXT_MENU_DONE: ChromeWording;
38
+ export declare const DATE_PICKER_TODAY: ChromeWording;
39
+ export declare const DATE_PICKER_CLEAR: ChromeWording;
40
+ export declare const DATE_PICKER_PREVIOUS: ChromeWording;
41
+ export declare const DATE_PICKER_NEXT: ChromeWording;
38
42
  export declare const LINE_STYLE_SOLID: ChromeWording;
39
43
  export declare const LINE_STYLE_DASH: ChromeWording;
40
44
  export declare const LINE_STYLE_NONE: ChromeWording;
@@ -81,6 +81,28 @@ export const CONTEXT_MENU_DONE = [
81
81
  'com.labre.context-menu.done',
82
82
  'Done',
83
83
  ];
84
+ /* ── Date picker (database date cells, the chips band, date filters) ─── */
85
+ /*
86
+ * Its caller resolves them (the picker renders in a popup, outside the
87
+ * editor) and passes `wording`. Day and month names are not keys: they come
88
+ * from `Intl` in the caller's `locale` (`formatLocale(std)`).
89
+ */
90
+ export const DATE_PICKER_TODAY = [
91
+ 'com.labre.date-picker.today',
92
+ 'Today',
93
+ ];
94
+ export const DATE_PICKER_CLEAR = [
95
+ 'com.labre.date-picker.clear',
96
+ 'Clear',
97
+ ];
98
+ export const DATE_PICKER_PREVIOUS = [
99
+ 'com.labre.date-picker.previous-month',
100
+ 'Previous month',
101
+ ];
102
+ export const DATE_PICKER_NEXT = [
103
+ 'com.labre.date-picker.next-month',
104
+ 'Next month',
105
+ ];
84
106
  /* ── Edgeless line style / width panels ─────────────────────────────── */
85
107
  export const LINE_STYLE_SOLID = [
86
108
  'com.labre.line-style.solid',
@@ -415,6 +437,10 @@ export { ICON_BUTTON_COMING_SOON };
415
437
  * restated there.
416
438
  */
417
439
  export const COMPONENTS_WORDINGS = [
440
+ DATE_PICKER_TODAY,
441
+ DATE_PICKER_CLEAR,
442
+ DATE_PICKER_PREVIOUS,
443
+ DATE_PICKER_NEXT,
418
444
  CAPTION_PLACEHOLDER,
419
445
  CARD_STYLE_LABEL,
420
446
  FAVICON_ALT,
@@ -4,6 +4,14 @@ declare const DocTitle_base: typeof ShadowlessElement & import("../global/utils/
4
4
  export declare class DocTitle extends DocTitle_base {
5
5
  static styles: import("lit").CSSResult;
6
6
  private _getOrCreateFirstPageVisibleNote;
7
+ /**
8
+ * Leaves the title for `bodyBlockId`: the title loses the caret (its text
9
+ * is already stored, so that is all "validating" it means), then the block
10
+ * takes the caret where it can, through its `focusFirstCell` (a database
11
+ * block's: the first cell of a table or kanban view). A block without one,
12
+ * or a view without cells, keeps nothing focused. Writes nothing.
13
+ */
14
+ private _leaveForBodyBlock;
7
15
  private readonly _onTitleKeyDown;
8
16
  private readonly _updateTitleInMeta;
9
17
  private get _std();
@@ -27,5 +35,15 @@ export declare class DocTitle extends DocTitle_base {
27
35
  private accessor _richTextElement;
28
36
  accessor doc: Store;
29
37
  accessor wrapText: boolean;
38
+ /**
39
+ * The block that is the page's body, when the document's note is not (a
40
+ * database's full page, ADR 0035 B13: the document holds the database
41
+ * block and its schema blocks in a note the page never draws). Set, the
42
+ * title has no body of its own: Enter and ArrowDown leave the title for
43
+ * this block and never add or focus a paragraph, so nothing is ever
44
+ * written to the note. Unset (the default), Enter splits the title into a
45
+ * first paragraph and ArrowDown focuses or creates one, as in 0.48.
46
+ */
47
+ accessor bodyBlockId: string | undefined;
30
48
  }
31
49
  export {};